pub struct SdfNodeEditor {
pub graph: NodeGraph,
pub selection: NodeSelection,
pub clipboard: Option<NodeClipboard>,
pub pan: Vec2,
pub zoom: f32,
pub show_glsl: bool,
pub snap_grid: bool,
pub grid_size: f32,
/* private fields */
}Expand description
Full SDF node editor — owns the graph, selection, clipboard, undo stack.
Fields§
§graph: NodeGraph§selection: NodeSelection§clipboard: Option<NodeClipboard>§pan: Vec2Camera pan in canvas space.
zoom: f32Camera zoom (canvas pixels per unit).
show_glsl: boolWhether to show the GLSL preview pane.
snap_grid: boolWhether the snapping grid is enabled.
grid_size: f32Implementations§
Source§impl SdfNodeEditor
impl SdfNodeEditor
pub fn new(graph_name: impl Into<String>) -> Self
pub fn add_primitive(&mut self, kind: PrimitiveKind) -> NodeId
pub fn add_combinator(&mut self, kind: CombinatorKind) -> NodeId
pub fn remove_selected(&mut self)
pub fn connect(&mut self, from: NodeId, to: NodeId, port: PortId)
pub fn set_root(&mut self, id: NodeId)
pub fn undo(&mut self)
pub fn redo(&mut self)
pub fn copy_selected(&mut self)
pub fn paste(&mut self)
pub fn canvas_to_world(&self, canvas_p: Vec2) -> Vec2
pub fn world_to_canvas(&self, world_p: Vec2) -> Vec2
pub fn zoom_at(&mut self, canvas_p: Vec2, delta: f32)
pub fn snap(&self, pos: Vec2) -> Vec2
pub fn begin_drag(&mut self, node: NodeId, cursor: Vec2)
pub fn update_drag(&mut self, cursor: Vec2)
pub fn end_drag(&mut self)
pub fn glsl_output(&mut self) -> &str
pub fn status_line(&self) -> String
pub fn palette_labels() -> Vec<(&'static str, &'static str)>
Source§impl SdfNodeEditor
impl SdfNodeEditor
Sourcepub fn default_body_graph() -> Self
pub fn default_body_graph() -> Self
Build a starter graph that approximates a human-body scaffold.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SdfNodeEditor
impl RefUnwindSafe for SdfNodeEditor
impl Send for SdfNodeEditor
impl Sync for SdfNodeEditor
impl Unpin for SdfNodeEditor
impl UnsafeUnpin for SdfNodeEditor
impl UnwindSafe for SdfNodeEditor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.