NodeEditor

Struct NodeEditor 

Source
pub struct NodeEditor<'ui> { /* private fields */ }
Expand description

RAII token for a node editor frame

Implementations§

Source§

impl<'ui> NodeEditor<'ui>

Source

pub fn minimap(&self, size_fraction: f32, location: MiniMapLocation)

Draw a minimap in the editor

Source

pub fn minimap_with_callback<F: FnMut(i32)>( &self, size_fraction: f32, location: MiniMapLocation, callback: &mut F, )

Draw a minimap with a node-hover callback (invoked during this call)

Source

pub fn node(&self, id: i32) -> NodeToken<'_>

Begin a node

Source

pub fn input_attr(&self, id: i32, shape: PinShape) -> AttributeToken<'_>

Begin an input attribute pin

Source

pub fn output_attr(&self, id: i32, shape: PinShape) -> AttributeToken<'_>

Begin an output attribute pin

Source

pub fn static_attr(&self, id: i32) -> AttributeToken<'_>

Begin a static attribute region

Draw a link between two attributes

Query if a link was created this frame (attribute-id version)

Query link created with node ids and attribute ids

Source

pub fn selected_nodes(&self) -> Vec<i32>

Selection helpers

Source

pub fn clear_selection(&self)

Source

pub fn is_editor_hovered(&self) -> bool

Hover queries

Source

pub fn hovered_node(&self) -> Option<i32>

Source

pub fn hovered_pin(&self) -> Option<i32>

Source

pub fn is_attribute_active(&self) -> bool

Attribute active state

Source

pub fn any_attribute_active(&self) -> Option<i32>

Link drag/drop lifecycle

Source

pub fn set_style_flag(&self, flag: StyleFlags, enabled: bool)

Toggle style flags (GridLines, GridLinesPrimary, GridSnapping, NodeOutline)

Enable link detach with Ctrl by binding to ImGui IO KeyCtrl

Source

pub fn enable_multiple_select_with_ctrl(&self)

Enable multiple select modifier as Ctrl

Source

pub fn enable_multiple_select_with_shift(&self)

Enable multiple select modifier as Shift

Source

pub fn emulate_three_button_mouse_with_alt(&self)

Emulate three-button mouse with Alt

Source

pub fn set_alt_mouse_button(&self, button: i32)

IO tweaks

Source

pub fn set_auto_panning_speed(&self, speed: f32)

Source

pub fn style_colors_dark(&self)

Style preset helpers

Source

pub fn style_colors_classic(&self)

Source

pub fn style_colors_light(&self)

Source

pub fn set_node_pos_grid(&self, node_id: i32, pos: [f32; 2])

Node positions in grid space

Source

pub fn get_node_pos_grid(&self, node_id: i32) -> [f32; 2]

Source

pub fn set_grid_spacing(&self, spacing: f32)

Persistent style setters

Source

pub fn set_node_corner_rounding(&self, rounding: f32)

Source

pub fn set_node_padding(&self, padding: [f32; 2])

Source

pub fn set_pin_circle_radius(&self, r: f32)

Source

pub fn set_pin_quad_side_length(&self, v: f32)

Source

pub fn set_pin_triangle_side_length(&self, v: f32)

Source

pub fn set_pin_line_thickness(&self, v: f32)

Source

pub fn set_pin_hover_radius(&self, v: f32)

Source

pub fn set_pin_offset(&self, offset: f32)

Source

pub fn set_node_border_thickness(&self, v: f32)

Source

pub fn set_minimap_padding(&self, padding: [f32; 2])

Source

pub fn set_minimap_offset(&self, offset: [f32; 2])

Source

pub fn set_color(&self, elem: ColorElement, color: [f32; 4])

Source

pub fn get_color(&self, elem: ColorElement) -> [f32; 4]

Get a style color as RGBA floats [0,1]

Source

pub fn set_node_pos_screen(&self, node_id: i32, pos: [f32; 2])

Node positions in screen/editor space

Source

pub fn set_node_pos_editor(&self, node_id: i32, pos: [f32; 2])

Source

pub fn get_node_pos_screen(&self, node_id: i32) -> [f32; 2]

Source

pub fn get_node_pos_editor(&self, node_id: i32) -> [f32; 2]

Source

pub fn set_node_draggable(&self, node_id: i32, draggable: bool)

Node drag/size helpers

Source

pub fn snap_node_to_grid(&self, node_id: i32)

Source

pub fn get_node_dimensions(&self, node_id: i32) -> [f32; 2]

Check if a link was destroyed this frame, returning its id

Source§

impl<'ui> NodeEditor<'ui>

Source

pub fn end(self) -> PostEditor

Explicitly end the node editor and return post-editor query handle

Source§

impl<'ui> NodeEditor<'ui>

Style helpers available from NodeEditor

Source

pub fn push_attribute_flag(&self, flag: AttributeFlags) -> AttributeFlagToken

Source

pub fn push_color(&self, elem: ColorElement, color: [f32; 4]) -> ColorToken

Source

pub fn push_style_var( &self, var: StyleVar, value: StyleVarValue, ) -> StyleVarToken

Source

pub fn push_style_var_f32(&self, var: i32, value: f32) -> StyleVarToken

Source

pub fn push_style_var_vec2(&self, var: i32, value: [f32; 2]) -> StyleVarToken

Trait Implementations§

Source§

impl<'ui> Drop for NodeEditor<'ui>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'ui> Freeze for NodeEditor<'ui>

§

impl<'ui> !RefUnwindSafe for NodeEditor<'ui>

§

impl<'ui> !Send for NodeEditor<'ui>

§

impl<'ui> !Sync for NodeEditor<'ui>

§

impl<'ui> Unpin for NodeEditor<'ui>

§

impl<'ui> !UnwindSafe for NodeEditor<'ui>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more