simvx.core.ui.graph_edit¶
Node graph editor widget for visual programming, animation blend trees, shader graphs.
Provides GraphNode (a draggable node with typed input/output ports) and GraphEdit (a zoomable canvas that manages nodes and connections).
Module Contents¶
Classes¶
Input or output port on a GraphNode. |
|
Connection between two ports on two GraphNodes. |
|
A node in the graph editor with titled header and typed input/output ports. |
|
Zoomable node graph editor with pan, zoom, and connection management. |
Data¶
API¶
- simvx.core.ui.graph_edit.log¶
‘getLogger(…)’
- simvx.core.ui.graph_edit.__all__¶
[‘GraphPort’, ‘GraphConnection’, ‘GraphNode’, ‘GraphEdit’]
- class simvx.core.ui.graph_edit.GraphPort[source]¶
Input or output port on a GraphNode.
Attributes: name: Display name. type: Type identifier for connection validation. colour: RGBA colour for the port indicator.
- name: str¶
None
- type: str¶
‘default’
- colour: tuple[float, float, float, float]¶
(0.8, 0.8, 0.8, 1.0)
- class simvx.core.ui.graph_edit.GraphConnection[source]¶
Connection between two ports on two GraphNodes.
Attributes: from_node: Source node name. from_port: Source output port index. to_node: Destination node name. to_port: Destination input port index.
- from_node: str¶
None
- from_port: int¶
None
- to_node: str¶
None
- to_port: int¶
None
- class simvx.core.ui.graph_edit.GraphNode(**kwargs)[source]¶
Bases:
simvx.core.ui.containers.ContainerA node in the graph editor with titled header and typed input/output ports.
Example: node = GraphNode(title=”Add”) node.add_input(“A”, type=”float”) node.add_input(“B”, type=”float”) node.add_output(“Result”, type=”float”) graph.add_graph_node(node)
Initialization
- title¶
‘Property(…)’
- graph_position¶
‘Property(…)’
- size_x¶
‘Property(…)’
- size_y¶
‘Property(…)’
- __transient__¶
‘frozenset(…)’
- get_input_port_position(index: int) tuple[float, float][source]¶
Position of input port in local node space.
- get_output_port_position(index: int) tuple[float, float][source]¶
Position of output port in local node space.
- separation¶
‘Property(…)’
- on_enter_tree()¶
- on_ready()¶
- on_exit_tree()¶
- add_child(node: simvx.core.node.T) simvx.core.node.T¶
- remove_child(node: simvx.core.node.Node) None¶
- mark_layout_dirty()¶
- min_size_x¶
‘Property(…)’
- min_size_y¶
‘Property(…)’
- anchor_left¶
‘Property(…)’
- anchor_top¶
‘Property(…)’
- anchor_right¶
‘Property(…)’
- anchor_bottom¶
‘Property(…)’
- margin_left¶
‘Property(…)’
- margin_top¶
‘Property(…)’
- margin_right¶
‘Property(…)’
- margin_bottom¶
‘Property(…)’
- dismiss_on_outside_click¶
‘Property(…)’
- clip_contents¶
‘Property(…)’
- focus_mode¶
‘Property(…)’
- tooltip¶
‘Property(…)’
- mouse_filter¶
‘Property(…)’
- size_flags_horizontal¶
‘Property(…)’
- size_flags_vertical¶
‘Property(…)’
- stretch_ratio¶
‘Property(…)’
- max_size¶
‘Property(…)’
- property size: simvx.core.math.types.Vec2¶
- property min_size: simvx.core.math.types.Vec2¶
- content_signature() object¶
- content_uses(chars: str) bool¶
- autosize_to_content() None¶
- touch_mode: str¶
‘mouse’
- property theme: simvx.core.ui.types.Theme | None¶
- property mouse_over: bool¶
- property focused: bool¶
- property disabled: bool¶
- get_theme() simvx.core.ui.types.Theme¶
- queue_redraw()¶
- get_minimum_size() simvx.core.math.types.Vec2¶
- get_rect() tuple[float, float, float, float]¶
- get_global_rect() tuple[float, float, float, float]¶
- is_point_inside(point) bool¶
- place_bottom_strip(height: float) None¶
- place_top_strip(height: float) None¶
- set_anchor_preset(preset: simvx.core.ui.enums.AnchorPreset)¶
- activate() bool¶
- set_focus()¶
- grab_focus()¶
- release_focus()¶
- has_focus() bool¶
- focus_next_control()¶
- focus_previous_control()¶
- grab_mouse()¶
- release_mouse()¶
- set_drag_preview(control: simvx.core.ui.core.Control)¶
- property is_overlay_open: bool¶
- show_overlay(modality: str = 'light', *, dim: bool | None = None, dismiss: bool | None = None, inert: bool | None = None, owner: simvx.core.ui.core.Control | None = None, initial_focus: simvx.core.ui.core.Control | None = None) None¶
- close_overlay() None¶
- position¶
‘_SpatialVecProperty(…)’
- rotation¶
‘Property(…)’
- scale¶
‘_SpatialVecProperty(…)’
- z_index¶
‘Property(…)’
- z_as_relative¶
‘Property(…)’
- render_layer¶
‘Property(…)’
- set_render_layer(index: int, enabled: bool = True) None¶
- is_on_render_layer(index: int) bool¶
- property absolute_z_index: int¶
- property rotation_degrees: float¶
- property world_position: simvx.core.math.types.Vec2¶
- property world_rotation: float¶
- property world_scale: simvx.core.math.types.Vec2¶
- property world_transform: tuple[simvx.core.math.types.Vec2, simvx.core.math.types.Vec2, float]¶
- property forward: simvx.core.math.types.Vec2¶
- property right: simvx.core.math.types.Vec2¶
- translate(offset: tuple[float, float] | numpy.ndarray)¶
- rotate(radians: float)¶
- rotate_deg(degrees: float)¶
- look_at(target: tuple[float, float] | numpy.ndarray)¶
- transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]¶
- draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, colour=None)¶
- wrap_screen(margin: float = 20)¶
- hdr¶
‘Property(…)’
- property transform_render_dirty: bool¶
- strict_errors: ClassVar[bool]¶
True
- dev_checks: ClassVar[bool]¶
None
- script_error_raised¶
‘Signal(…)’
- dynamic: bool¶
False
- visible¶
‘Property(…)’
- update_mode¶
‘Property(…)’
- __properties__: ClassVar[dict[str, simvx.core.descriptors.Property]]¶
None
- classmethod __init_subclass__(**kwargs)¶
- property name: str¶
- property visible_in_tree: bool¶
- reset_error() None¶
- reparent(new_parent: simvx.core.node.Node)¶
- node_at(path, default=_NO_DEFAULT)¶
- find(target, *, direct: bool = False)¶
- find_all(target, *, direct: bool = False)¶
- expect(target, *, direct: bool = False)¶
- ancestor(target)¶
- walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]¶
- property path: str¶
- property is_scene_root: bool¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- on_update(dt: float) None¶
- on_fixed_update(dt: float) None¶
- on_draw(renderer) None¶
- on_picked(event: simvx.core.events.InputEvent) None¶
- on_unhandled_input(event: simvx.core.events.TreeInputEvent) None¶
- start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle¶
- stop_coroutine(gen_or_handle)¶
- property render_dirty: bool¶
- clear_children()¶
- destroy()¶
- property destroying: bool¶
- call_deferred(method: collections.abc.Callable[..., Any], *args: Any) None¶
- property app¶
- property tree: simvx.core.scene_tree.SceneTree¶
- property physics¶
- property physics_2d¶
- __getitem__(key: str)¶
- classmethod get_properties() dict[str, simvx.core.descriptors.Property]¶
- __repr__()¶
- class simvx.core.ui.graph_edit.GraphEdit(**kwargs)[source]¶
Bases:
simvx.core.ui.core.ControlZoomable node graph editor with pan, zoom, and connection management.
Nodes are placed in graph space. The viewport applies zoom and scroll offset to determine which portion of the graph is visible.
Example: graph = GraphEdit() node_a = GraphNode(name=”A”, title=”Source”) node_a.add_output(“Out”) graph.add_graph_node(node_a)
node_b = GraphNode(name="B", title="Sink") node_b.add_input("In") graph.add_graph_node(node_b) graph.connect_node("A", 0, "B", 0)Initialization
- size_x¶
‘Property(…)’
- size_y¶
‘Property(…)’
- add_graph_node(node: simvx.core.ui.graph_edit.GraphNode)[source]¶
Register a GraphNode in this editor.
- graph_node(name: str) simvx.core.ui.graph_edit.GraphNode | None[source]¶
Retrieve a registered GraphNode by name, or
None.Named for its siblings
add_graph_node/remove_graph_noderather than for :meth:~simvx.core.node.Node.node_at, which it would otherwise shadow: this reads one widget’s own registry, not the scene tree, and aGraphEditmust still be able to resolve a node path like any otherControl.
- connect_node(from_node: str, from_port: int, to_node: str, to_port: int)[source]¶
Create a connection between two ports.
- disconnect_node(from_node: str, from_port: int, to_node: str, to_port: int)[source]¶
Remove a specific connection.
- get_connections() list[simvx.core.ui.graph_edit.GraphConnection][source]¶
Return a copy of the current connections list.
- min_size_x¶
‘Property(…)’
- min_size_y¶
‘Property(…)’
- anchor_left¶
‘Property(…)’
- anchor_top¶
‘Property(…)’
- anchor_right¶
‘Property(…)’
- anchor_bottom¶
‘Property(…)’
- margin_left¶
‘Property(…)’
- margin_top¶
‘Property(…)’
- margin_right¶
‘Property(…)’
- margin_bottom¶
‘Property(…)’
- dismiss_on_outside_click¶
‘Property(…)’
- clip_contents¶
‘Property(…)’
- focus_mode¶
‘Property(…)’
- tooltip¶
‘Property(…)’
- mouse_filter¶
‘Property(…)’
- size_flags_horizontal¶
‘Property(…)’
- size_flags_vertical¶
‘Property(…)’
- stretch_ratio¶
‘Property(…)’
- max_size¶
‘Property(…)’
- property size: simvx.core.math.types.Vec2¶
- property min_size: simvx.core.math.types.Vec2¶
- content_signature() object¶
- content_uses(chars: str) bool¶
- autosize_to_content() None¶
- touch_mode: str¶
‘mouse’
- property theme: simvx.core.ui.types.Theme | None¶
- property mouse_over: bool¶
- property focused: bool¶
- property disabled: bool¶
- get_theme() simvx.core.ui.types.Theme¶
- queue_redraw()¶
- get_minimum_size() simvx.core.math.types.Vec2¶
- add_child(node: simvx.core.node.T) simvx.core.node.T¶
- get_rect() tuple[float, float, float, float]¶
- get_global_rect() tuple[float, float, float, float]¶
- is_point_inside(point) bool¶
- place_bottom_strip(height: float) None¶
- place_top_strip(height: float) None¶
- set_anchor_preset(preset: simvx.core.ui.enums.AnchorPreset)¶
- activate() bool¶
- set_focus()¶
- grab_focus()¶
- release_focus()¶
- has_focus() bool¶
- focus_next_control()¶
- focus_previous_control()¶
- grab_mouse()¶
- release_mouse()¶
- set_drag_preview(control: simvx.core.ui.core.Control)¶
- property is_overlay_open: bool¶
- show_overlay(modality: str = 'light', *, dim: bool | None = None, dismiss: bool | None = None, inert: bool | None = None, owner: simvx.core.ui.core.Control | None = None, initial_focus: simvx.core.ui.core.Control | None = None) None¶
- close_overlay() None¶
- position¶
‘_SpatialVecProperty(…)’
- rotation¶
‘Property(…)’
- scale¶
‘_SpatialVecProperty(…)’
- z_index¶
‘Property(…)’
- z_as_relative¶
‘Property(…)’
- render_layer¶
‘Property(…)’
- set_render_layer(index: int, enabled: bool = True) None¶
- is_on_render_layer(index: int) bool¶
- property absolute_z_index: int¶
- property rotation_degrees: float¶
- property world_position: simvx.core.math.types.Vec2¶
- property world_rotation: float¶
- property world_scale: simvx.core.math.types.Vec2¶
- property world_transform: tuple[simvx.core.math.types.Vec2, simvx.core.math.types.Vec2, float]¶
- property forward: simvx.core.math.types.Vec2¶
- property right: simvx.core.math.types.Vec2¶
- translate(offset: tuple[float, float] | numpy.ndarray)¶
- rotate(radians: float)¶
- rotate_deg(degrees: float)¶
- look_at(target: tuple[float, float] | numpy.ndarray)¶
- transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]¶
- draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, colour=None)¶
- wrap_screen(margin: float = 20)¶
- hdr¶
‘Property(…)’
- property transform_render_dirty: bool¶
- strict_errors: ClassVar[bool]¶
True
- dev_checks: ClassVar[bool]¶
None
- script_error_raised¶
‘Signal(…)’
- dynamic: bool¶
False
- visible¶
‘Property(…)’
- update_mode¶
‘Property(…)’
- __properties__: ClassVar[dict[str, simvx.core.descriptors.Property]]¶
None
- classmethod __init_subclass__(**kwargs)¶
- property name: str¶
- property visible_in_tree: bool¶
- reset_error() None¶
- remove_child(node: simvx.core.node.Node) None¶
- reparent(new_parent: simvx.core.node.Node)¶
- node_at(path, default=_NO_DEFAULT)¶
- find(target, *, direct: bool = False)¶
- find_all(target, *, direct: bool = False)¶
- expect(target, *, direct: bool = False)¶
- ancestor(target)¶
- walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]¶
- property path: str¶
- property is_scene_root: bool¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- on_ready() None¶
- on_enter_tree() None¶
- on_exit_tree() None¶
- on_update(dt: float) None¶
- on_fixed_update(dt: float) None¶
- on_picked(event: simvx.core.events.InputEvent) None¶
- on_unhandled_input(event: simvx.core.events.TreeInputEvent) None¶
- start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle¶
- stop_coroutine(gen_or_handle)¶
- property render_dirty: bool¶
- clear_children()¶
- destroy()¶
- property destroying: bool¶
- call_deferred(method: collections.abc.Callable[..., Any], *args: Any) None¶
- property app¶
- property tree: simvx.core.scene_tree.SceneTree¶
- property physics¶
- property physics_2d¶
- __getitem__(key: str)¶
- classmethod get_properties() dict[str, simvx.core.descriptors.Property]¶
- __repr__()¶