Module sverchok.node_tree
Generated documentation - http://nortikin.github.io/sverchok/apidocs/sverchok/node_tree.html
The module includes functionality of main tree (not group tree) and base class
for all nodes (SverchCustomTreeNode
).
Blender Data Blocks IDs
Memory addresses of all Blender objects are not constant, read more in Blender docs. So an object itself can be an identifier (at least for a long period of time). For that reason we have to create our own identifiers (for node trees, nodes, sockets) to associate data with them which can't be assigned to Blender objects directly.
Identifiers generated by trees, nodes, sockets are unique for all objects in a file (or probably even between files =).
Expand source code
# This file is part of project Sverchok. It's copyrighted by the contributors
# recorded in the version control history of the file, available from
# its original location https://github.com/nortikin/sverchok/commit/master
#
# SPDX-License-Identifier: GPL3
# License-Filename: LICENSE
"""
Generated documentation - http://nortikin.github.io/sverchok/apidocs/sverchok/node_tree.html
The module includes functionality of main tree (not group tree) and base class
for all nodes (`SverchCustomTreeNode`).
## Blender Data Blocks IDs
Memory addresses of all Blender objects are not constant, read more in
[Blender docs](https://docs.blender.org/api/current/info_gotcha.html#help-my-script-crashes-blender).
So an object itself can be an identifier (at least for a long period of time).
For that reason we have to create our own identifiers (for node trees, nodes,
sockets) to associate data with them which can't be assigned to Blender
objects directly.
Identifiers generated by trees, nodes, sockets are unique for all objects in
a file (or probably even between files =).
"""
import logging
import sys
import time
from contextlib import contextmanager
from itertools import chain, cycle
from pathlib import Path
from typing import Iterable, final, Optional
import bpy
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import NodeTree, NodeSocket
import sverchok
from sverchok.core.sv_custom_exceptions import SvNoDataError, DependencyError
import sverchok.core.events as ev
from sverchok.core.event_system import handle_event
from sverchok.data_structure import classproperty, post_load_call
from sverchok.utils.sv_node_utils import recursive_framed_location_finder
from sverchok.utils.docstring import SvDocstring
from sverchok.utils.sv_logging import catch_log_error, sv_logger
from sverchok.ui import color_def
from sverchok.ui.nodes_replacement import set_inputs_mapping, set_outputs_mapping
from sverchok.ui import bgl_callback_nodeview as sv_bgl
class SvNodeTreeCommon:
"""Common class for all Sverchok trees (regular trees and group ones)"""
#: Identifier of the tree, should be used via `SvNodeTreeCommon.tree_id` property.
tree_id_memory: StringProperty(default="", options={'SKIP_SAVE'})
sv_show_time_nodes: BoolProperty(
name="Node times",
default=False,
options=set(),
update=lambda s, c: handle_event(ev.TreeEvent(s)))
show_time_mode: EnumProperty(
items=[(n, n, '') for n in ["Per node", "Cumulative"]],
options=set(),
update=lambda s, c: handle_event(ev.TreeEvent(s)),
description="Mode of showing node update timings",
)
@property
def tree_id(self):
"""Identifier of the tree. [Rational](#blender-data-blocks-ids)."""
if not self.tree_id_memory:
self.tree_id_memory = str(hash(self) ^ hash(time.monotonic()))
return self.tree_id_memory
def update_gl_scale_info(self, origin=None):
"""
the nodeview scale and dpi differs between users and must be queried to get correct nodeview
x,y and dpi scale info.
this is instead of calling `get_dpi_factor` on every redraw.
"""
sv_logger.debug(f"update_gl_scale_info called from {origin or self.name}")
try:
from sverchok.utils.context_managers import sv_preferences
with sv_preferences() as prefs:
prefs.set_nodeview_render_params(None)
except Exception as err:
sv_logger.debug('failed to get gl scale info', err)
@contextmanager
def init_tree(self):
"""It suppresses calling the `UpdateNodes.update` method of nodes,
main usage of it is during generating tree with python (JSON import)
with tree.init_tree():
do_something()
"""
is_already_initializing = 'init_tree' in self
if is_already_initializing:
yield self
else:
self['init_tree'] = ''
try:
yield self
finally:
del self['init_tree']
def update_ui(self, nodes_errors, update_time):
""" The method get information about node statistic of last update from the handler to show in view space
The method is usually called by main handler to reevaluate view of the nodes in the tree
even if the tree is not in the Live update mode"""
update_time = update_time if self.sv_show_time_nodes else cycle([None])
for node, error, update in zip(self.nodes, nodes_errors, update_time):
if hasattr(node, 'update_ui'):
node.update_ui(error, update)
class SverchCustomTree(NodeTree, SvNodeTreeCommon):
''' Sverchok - architectural node programming of geometry in low level '''
bl_idname = 'SverchCustomTreeType'
bl_label = 'Sverchok Nodes'
bl_icon = 'RNA'
def turn_off_ng(self, context):
"""
Turn on/off displaying objects in viewport generated by viewer nodes.
Viewer nodes should have `show_viewport` method which takes 'to_show' bool argument
"""
for node in self.nodes:
try:
node.show_viewport(self.sv_show)
except AttributeError:
pass
def on_draft_mode_changed(self, context):
"""
This is triggered when `SverchCustomTree.sv_draft` mode of the tree is toggled.
It switches properties of some nodes from normal to draft and vice versa,
and update the nodes.
"""
draft_nodes = []
for node in self.nodes:
if hasattr(node, 'does_support_draft_mode') and node.does_support_draft_mode():
draft_nodes.append(node)
node.on_draft_mode_changed(self.sv_draft)
# From the user perspective, some of node parameters
# got new parameter values, so the setup should be recalculated;
# but technically, node properties were not changed
# (only other properties were shown in UI), so enabling/disabling
# of draft mode does not automatically trigger tree update.
# Here we trigger it manually.
if draft_nodes:
self.update_nodes(draft_nodes)
sv_process: BoolProperty(
name="Process",
default=True,
description='Update upon tree and node property changes',
update=lambda s, c: handle_event(ev.TreeEvent(s)),
options=set(),
)
"""If enabled it means that the tree will be evaluated upon changes in its
topology, changes in node properties or scene changes made by user.
This property does not effect evaluation upon `SverchCustomTree.sv_animate`
changes or by re-update all nodes operator. Enabling the property will call
the tree topology changes trigger."""
sv_animate: BoolProperty(
name="Animate",
default=True,
description='Animate this layout',
options=set())
"""If enabled the tree will be reevaluated upon frame change. The update can
effect not all nodes but only those which have property
`UpdateNodes.is_animatable` enabled."""
sv_show: BoolProperty(
name="Show",
default=True,
description='Show this layout',
update=turn_off_ng,
options=set())
"""See `SverchCustomTree.turn_off_ng"""
sv_show_socket_menus: BoolProperty(
name = "Show socket menus",
description = "Display socket dropdown menu buttons. NOTE: options that are enabled in those menus will be effective regardless of this checkbox!",
default = True,
options=set())
"""Display socket dropdown menu buttons (only for output).
Read more in [user documentation](http://nortikin.github.io/sverchok/docs/user_interface/input_menus.html).
"""
#: Draft mode replaces selected properties of certain nodes with smaller values to lighten cpu load.
sv_draft: BoolProperty(
name="Draft",
description="Draft (simplified processing) mode",
default=False,
update=on_draft_mode_changed,
options=set(),
)
sv_scene_update: BoolProperty(
name="Scene update",
description="Update upon changes in the scene",
options=set(),
default=True)
"""If enabled together with `SverchCustomTree.sv_process` the tree will be
reevaluated upon changes in the scene. It will effect only nodes with
`UpdateNodes.is_interactive` property enabled. The scene changes can be:
- moving objects
- changing edit / object mode
- mesh editing
- assign materials
- etc.
"""
def update(self):
"""This method is called if collection of nodes or links of the tree was changed"""
handle_event(ev.TreeEvent(self))
def force_update(self):
"""Update whole tree from scratch"""
# ideally we would never like to use this method but we live in the real world
handle_event(ev.ForceEvent(self))
def update_nodes(self, nodes):
"""This method expects to get list of its nodes which should be updated"""
return handle_event(ev.PropertyEvent(self, nodes))
def scene_update(self):
"""This method should be called by scene changes handler.
It ignores scene events generated by sverchok trees (they modify Bledner
data what cause execution of a scene handler). It updates nodes with
`UpdateNodes.is_interactive` enabled."""
handle_event(ev.SceneEvent(self))
def process_ani(self, frame_changed: bool, animation_playing: bool):
"""
Process the Sverchok node tree if animation layers show true.
For `sverchok.core.handlers.sv_update_handler`.
"""
handle_event(ev.AnimationEvent(self, frame_changed, animation_playing))
class UpdateNodes:
"""Everything related with update system of nodes"""
n_id: StringProperty(options={'SKIP_SAVE'})
"""Identifier of the node, should be used via `UpdateNodes.node_id` property.
```text
⚠️ There is no sense to override this property
```
"""
@property
def node_id(self):
"""Identifier of the node. [Rational](#blender-data-blocks-ids)"""
if not self.n_id:
self.n_id = str(hash(self) ^ hash(time.monotonic()))
return self.n_id
def update_interactive_mode(self, context):
"""When `UpdateNodes.is_interactive` mode is on the method updates only
outdated nodes"""
if self.is_interactive:
self.process_node(context)
is_interactive: BoolProperty(
default=True,
description="Update node upon changes in the scene",
update=update_interactive_mode,
name="Interactive")
"""When this option is on arbitrary changes in scene will update this node.
Those changes can be:
- moving objects
- changing edit / object mode
- mesh editing
- assign materials
- etc.
This option is used to display it in UI so user could switch it on/off.
it should be set to True (together with `UpdateNodes.is_scene_dependent`)
for nodes which read data from blender scene."""
is_scene_dependent = False
"""The option switches on to display automatically the `UpdateNodes.is_interactive`
option as a button inside a node but in this case the `SverchCustomTreeNode.draw_buttons`
method should not be overridden and `SverchCustomTreeNode.sv_draw_buttons`
should be used instead.

"""
def refresh_node(self, context):
"""Together with `UpdateNodes.refresh` property it is used as an
operator which updates the node."""
if self.refresh:
self.refresh = False
self.process_node(context)
refresh: BoolProperty(name="Update Node",
description="Update Node",
update=refresh_node)
"""See `UpdateNodes.refresh_node`.

The button is automatically displayed when at least `UpdateNodes.is_scene_dependent`
or `UpdateNodes.is_animation_dependent` is on. Also the node should use
`SverchCustomTreeNode.sv_draw_buttons`.
"""
is_animatable: BoolProperty(name="Animate Node",
description="Update Node on frame change",
default=True,
update=lambda s, c: s.process_node(c))
"""A switch for user to make a node to update on frame changes in a scene.
Use `UpdateNodes.is_animation_dependent` to display the option in node UI."""
is_animation_dependent = False
""" Use this to display the `UpdateNodes.is_animatable` option in node UI.
Also the node should use `SverchCustomTreeNode.sv_draw_buttons`.
"""
def sv_init(self, context):
"""
This method will be called during node creation
Typically it is used for socket creating and assigning properties to sockets
"""
pass
def sv_update(self):
"""
This method can be overridden in inherited classes.
It will be triggered upon any `node tree` editor changes (new/copy/delete links/nodes).
Calling of this method is unordered among other calls of the method of other nodes in a tree.
Typically, it is used to change output socket types dependent on what
type is connected to a node.
"""
pass
def sv_copy(self, original):
"""
Override this method to do anything node-specific (clean properties)
at the moment of node being copied.
"""
pass
def sv_free(self):
"""
Override this method to do anything node-specific upon node removal
"""
pass
@final
def init(self, context):
"""
This function is triggered upon node creation, functionality:
- sets default colors of the node
- show alpha/beta state of the node
- logs further errors
- delegates further initialization information to `UpdateNodes.sv_init`
"""
if self.sv_default_color:
self.use_custom_color = True
self.color = self.sv_default_color
if hasattr(self, 'sv_icon') and self.sv_icon in {'SV_ALPHA', 'SV_BETA'}:
frame = self.id_data.nodes.new("NodeFrame")
self.parent = frame
frame.label = f'{"Alpha" if self.sv_icon == "SV_ALPHA" else "Beta"} Node'
frame.use_custom_color = True
frame.color = (0.3, 0, 0.7)
frame.shrink = True
frame['in_development'] = True # can be used to distinguish the frame
with catch_log_error():
self.sv_init(context)
def sv_new_input(self, socket_type, name, **attrib_dict):
"""Alias of creating and setting socket properties. Example:
```py
self.sv_new_input('SvStringsSocket', "Polygons",
hide_safe=True, prop_name='scale_factor')
```"""
socket = self.inputs.new(socket_type, name)
for att in attrib_dict:
setattr(socket, att, attrib_dict[att])
return socket
@final
def free(self):
"""Called upon the node removal
- calls `UpdateNodes.sv_free
- cleans socket data catch
- cleans drawings in the tree editor space"""
self.sv_free()
for s in chain(self.inputs, self.outputs):
s.sv_forget()
self.update_ui()
@final
def copy(self, original):
"""Called upon the node being copied
- refreshes node and socket ids
- calls `UpdateNodes.sv_copy`"""
self.n_id = ""
for sock in chain(self.inputs, self.outputs):
sock.s_id = ''
self.sv_copy(original)
@final
def update(self):
"""
The method will be triggered upon editor changes, typically before node
tree update method. It calls `UpdateNodes.sv_update`.
```text
⚠️ It checks special flag in the tree of the node. The flag
is set by json import module. If the tree has the flag the node skips
farther execution of the method. This is done for performance reason
and actually there is no reason to execute the method since the import
module totally controls building of the tree.
```
The flag can be set by `SvNodeTreeCommon.init_tree`.
"""
if 'init_tree' in self.id_data: # tree is building by a script - let it do this
return
self.sv_update()
def update_ui(self, error=None, update_time=None):
"""This method is intended to use by update system to show node errors
in the tree editors space and to show execution time"""
sv_settings = bpy.context.preferences.addons[sverchok.__name__].preferences
exception_color = sv_settings.exception_color
no_data_color = sv_settings.no_data_color
error_pref = "error"
update_pref = "update_time"
# update error colors
if error is not None:
color = no_data_color if isinstance(error, SvNoDataError) else exception_color
self.set_temp_color(color)
sv_bgl.draw_text(self, str(error), error_pref + self.node_id, color, 1.3, "UP")
else:
sv_bgl.callback_disable(error_pref + self.node_id)
self.set_temp_color()
# show update timing
if update_time is not None:
update_time = int(update_time * 1000)
sv_bgl.draw_text(self, f'{update_time}ms', update_pref + self.node_id, align="UP", dynamic_location=False)
else:
sv_bgl.callback_disable(update_pref + self.node_id)
def insert_link(self, link):
"""It will be triggered only if one socket is connected with another by user.
There is no useful use for the trigger currently."""
def process_node(self, context):
"""Call this method to revaluate the node whenever its properties
were changed"""
self.id_data.update_nodes([self])
class NodeUtils:
"""
Helper methods.
Most of them have nothing related with nodes and using as aliases of some functionality.
The class can be surely ignored during creating of new nodes.
"""
@property
def sv_logger(self):
# todo inject node label into records?
return logging.getLogger('sverchok.nodes')
@property
def debug(self):
return self.sv_logger.debug
@property
def info(self):
return self.sv_logger.info
@property
def warning(self):
return self.sv_logger.warning
@property
def error(self):
return self.sv_logger.error
@property
def exception(self):
return self.sv_logger.exception
def wrapper_tracked_ui_draw_op(self, layout_element, operator_idname, **keywords):
"""
this wrapper allows you to track the origin of a clicked operator, by automatically passing
the node_name and tree_name to the operator.
example usage:
row.separator()
self.wrapper_tracked_ui_draw_op(row, "node.view3d_align_from", icon='CURSOR', text='')
"""
op = layout_element.operator(operator_idname, **keywords)
op.node_name = self.name
op.tree_name = self.id_data.name
return op
def get_bpy_data_from_name(self, identifier, bpy_data_kind): # todo, method which have nothing related with nodes
"""
fail gracefully?
This function acknowledges that the identifier being passed can be a string or an object proper.
for a long time Sverchok stored the result of a prop_search as a StringProperty, and many nodes will
be stored with that data in .blends, here we try to permit older blends having data stored as a string,
but newly used prop_search results will be stored as a pointerproperty of type bpy.types.Object
regarding the need to trim the first 3 chars of a stored StringProperty, best let Blender devs enlighten you
https://developer.blender.org/T58641
example usage inside a node:
text = self.get_bpy_data_from_name(self.filename, bpy.data.texts)
if the text does not exist you get None
"""
if not identifier:
# this can happen if a json import goes through attributes arbitrarily.
# self.info("no identifier passed to the get_bpy_data_from_name function.")
return None
try:
if isinstance(identifier, bpy.types.Object) and identifier.name in bpy_data_kind:
return bpy_data_kind.get(identifier.name) # todo it looks ridiculous to search known object
elif isinstance(identifier, str):
if identifier in bpy_data_kind:
return bpy_data_kind.get(identifier)
elif identifier[3:] in bpy_data_kind:
return bpy_data_kind.get(identifier[3:])
# something went wrong. the blend does not contain the objectname
self.info(f"{identifier} not found in {bpy_data_kind}, returning None instead")
if bpy_data_kind.bl_rna.identifier == 'BlendDataTexts':
# if we are in texts and this key is not found:
# - it's possible the named datablock incurred name collision
# - or it has not yet been created (usually json import, attribute order issue)
file_names = {t.name for t in bpy_data_kind}
self.info(f"The currently loaded blend file does contain the following text files {file_names}")
except Exception as err:
self.error(f"identifier '{identifier}' not found in {bpy_data_kind} - with error {err}")
return None
def safe_socket_remove(self, kind, key, failure_message=None):
sockets = getattr(self, kind)
if key in sockets:
sockets.remove(sockets[key])
else:
canned_msg = f"{self.name}.{kind} has no socket named {key} - did not remove"
self.debug(failure_message or canned_msg)
class NodeDependencies:
"""The mix-in keeps information about optional libraries which are used by
a node. Names of libraries should be assigned to `NodeDependencies.sv_dependencies`
only if a node can't work without them. In this case it won't be possible
to add the node into a node tree and its tooltip will show the names of
dependent libraries.

If opened tree already has dependent nodes the Dependency error will be
shown with names of dependent libraries.

If libraries are optional and a node has a mode which lets to execute the
node without them don't assign any libraries to `NodeDependencies.sv_dependencies`.
Check availability the libraries manually inside the `process` method and
call the `DependencyError` if appropriate.
"""
sv_dependencies: set[str] = set() #: dependent module names
_missing_dependency = None
_dependency_error = None
@classproperty
def missing_dependency(cls) -> bool:
"""Returns True if any of dependent libraries are not installed"""
if cls._missing_dependency is None:
for dep in cls.sv_dependencies:
if dep not in sys.modules:
cls._missing_dependency = True
break
else:
cls._missing_dependency = False
return cls._missing_dependency
@property
def dependency_error(self):
"""Returns DependencyError instance with the library names if some of
them are not installed or None"""
if self.missing_dependency:
if self._dependency_error is None:
msg = ", ".join(f'"{s}"' for s in self.sv_dependencies)
if len(self.sv_dependencies) == 1:
self._dependency_error = DependencyError(f'{msg} is not installed')
else:
self._dependency_error = DependencyError(f'{msg} are not installed')
return self._dependency_error
return
class NodeDocumentation:
"""
Documentation of a custom node class is used
to give information about the node UI.
```py
class SvSomeOperationNode(SverchCustomTreeNode, bpy.types.Node):
\"""
Triggers: vector multiply scale # <- tags
Tooltip: This node performs some operation
Merely for illustration of node creation workflow # Description
\"""
```
"""
_docstring = None # A cache for docstring property
@classproperty
def docstring(cls):
"""
Get SvDocstring instance parsed from node's docstring.
"""
if cls._docstring is None:
cls._docstring = SvDocstring(cls.__doc__)
return cls._docstring
def get_doc_link(self, link_type='ONLINE') -> Optional[str]:
"""Returns URL to online documentation of the node, or to GitHub
documentation, or path to a documentation file of the node, or None.
This method can be overridden by Sverchok's extensions to implement
their own way to generate the links."""
*_, node_file_name = self.__module__.rpartition('.')
node_docs = Path(sverchok.__file__).parent / 'docs' / 'nodes'
for path in node_docs.rglob('*.rst'):
doc_file_name = path.stem
if node_file_name != doc_file_name:
continue
help_url = str(path.relative_to(node_docs)).replace(' ', '_').removesuffix('.rst')
if link_type == 'ONLINE':
return f'http://nortikin.github.io/sverchok/docs/nodes/{help_url}.html'
elif link_type == 'OFFLINE':
return f'file:///{path}'
elif link_type == 'GITHUB':
return f'https://github.com/nortikin/sverchok/blob/master/docs/nodes/{help_url}.rst'
else:
raise TypeError(f"{link_type=} is not supported")
return None
class SverchCustomTreeNode(UpdateNodes, NodeUtils, NodeDependencies, NodeDocumentation):
"""Base class for all nodes.
It's possible to apply Alpha/Beta icons to sv_icon class attribute of the
node to mark a node as in development state and that it can change its
behaviour or even be removed. Usually new nodes should be marked in this way
until new release.
class Node:
sv_icon = 'SV_ALPHA' # or 'SV_BETA'

"""
sv_category = '' #: Add node to a category by its name to display with Shift+S
@final
def draw_buttons(self, context, layout):
"""This method is used to display extra UI element of a node which are
generated automatically. To display elements specific to certain nodes
use `SverchCustomTreeNode.sv_draw_buttons`."""
if self.id_data.bl_idname == SverchCustomTree.bl_idname:
row = None # should be initialized lazily to safe space
if self.is_animation_dependent:
row = row or layout.row(align=True)
row.prop(self, 'is_animatable', icon='ANIM', icon_only=True)
if self.is_scene_dependent:
row = row or layout.row(align=True)
row.prop(self, 'is_interactive', icon='SCENE_DATA', icon_only=True)
if self.is_animation_dependent or self.is_scene_dependent:
row = row or layout.row(align=True)
row.prop(self, 'refresh', icon='FILE_REFRESH')
self.sv_draw_buttons(context, layout)
def sv_draw_buttons(self, context, layout):
"""Override to display node properties, text, operators etc. Read more in
[Blender docs](https://docs.blender.org/api/3.3/bpy.types.UILayout.html)."""
pass
def draw_buttons_ext(self, context, layout):
"""This method is used to display extra UI element of a node which are
generated automatically. To display elements specific to certain nodes
use `SverchCustomTreeNode.sv_draw_buttons_ext`. This UI is displayed
on a property panel of the tree editor."""
if self.id_data.bl_idname == SverchCustomTree.bl_idname:
row = layout.row(align=True)
if self.is_animation_dependent:
row.prop(self, 'is_animatable', icon='ANIM')
if self.is_scene_dependent:
row.prop(self, 'is_interactive', icon='SCENE_DATA')
if self.is_animation_dependent or self.is_scene_dependent:
row.prop(self, 'refresh', icon='FILE_REFRESH')
self.sv_draw_buttons_ext(context, layout)
def sv_draw_buttons_ext(self, context, layout):
"""Override to display node properties, text, operators etc. Read more in
[Blender docs](https://docs.blender.org/api/3.3/bpy.types.UILayout.html).
This UI is displayed on a property panel of the tree editor."""
self.sv_draw_buttons(context, layout)
@property
def sv_internal_links(self) -> Iterable[tuple[NodeSocket, NodeSocket]]:
"""Override the property to change logic of connecting sockets
when the node is muted.
Also, there are some basic implementations `sverchok.utils.nodes_mixins.sockets_config`"""
for link in self.internal_links:
yield link.from_socket, link.to_socket
@classmethod
def poll(cls, ntree):
"""Can be overridden to make impossible to add certain nodes either to
main trees or to group trees. Also since Blender 3.4 presence of this
method is preventing Sverchok nodes from appearing in build-in tree
editors. See [details](https://developer.blender.org/T101259#1423746)."""
return ntree.bl_idname in ['SverchCustomTreeType', 'SvGroupTree']
@property
def absolute_location(self) -> tuple[float, float]:
"""
When a node is inside a frame (and parented to it) then node.location is relative to its parent's location.
This function returns the location in absolute screen terms whether the node is framed or not.
"""
return recursive_framed_location_finder(self, self.location[:])
@property
def sv_default_color(self):
"""Returns default color of the node which can be changed in add-on settings."""
return color_def.get_color(self.bl_idname)
def set_temp_color(self, color=None):
"""This method memorize its initial color and override it with given one
if given color is None it tries to return its initial color or do nothing"""
if color is None:
# looks like the node should return its initial color (user choice)
if 'user_color' in self:
self.use_custom_color = self['use_user_color']
del self['use_user_color']
self.color = self['user_color']
del self['user_color']
# set temporary color
else:
# save overridden color (only once)
if 'user_color' not in self:
self['use_user_color'] = self.use_custom_color
self['user_color'] = self.color
self.use_custom_color = True
self.color = color
def rclick_menu(self, context, layout):
"""
Override this method to add specific items into the node's right-click menu.
Default implementation calls `SverchCustomTreeNode.node_replacement_menu'.
"""
self.node_replacement_menu(context, layout)
def node_replacement_menu(self, context, layout):
"""
Draw menu items with node replacement operators.
This is called from `SverchCustomTreeNode.rclick_menu` method by default.
Items are defined by `replacement_nodes` class property.
Expected format is:
replacement_nodes = [
(new_node_bl_idname, inputs_mapping_dict, outputs_mapping_dict)
]
where:
- `new_node_bl_idname` is bl_idname of replacement node class,
- `inputs_mapping_dict` is a dictionary mapping names of inputs of
this node to names of inputs to new node,
- `outputs_mapping_dict` is a dictionary mapping names of outputs
of this node to names of outputs of new node.
`inputs_mapping_dict` and `outputs_mapping_dict` can be None.
"""
if hasattr(self, "replacement_nodes"):
for bl_idname, inputs_mapping, outputs_mapping in self.replacement_nodes:
node_class = bpy.types.Node.bl_rna_get_subclass_py(bl_idname)
if node_class:
text = "Replace with {}".format(node_class.bl_label)
op = layout.operator("node.sv_replace_node", text=text)
op.old_node_name = self.name
op.new_bl_idname = bl_idname
set_inputs_mapping(op, inputs_mapping)
set_outputs_mapping(op, outputs_mapping)
else:
self.error("Can't build replacement menu: no such node class: %s",bl_idname)
def migrate_links_from(self, old_node, operator):
"""
This method is called by `sverchok.ui.nodes_replacement.SvReplaceNode`.
By default, it removes existing links from old_node
and creates corresponding links for this (new) node.
Override it to implement custom re-linking at node
replacement.
Most nodes do not have to override this method.
"""
tree = self.id_data
# Copy incoming / outgoing links
old_in_links = [link for link in tree.links if link.to_node == old_node]
old_out_links = [link for link in tree.links if link.from_node == old_node]
for old_link in old_in_links:
new_target_socket_name = operator.get_new_input_name(old_link.to_socket.name)
if new_target_socket_name in self.inputs:
new_target_socket = self.inputs[new_target_socket_name]
new_link = tree.links.new(old_link.from_socket, new_target_socket)
else:
self.debug("New node %s has no input named %s, skipping", self.name, new_target_socket_name)
tree.links.remove(old_link)
for old_link in old_out_links:
new_source_socket_name = operator.get_new_output_name(old_link.from_socket.name)
# We have to remove old link before creating new one
# Blender would not allow two links pointing to the same target socket
old_target_socket = old_link.to_socket
tree.links.remove(old_link)
if new_source_socket_name in self.outputs:
new_source_socket = self.outputs[new_source_socket_name]
new_link = tree.links.new(new_source_socket, old_target_socket)
else:
self.debug("New node %s has no output named %s, skipping", self.name, new_source_socket_name)
def migrate_from(self, old_node):
"""
This method is called by `sverchok.ui.nodes_replacement.SvReplaceNode`.
Override it to correctly copy settings from old_node
to this (new) node.
This is called after `SverchCustomTreeNode.migrate_links_from`.
Default implementation does nothing.
"""
pass
@property
def prefs_over_sized_buttons(self) -> bool:
"""Returns information whether buttons should be shown in big variant

"""
try:
addon = bpy.context.preferences.addons.get(sverchok.__name__)
prefs = addon.preferences
except Exception as err:
print('failed to access addon preferences for button size', err)
return False
return prefs.over_sized_buttons
@post_load_call
def add_use_fake_user_to_trees():
"""When ever space node editor switches to another tree or creates new one,
this function will set True to `use_fake_user` of all Sverchok trees"""
def set_fake_user():
[setattr(t, 'use_fake_user', True) for t in bpy.data.node_groups if t.bl_idname == 'SverchCustomTreeType']
bpy.msgbus.subscribe_rna(key=(bpy.types.SpaceNodeEditor, 'node_tree'), owner=object(), args=(),
notify=set_fake_user)
register, unregister = bpy.utils.register_classes_factory([SverchCustomTree])
Functions
def add_use_fake_user_to_trees()
-
When ever space node editor switches to another tree or creates new one, this function will set True to
use_fake_user
of all Sverchok treesExpand source code
@post_load_call def add_use_fake_user_to_trees(): """When ever space node editor switches to another tree or creates new one, this function will set True to `use_fake_user` of all Sverchok trees""" def set_fake_user(): [setattr(t, 'use_fake_user', True) for t in bpy.data.node_groups if t.bl_idname == 'SverchCustomTreeType'] bpy.msgbus.subscribe_rna(key=(bpy.types.SpaceNodeEditor, 'node_tree'), owner=object(), args=(), notify=set_fake_user)
Classes
class NodeDependencies
-
The mix-in keeps information about optional libraries which are used by a node. Names of libraries should be assigned to
NodeDependencies.sv_dependencies
only if a node can't work without them. In this case it won't be possible to add the node into a node tree and its tooltip will show the names of dependent libraries.If opened tree already has dependent nodes the Dependency error will be shown with names of dependent libraries.
If libraries are optional and a node has a mode which lets to execute the node without them don't assign any libraries to
NodeDependencies.sv_dependencies
. Check availability the libraries manually inside theprocess
method and call theDependencyError
if appropriate.Expand source code
class NodeDependencies: """The mix-in keeps information about optional libraries which are used by a node. Names of libraries should be assigned to `NodeDependencies.sv_dependencies` only if a node can't work without them. In this case it won't be possible to add the node into a node tree and its tooltip will show the names of dependent libraries.  If opened tree already has dependent nodes the Dependency error will be shown with names of dependent libraries.  If libraries are optional and a node has a mode which lets to execute the node without them don't assign any libraries to `NodeDependencies.sv_dependencies`. Check availability the libraries manually inside the `process` method and call the `DependencyError` if appropriate. """ sv_dependencies: set[str] = set() #: dependent module names _missing_dependency = None _dependency_error = None @classproperty def missing_dependency(cls) -> bool: """Returns True if any of dependent libraries are not installed""" if cls._missing_dependency is None: for dep in cls.sv_dependencies: if dep not in sys.modules: cls._missing_dependency = True break else: cls._missing_dependency = False return cls._missing_dependency @property def dependency_error(self): """Returns DependencyError instance with the library names if some of them are not installed or None""" if self.missing_dependency: if self._dependency_error is None: msg = ", ".join(f'"{s}"' for s in self.sv_dependencies) if len(self.sv_dependencies) == 1: self._dependency_error = DependencyError(f'{msg} is not installed') else: self._dependency_error = DependencyError(f'{msg} are not installed') return self._dependency_error return
Subclasses
Class variables
var missing_dependency
var sv_dependencies : set
-
dependent module names
Instance variables
var dependency_error
-
Returns DependencyError instance with the library names if some of them are not installed or None
Expand source code
@property def dependency_error(self): """Returns DependencyError instance with the library names if some of them are not installed or None""" if self.missing_dependency: if self._dependency_error is None: msg = ", ".join(f'"{s}"' for s in self.sv_dependencies) if len(self.sv_dependencies) == 1: self._dependency_error = DependencyError(f'{msg} is not installed') else: self._dependency_error = DependencyError(f'{msg} are not installed') return self._dependency_error return
class NodeDocumentation
-
Documentation of a custom node class is used to give information about the node UI.
class SvSomeOperationNode(SverchCustomTreeNode, bpy.types.Node): """ Triggers: vector multiply scale # <- tags Tooltip: This node performs some operation Merely for illustration of node creation workflow # Description """
Expand source code
class NodeDocumentation: """ Documentation of a custom node class is used to give information about the node UI. ```py class SvSomeOperationNode(SverchCustomTreeNode, bpy.types.Node): \""" Triggers: vector multiply scale # <- tags Tooltip: This node performs some operation Merely for illustration of node creation workflow # Description \""" ``` """ _docstring = None # A cache for docstring property @classproperty def docstring(cls): """ Get SvDocstring instance parsed from node's docstring. """ if cls._docstring is None: cls._docstring = SvDocstring(cls.__doc__) return cls._docstring def get_doc_link(self, link_type='ONLINE') -> Optional[str]: """Returns URL to online documentation of the node, or to GitHub documentation, or path to a documentation file of the node, or None. This method can be overridden by Sverchok's extensions to implement their own way to generate the links.""" *_, node_file_name = self.__module__.rpartition('.') node_docs = Path(sverchok.__file__).parent / 'docs' / 'nodes' for path in node_docs.rglob('*.rst'): doc_file_name = path.stem if node_file_name != doc_file_name: continue help_url = str(path.relative_to(node_docs)).replace(' ', '_').removesuffix('.rst') if link_type == 'ONLINE': return f'http://nortikin.github.io/sverchok/docs/nodes/{help_url}.html' elif link_type == 'OFFLINE': return f'file:///{path}' elif link_type == 'GITHUB': return f'https://github.com/nortikin/sverchok/blob/master/docs/nodes/{help_url}.rst' else: raise TypeError(f"{link_type=} is not supported") return None
Subclasses
Class variables
var docstring
Methods
def get_doc_link(self, link_type='ONLINE') ‑> Optional[str]
-
Returns URL to online documentation of the node, or to GitHub documentation, or path to a documentation file of the node, or None. This method can be overridden by Sverchok's extensions to implement their own way to generate the links.
Expand source code
def get_doc_link(self, link_type='ONLINE') -> Optional[str]: """Returns URL to online documentation of the node, or to GitHub documentation, or path to a documentation file of the node, or None. This method can be overridden by Sverchok's extensions to implement their own way to generate the links.""" *_, node_file_name = self.__module__.rpartition('.') node_docs = Path(sverchok.__file__).parent / 'docs' / 'nodes' for path in node_docs.rglob('*.rst'): doc_file_name = path.stem if node_file_name != doc_file_name: continue help_url = str(path.relative_to(node_docs)).replace(' ', '_').removesuffix('.rst') if link_type == 'ONLINE': return f'http://nortikin.github.io/sverchok/docs/nodes/{help_url}.html' elif link_type == 'OFFLINE': return f'file:///{path}' elif link_type == 'GITHUB': return f'https://github.com/nortikin/sverchok/blob/master/docs/nodes/{help_url}.rst' else: raise TypeError(f"{link_type=} is not supported") return None
class NodeUtils
-
Helper methods. Most of them have nothing related with nodes and using as aliases of some functionality. The class can be surely ignored during creating of new nodes.
Expand source code
class NodeUtils: """ Helper methods. Most of them have nothing related with nodes and using as aliases of some functionality. The class can be surely ignored during creating of new nodes. """ @property def sv_logger(self): # todo inject node label into records? return logging.getLogger('sverchok.nodes') @property def debug(self): return self.sv_logger.debug @property def info(self): return self.sv_logger.info @property def warning(self): return self.sv_logger.warning @property def error(self): return self.sv_logger.error @property def exception(self): return self.sv_logger.exception def wrapper_tracked_ui_draw_op(self, layout_element, operator_idname, **keywords): """ this wrapper allows you to track the origin of a clicked operator, by automatically passing the node_name and tree_name to the operator. example usage: row.separator() self.wrapper_tracked_ui_draw_op(row, "node.view3d_align_from", icon='CURSOR', text='') """ op = layout_element.operator(operator_idname, **keywords) op.node_name = self.name op.tree_name = self.id_data.name return op def get_bpy_data_from_name(self, identifier, bpy_data_kind): # todo, method which have nothing related with nodes """ fail gracefully? This function acknowledges that the identifier being passed can be a string or an object proper. for a long time Sverchok stored the result of a prop_search as a StringProperty, and many nodes will be stored with that data in .blends, here we try to permit older blends having data stored as a string, but newly used prop_search results will be stored as a pointerproperty of type bpy.types.Object regarding the need to trim the first 3 chars of a stored StringProperty, best let Blender devs enlighten you https://developer.blender.org/T58641 example usage inside a node: text = self.get_bpy_data_from_name(self.filename, bpy.data.texts) if the text does not exist you get None """ if not identifier: # this can happen if a json import goes through attributes arbitrarily. # self.info("no identifier passed to the get_bpy_data_from_name function.") return None try: if isinstance(identifier, bpy.types.Object) and identifier.name in bpy_data_kind: return bpy_data_kind.get(identifier.name) # todo it looks ridiculous to search known object elif isinstance(identifier, str): if identifier in bpy_data_kind: return bpy_data_kind.get(identifier) elif identifier[3:] in bpy_data_kind: return bpy_data_kind.get(identifier[3:]) # something went wrong. the blend does not contain the objectname self.info(f"{identifier} not found in {bpy_data_kind}, returning None instead") if bpy_data_kind.bl_rna.identifier == 'BlendDataTexts': # if we are in texts and this key is not found: # - it's possible the named datablock incurred name collision # - or it has not yet been created (usually json import, attribute order issue) file_names = {t.name for t in bpy_data_kind} self.info(f"The currently loaded blend file does contain the following text files {file_names}") except Exception as err: self.error(f"identifier '{identifier}' not found in {bpy_data_kind} - with error {err}") return None def safe_socket_remove(self, kind, key, failure_message=None): sockets = getattr(self, kind) if key in sockets: sockets.remove(sockets[key]) else: canned_msg = f"{self.name}.{kind} has no socket named {key} - did not remove" self.debug(failure_message or canned_msg)
Subclasses
Instance variables
var debug
-
Expand source code
@property def debug(self): return self.sv_logger.debug
var error
-
Expand source code
@property def error(self): return self.sv_logger.error
var exception
-
Expand source code
@property def exception(self): return self.sv_logger.exception
var info
-
Expand source code
@property def info(self): return self.sv_logger.info
var sv_logger
-
Expand source code
@property def sv_logger(self): # todo inject node label into records? return logging.getLogger('sverchok.nodes')
var warning
-
Expand source code
@property def warning(self): return self.sv_logger.warning
Methods
def get_bpy_data_from_name(self, identifier, bpy_data_kind)
-
fail gracefully? This function acknowledges that the identifier being passed can be a string or an object proper. for a long time Sverchok stored the result of a prop_search as a StringProperty, and many nodes will be stored with that data in .blends, here we try to permit older blends having data stored as a string, but newly used prop_search results will be stored as a pointerproperty of type bpy.types.Object regarding the need to trim the first 3 chars of a stored StringProperty, best let Blender devs enlighten you https://developer.blender.org/T58641
example usage inside a node:
text = self.get_bpy_data_from_name(self.filename, bpy.data.texts)
if the text does not exist you get None
Expand source code
def get_bpy_data_from_name(self, identifier, bpy_data_kind): # todo, method which have nothing related with nodes """ fail gracefully? This function acknowledges that the identifier being passed can be a string or an object proper. for a long time Sverchok stored the result of a prop_search as a StringProperty, and many nodes will be stored with that data in .blends, here we try to permit older blends having data stored as a string, but newly used prop_search results will be stored as a pointerproperty of type bpy.types.Object regarding the need to trim the first 3 chars of a stored StringProperty, best let Blender devs enlighten you https://developer.blender.org/T58641 example usage inside a node: text = self.get_bpy_data_from_name(self.filename, bpy.data.texts) if the text does not exist you get None """ if not identifier: # this can happen if a json import goes through attributes arbitrarily. # self.info("no identifier passed to the get_bpy_data_from_name function.") return None try: if isinstance(identifier, bpy.types.Object) and identifier.name in bpy_data_kind: return bpy_data_kind.get(identifier.name) # todo it looks ridiculous to search known object elif isinstance(identifier, str): if identifier in bpy_data_kind: return bpy_data_kind.get(identifier) elif identifier[3:] in bpy_data_kind: return bpy_data_kind.get(identifier[3:]) # something went wrong. the blend does not contain the objectname self.info(f"{identifier} not found in {bpy_data_kind}, returning None instead") if bpy_data_kind.bl_rna.identifier == 'BlendDataTexts': # if we are in texts and this key is not found: # - it's possible the named datablock incurred name collision # - or it has not yet been created (usually json import, attribute order issue) file_names = {t.name for t in bpy_data_kind} self.info(f"The currently loaded blend file does contain the following text files {file_names}") except Exception as err: self.error(f"identifier '{identifier}' not found in {bpy_data_kind} - with error {err}") return None
def safe_socket_remove(self, kind, key, failure_message=None)
-
Expand source code
def safe_socket_remove(self, kind, key, failure_message=None): sockets = getattr(self, kind) if key in sockets: sockets.remove(sockets[key]) else: canned_msg = f"{self.name}.{kind} has no socket named {key} - did not remove" self.debug(failure_message or canned_msg)
def wrapper_tracked_ui_draw_op(self, layout_element, operator_idname, **keywords)
-
this wrapper allows you to track the origin of a clicked operator, by automatically passing the node_name and tree_name to the operator.
example usage:
row.separator() self.wrapper_tracked_ui_draw_op(row, "node.view3d_align_from", icon='CURSOR', text='')
Expand source code
def wrapper_tracked_ui_draw_op(self, layout_element, operator_idname, **keywords): """ this wrapper allows you to track the origin of a clicked operator, by automatically passing the node_name and tree_name to the operator. example usage: row.separator() self.wrapper_tracked_ui_draw_op(row, "node.view3d_align_from", icon='CURSOR', text='') """ op = layout_element.operator(operator_idname, **keywords) op.node_name = self.name op.tree_name = self.id_data.name return op
class SvNodeTreeCommon
-
Common class for all Sverchok trees (regular trees and group ones)
Expand source code
class SvNodeTreeCommon: """Common class for all Sverchok trees (regular trees and group ones)""" #: Identifier of the tree, should be used via `SvNodeTreeCommon.tree_id` property. tree_id_memory: StringProperty(default="", options={'SKIP_SAVE'}) sv_show_time_nodes: BoolProperty( name="Node times", default=False, options=set(), update=lambda s, c: handle_event(ev.TreeEvent(s))) show_time_mode: EnumProperty( items=[(n, n, '') for n in ["Per node", "Cumulative"]], options=set(), update=lambda s, c: handle_event(ev.TreeEvent(s)), description="Mode of showing node update timings", ) @property def tree_id(self): """Identifier of the tree. [Rational](#blender-data-blocks-ids).""" if not self.tree_id_memory: self.tree_id_memory = str(hash(self) ^ hash(time.monotonic())) return self.tree_id_memory def update_gl_scale_info(self, origin=None): """ the nodeview scale and dpi differs between users and must be queried to get correct nodeview x,y and dpi scale info. this is instead of calling `get_dpi_factor` on every redraw. """ sv_logger.debug(f"update_gl_scale_info called from {origin or self.name}") try: from sverchok.utils.context_managers import sv_preferences with sv_preferences() as prefs: prefs.set_nodeview_render_params(None) except Exception as err: sv_logger.debug('failed to get gl scale info', err) @contextmanager def init_tree(self): """It suppresses calling the `UpdateNodes.update` method of nodes, main usage of it is during generating tree with python (JSON import) with tree.init_tree(): do_something() """ is_already_initializing = 'init_tree' in self if is_already_initializing: yield self else: self['init_tree'] = '' try: yield self finally: del self['init_tree'] def update_ui(self, nodes_errors, update_time): """ The method get information about node statistic of last update from the handler to show in view space The method is usually called by main handler to reevaluate view of the nodes in the tree even if the tree is not in the Live update mode""" update_time = update_time if self.sv_show_time_nodes else cycle([None]) for node, error, update in zip(self.nodes, nodes_errors, update_time): if hasattr(node, 'update_ui'): node.update_ui(error, update)
Subclasses
Class variables
var show_time_mode : <_PropertyDeferred,
, {'items': [('Per node', 'Per node', ''), ('Cumulative', 'Cumulative', '')], 'options': set(), 'update': SvNodeTreeCommon. at 0x7f2f1d965a60>, 'description': 'Mode of showing node update timings', 'attr': 'show_time_mode'}> var sv_show_time_nodes : <_PropertyDeferred,
, {'name': 'Node times', 'default': False, 'options': set(), 'update': SvNodeTreeCommon. at 0x7f2f1d9659d0>, 'attr': 'sv_show_time_nodes'}> var tree_id_memory : <_PropertyDeferred,
, {'default': '', 'options': {'SKIP_SAVE'}, 'attr': 'tree_id_memory'}> -
Identifier of the tree, should be used via
SvNodeTreeCommon.tree_id
property.
Instance variables
var tree_id
-
Identifier of the tree. Rational.
Expand source code
@property def tree_id(self): """Identifier of the tree. [Rational](#blender-data-blocks-ids).""" if not self.tree_id_memory: self.tree_id_memory = str(hash(self) ^ hash(time.monotonic())) return self.tree_id_memory
Methods
def init_tree(self)
-
It suppresses calling the
UpdateNodes.update()
method of nodes, main usage of it is during generating tree with python (JSON import)with tree.init_tree(): do_something()
Expand source code
@contextmanager def init_tree(self): """It suppresses calling the `UpdateNodes.update` method of nodes, main usage of it is during generating tree with python (JSON import) with tree.init_tree(): do_something() """ is_already_initializing = 'init_tree' in self if is_already_initializing: yield self else: self['init_tree'] = '' try: yield self finally: del self['init_tree']
def update_gl_scale_info(self, origin=None)
-
the nodeview scale and dpi differs between users and must be queried to get correct nodeview x,y and dpi scale info.
this is instead of calling
get_dpi_factor
on every redraw.Expand source code
def update_gl_scale_info(self, origin=None): """ the nodeview scale and dpi differs between users and must be queried to get correct nodeview x,y and dpi scale info. this is instead of calling `get_dpi_factor` on every redraw. """ sv_logger.debug(f"update_gl_scale_info called from {origin or self.name}") try: from sverchok.utils.context_managers import sv_preferences with sv_preferences() as prefs: prefs.set_nodeview_render_params(None) except Exception as err: sv_logger.debug('failed to get gl scale info', err)
def update_ui(self, nodes_errors, update_time)
-
The method get information about node statistic of last update from the handler to show in view space The method is usually called by main handler to reevaluate view of the nodes in the tree even if the tree is not in the Live update mode
Expand source code
def update_ui(self, nodes_errors, update_time): """ The method get information about node statistic of last update from the handler to show in view space The method is usually called by main handler to reevaluate view of the nodes in the tree even if the tree is not in the Live update mode""" update_time = update_time if self.sv_show_time_nodes else cycle([None]) for node, error, update in zip(self.nodes, nodes_errors, update_time): if hasattr(node, 'update_ui'): node.update_ui(error, update)
class SverchCustomTree (...)
-
Sverchok - architectural node programming of geometry in low level
Expand source code
class SverchCustomTree(NodeTree, SvNodeTreeCommon): ''' Sverchok - architectural node programming of geometry in low level ''' bl_idname = 'SverchCustomTreeType' bl_label = 'Sverchok Nodes' bl_icon = 'RNA' def turn_off_ng(self, context): """ Turn on/off displaying objects in viewport generated by viewer nodes. Viewer nodes should have `show_viewport` method which takes 'to_show' bool argument """ for node in self.nodes: try: node.show_viewport(self.sv_show) except AttributeError: pass def on_draft_mode_changed(self, context): """ This is triggered when `SverchCustomTree.sv_draft` mode of the tree is toggled. It switches properties of some nodes from normal to draft and vice versa, and update the nodes. """ draft_nodes = [] for node in self.nodes: if hasattr(node, 'does_support_draft_mode') and node.does_support_draft_mode(): draft_nodes.append(node) node.on_draft_mode_changed(self.sv_draft) # From the user perspective, some of node parameters # got new parameter values, so the setup should be recalculated; # but technically, node properties were not changed # (only other properties were shown in UI), so enabling/disabling # of draft mode does not automatically trigger tree update. # Here we trigger it manually. if draft_nodes: self.update_nodes(draft_nodes) sv_process: BoolProperty( name="Process", default=True, description='Update upon tree and node property changes', update=lambda s, c: handle_event(ev.TreeEvent(s)), options=set(), ) """If enabled it means that the tree will be evaluated upon changes in its topology, changes in node properties or scene changes made by user. This property does not effect evaluation upon `SverchCustomTree.sv_animate` changes or by re-update all nodes operator. Enabling the property will call the tree topology changes trigger.""" sv_animate: BoolProperty( name="Animate", default=True, description='Animate this layout', options=set()) """If enabled the tree will be reevaluated upon frame change. The update can effect not all nodes but only those which have property `UpdateNodes.is_animatable` enabled.""" sv_show: BoolProperty( name="Show", default=True, description='Show this layout', update=turn_off_ng, options=set()) """See `SverchCustomTree.turn_off_ng""" sv_show_socket_menus: BoolProperty( name = "Show socket menus", description = "Display socket dropdown menu buttons. NOTE: options that are enabled in those menus will be effective regardless of this checkbox!", default = True, options=set()) """Display socket dropdown menu buttons (only for output). Read more in [user documentation](http://nortikin.github.io/sverchok/docs/user_interface/input_menus.html). """ #: Draft mode replaces selected properties of certain nodes with smaller values to lighten cpu load. sv_draft: BoolProperty( name="Draft", description="Draft (simplified processing) mode", default=False, update=on_draft_mode_changed, options=set(), ) sv_scene_update: BoolProperty( name="Scene update", description="Update upon changes in the scene", options=set(), default=True) """If enabled together with `SverchCustomTree.sv_process` the tree will be reevaluated upon changes in the scene. It will effect only nodes with `UpdateNodes.is_interactive` property enabled. The scene changes can be: - moving objects - changing edit / object mode - mesh editing - assign materials - etc. """ def update(self): """This method is called if collection of nodes or links of the tree was changed""" handle_event(ev.TreeEvent(self)) def force_update(self): """Update whole tree from scratch""" # ideally we would never like to use this method but we live in the real world handle_event(ev.ForceEvent(self)) def update_nodes(self, nodes): """This method expects to get list of its nodes which should be updated""" return handle_event(ev.PropertyEvent(self, nodes)) def scene_update(self): """This method should be called by scene changes handler. It ignores scene events generated by sverchok trees (they modify Bledner data what cause execution of a scene handler). It updates nodes with `UpdateNodes.is_interactive` enabled.""" handle_event(ev.SceneEvent(self)) def process_ani(self, frame_changed: bool, animation_playing: bool): """ Process the Sverchok node tree if animation layers show true. For `sverchok.core.handlers.sv_update_handler`. """ handle_event(ev.AnimationEvent(self, frame_changed, animation_playing))
Ancestors
- bpy_types.NodeTree
- bpy.types.ID
- builtins.bpy_struct
- SvNodeTreeCommon
Class variables
var bl_icon
var bl_idname
var bl_label
var bl_rna
var sv_animate : <_PropertyDeferred,
, {'name': 'Animate', 'default': True, 'description': 'Animate this layout', 'options': set(), 'attr': 'sv_animate'}> -
If enabled the tree will be reevaluated upon frame change. The update can effect not all nodes but only those which have property
UpdateNodes.is_animatable
enabled. var sv_draft : <_PropertyDeferred,
, {'name': 'Draft', 'description': 'Draft (simplified processing) mode', 'default': False, 'update': SverchCustomTree.on_draft_mode_changed() at 0x7f2f1d965e50>, 'options': set(), 'attr': 'sv_draft'}> -
Draft mode replaces selected properties of certain nodes with smaller values to lighten cpu load.
var sv_process : <_PropertyDeferred,
, {'name': 'Process', 'default': True, 'description': 'Update upon tree and node property changes', 'update': SverchCustomTree. at 0x7f2f1d965ee0>, 'options': set(), 'attr': 'sv_process'}> -
If enabled it means that the tree will be evaluated upon changes in its topology, changes in node properties or scene changes made by user. This property does not effect evaluation upon
SverchCustomTree.sv_animate
changes or by re-update all nodes operator. Enabling the property will call the tree topology changes trigger. var sv_scene_update : <_PropertyDeferred,
, {'name': 'Scene update', 'description': 'Update upon changes in the scene', 'options': set(), 'default': True, 'attr': 'sv_scene_update'}> -
If enabled together with
SverchCustomTree.sv_process
the tree will be reevaluated upon changes in the scene. It will effect only nodes withUpdateNodes.is_interactive
property enabled. The scene changes can be:- moving objects
- changing edit / object mode
- mesh editing
- assign materials
- etc.
var sv_show : <_PropertyDeferred,
, {'name': 'Show', 'default': True, 'description': 'Show this layout', 'update': SverchCustomTree.turn_off_ng() at 0x7f2f1d965dc0>, 'options': set(), 'attr': 'sv_show'}> -
See `SverchCustomTree.turn_off_ng
-
Display socket dropdown menu buttons (only for output). Read more in user documentation.
Methods
def force_update(self)
-
Update whole tree from scratch
Expand source code
def force_update(self): """Update whole tree from scratch""" # ideally we would never like to use this method but we live in the real world handle_event(ev.ForceEvent(self))
def on_draft_mode_changed(self, context)
-
This is triggered when
SverchCustomTree.sv_draft
mode of the tree is toggled. It switches properties of some nodes from normal to draft and vice versa, and update the nodes.Expand source code
def on_draft_mode_changed(self, context): """ This is triggered when `SverchCustomTree.sv_draft` mode of the tree is toggled. It switches properties of some nodes from normal to draft and vice versa, and update the nodes. """ draft_nodes = [] for node in self.nodes: if hasattr(node, 'does_support_draft_mode') and node.does_support_draft_mode(): draft_nodes.append(node) node.on_draft_mode_changed(self.sv_draft) # From the user perspective, some of node parameters # got new parameter values, so the setup should be recalculated; # but technically, node properties were not changed # (only other properties were shown in UI), so enabling/disabling # of draft mode does not automatically trigger tree update. # Here we trigger it manually. if draft_nodes: self.update_nodes(draft_nodes)
def process_ani(self, frame_changed: bool, animation_playing: bool)
-
Process the Sverchok node tree if animation layers show true. For
sv_update_handler()
.Expand source code
def process_ani(self, frame_changed: bool, animation_playing: bool): """ Process the Sverchok node tree if animation layers show true. For `sverchok.core.handlers.sv_update_handler`. """ handle_event(ev.AnimationEvent(self, frame_changed, animation_playing))
def scene_update(self)
-
This method should be called by scene changes handler. It ignores scene events generated by sverchok trees (they modify Bledner data what cause execution of a scene handler). It updates nodes with
UpdateNodes.is_interactive
enabled.Expand source code
def scene_update(self): """This method should be called by scene changes handler. It ignores scene events generated by sverchok trees (they modify Bledner data what cause execution of a scene handler). It updates nodes with `UpdateNodes.is_interactive` enabled.""" handle_event(ev.SceneEvent(self))
def turn_off_ng(self, context)
-
Turn on/off displaying objects in viewport generated by viewer nodes. Viewer nodes should have
show_viewport
method which takes 'to_show' bool argumentExpand source code
def turn_off_ng(self, context): """ Turn on/off displaying objects in viewport generated by viewer nodes. Viewer nodes should have `show_viewport` method which takes 'to_show' bool argument """ for node in self.nodes: try: node.show_viewport(self.sv_show) except AttributeError: pass
def update(self)
-
This method is called if collection of nodes or links of the tree was changed
Expand source code
def update(self): """This method is called if collection of nodes or links of the tree was changed""" handle_event(ev.TreeEvent(self))
def update_nodes(self, nodes)
-
This method expects to get list of its nodes which should be updated
Expand source code
def update_nodes(self, nodes): """This method expects to get list of its nodes which should be updated""" return handle_event(ev.PropertyEvent(self, nodes))
Inherited members
class SverchCustomTreeNode
-
Base class for all nodes.
It's possible to apply Alpha/Beta icons to sv_icon class attribute of the node to mark a node as in development state and that it can change its behaviour or even be removed. Usually new nodes should be marked in this way until new release.
class Node: sv_icon = 'SV_ALPHA' # or 'SV_BETA'
Expand source code
class SverchCustomTreeNode(UpdateNodes, NodeUtils, NodeDependencies, NodeDocumentation): """Base class for all nodes. It's possible to apply Alpha/Beta icons to sv_icon class attribute of the node to mark a node as in development state and that it can change its behaviour or even be removed. Usually new nodes should be marked in this way until new release. class Node: sv_icon = 'SV_ALPHA' # or 'SV_BETA'  """ sv_category = '' #: Add node to a category by its name to display with Shift+S @final def draw_buttons(self, context, layout): """This method is used to display extra UI element of a node which are generated automatically. To display elements specific to certain nodes use `SverchCustomTreeNode.sv_draw_buttons`.""" if self.id_data.bl_idname == SverchCustomTree.bl_idname: row = None # should be initialized lazily to safe space if self.is_animation_dependent: row = row or layout.row(align=True) row.prop(self, 'is_animatable', icon='ANIM', icon_only=True) if self.is_scene_dependent: row = row or layout.row(align=True) row.prop(self, 'is_interactive', icon='SCENE_DATA', icon_only=True) if self.is_animation_dependent or self.is_scene_dependent: row = row or layout.row(align=True) row.prop(self, 'refresh', icon='FILE_REFRESH') self.sv_draw_buttons(context, layout) def sv_draw_buttons(self, context, layout): """Override to display node properties, text, operators etc. Read more in [Blender docs](https://docs.blender.org/api/3.3/bpy.types.UILayout.html).""" pass def draw_buttons_ext(self, context, layout): """This method is used to display extra UI element of a node which are generated automatically. To display elements specific to certain nodes use `SverchCustomTreeNode.sv_draw_buttons_ext`. This UI is displayed on a property panel of the tree editor.""" if self.id_data.bl_idname == SverchCustomTree.bl_idname: row = layout.row(align=True) if self.is_animation_dependent: row.prop(self, 'is_animatable', icon='ANIM') if self.is_scene_dependent: row.prop(self, 'is_interactive', icon='SCENE_DATA') if self.is_animation_dependent or self.is_scene_dependent: row.prop(self, 'refresh', icon='FILE_REFRESH') self.sv_draw_buttons_ext(context, layout) def sv_draw_buttons_ext(self, context, layout): """Override to display node properties, text, operators etc. Read more in [Blender docs](https://docs.blender.org/api/3.3/bpy.types.UILayout.html). This UI is displayed on a property panel of the tree editor.""" self.sv_draw_buttons(context, layout) @property def sv_internal_links(self) -> Iterable[tuple[NodeSocket, NodeSocket]]: """Override the property to change logic of connecting sockets when the node is muted. Also, there are some basic implementations `sverchok.utils.nodes_mixins.sockets_config`""" for link in self.internal_links: yield link.from_socket, link.to_socket @classmethod def poll(cls, ntree): """Can be overridden to make impossible to add certain nodes either to main trees or to group trees. Also since Blender 3.4 presence of this method is preventing Sverchok nodes from appearing in build-in tree editors. See [details](https://developer.blender.org/T101259#1423746).""" return ntree.bl_idname in ['SverchCustomTreeType', 'SvGroupTree'] @property def absolute_location(self) -> tuple[float, float]: """ When a node is inside a frame (and parented to it) then node.location is relative to its parent's location. This function returns the location in absolute screen terms whether the node is framed or not. """ return recursive_framed_location_finder(self, self.location[:]) @property def sv_default_color(self): """Returns default color of the node which can be changed in add-on settings.""" return color_def.get_color(self.bl_idname) def set_temp_color(self, color=None): """This method memorize its initial color and override it with given one if given color is None it tries to return its initial color or do nothing""" if color is None: # looks like the node should return its initial color (user choice) if 'user_color' in self: self.use_custom_color = self['use_user_color'] del self['use_user_color'] self.color = self['user_color'] del self['user_color'] # set temporary color else: # save overridden color (only once) if 'user_color' not in self: self['use_user_color'] = self.use_custom_color self['user_color'] = self.color self.use_custom_color = True self.color = color def rclick_menu(self, context, layout): """ Override this method to add specific items into the node's right-click menu. Default implementation calls `SverchCustomTreeNode.node_replacement_menu'. """ self.node_replacement_menu(context, layout) def node_replacement_menu(self, context, layout): """ Draw menu items with node replacement operators. This is called from `SverchCustomTreeNode.rclick_menu` method by default. Items are defined by `replacement_nodes` class property. Expected format is: replacement_nodes = [ (new_node_bl_idname, inputs_mapping_dict, outputs_mapping_dict) ] where: - `new_node_bl_idname` is bl_idname of replacement node class, - `inputs_mapping_dict` is a dictionary mapping names of inputs of this node to names of inputs to new node, - `outputs_mapping_dict` is a dictionary mapping names of outputs of this node to names of outputs of new node. `inputs_mapping_dict` and `outputs_mapping_dict` can be None. """ if hasattr(self, "replacement_nodes"): for bl_idname, inputs_mapping, outputs_mapping in self.replacement_nodes: node_class = bpy.types.Node.bl_rna_get_subclass_py(bl_idname) if node_class: text = "Replace with {}".format(node_class.bl_label) op = layout.operator("node.sv_replace_node", text=text) op.old_node_name = self.name op.new_bl_idname = bl_idname set_inputs_mapping(op, inputs_mapping) set_outputs_mapping(op, outputs_mapping) else: self.error("Can't build replacement menu: no such node class: %s",bl_idname) def migrate_links_from(self, old_node, operator): """ This method is called by `sverchok.ui.nodes_replacement.SvReplaceNode`. By default, it removes existing links from old_node and creates corresponding links for this (new) node. Override it to implement custom re-linking at node replacement. Most nodes do not have to override this method. """ tree = self.id_data # Copy incoming / outgoing links old_in_links = [link for link in tree.links if link.to_node == old_node] old_out_links = [link for link in tree.links if link.from_node == old_node] for old_link in old_in_links: new_target_socket_name = operator.get_new_input_name(old_link.to_socket.name) if new_target_socket_name in self.inputs: new_target_socket = self.inputs[new_target_socket_name] new_link = tree.links.new(old_link.from_socket, new_target_socket) else: self.debug("New node %s has no input named %s, skipping", self.name, new_target_socket_name) tree.links.remove(old_link) for old_link in old_out_links: new_source_socket_name = operator.get_new_output_name(old_link.from_socket.name) # We have to remove old link before creating new one # Blender would not allow two links pointing to the same target socket old_target_socket = old_link.to_socket tree.links.remove(old_link) if new_source_socket_name in self.outputs: new_source_socket = self.outputs[new_source_socket_name] new_link = tree.links.new(new_source_socket, old_target_socket) else: self.debug("New node %s has no output named %s, skipping", self.name, new_source_socket_name) def migrate_from(self, old_node): """ This method is called by `sverchok.ui.nodes_replacement.SvReplaceNode`. Override it to correctly copy settings from old_node to this (new) node. This is called after `SverchCustomTreeNode.migrate_links_from`. Default implementation does nothing. """ pass @property def prefs_over_sized_buttons(self) -> bool: """Returns information whether buttons should be shown in big variant  """ try: addon = bpy.context.preferences.addons.get(sverchok.__name__) prefs = addon.preferences except Exception as err: print('failed to access addon preferences for button size', err) return False return prefs.over_sized_buttons
Ancestors
Subclasses
- SvGroupTreeNode
- sverchok.nodes.CAD.crop_mesh_2d.SvCropMesh2D
- sverchok.nodes.CAD.edges_intersect_mk3.SvIntersectEdgesNodeMK3
- sverchok.nodes.CAD.edges_to_faces_2d.SvEdgesToFaces2D
- sverchok.nodes.CAD.embed mesh.SvEmbedMesh
- sverchok.nodes.CAD.inset_special_mk2.SvInsetSpecialMk2
- sverchok.nodes.CAD.merge_mesh_2d.SvMergeMesh2D
- sverchok.nodes.CAD.merge_mesh_2d_lite.SvMergeMesh2DLite
- sverchok.nodes.analyzer.area.SvAreaNode
- sverchok.nodes.analyzer.bbox_mk3.SvBBoxNodeMk3
- sverchok.nodes.analyzer.bvh_overlap_polys.SvBvhOverlapNodeNew
- sverchok.nodes.analyzer.chess_selection.SvChessSelection
- sverchok.nodes.analyzer.circle_approx.SvCircleApproxNode
- sverchok.nodes.analyzer.component_analyzer.SvComponentAnalyzerNode
- sverchok.nodes.analyzer.deformation.SvDeformationNode
- sverchok.nodes.analyzer.diameter.SvDiameterNode
- sverchok.nodes.analyzer.distance_line_line.SvDistancetLineLineNode
- sverchok.nodes.analyzer.distance_point_line.SvDistancePointLineNode
- sverchok.nodes.analyzer.distance_point_plane.SvDistancePointPlaneNode
- sverchok.nodes.analyzer.distance_pp.DistancePPNode
- sverchok.nodes.analyzer.edge_angles.SvEdgeAnglesNode
- sverchok.nodes.analyzer.image_components.SvImageComponentsNode
- sverchok.nodes.analyzer.inscribed_circle.SvInscribedCircleNode
- sverchok.nodes.analyzer.intersect_circle_circle.SvIntersectCircleCircleNode
- sverchok.nodes.analyzer.intersect_line_sphere.SvIntersectLineSphereNode
- sverchok.nodes.analyzer.intersect_plane_plane.SvIntersectPlanePlaneNode
- sverchok.nodes.analyzer.kd_tree_MK2.SvKDTreeNodeMK2
- sverchok.nodes.analyzer.kd_tree_edges.SvKDTreeEdgesNodeMK3
- sverchok.nodes.analyzer.kd_tree_path.SvKDTreePathNode
- sverchok.nodes.analyzer.linear_approx.SvLinearApproxNode
- sverchok.nodes.analyzer.linked_verts.SvLinkedVertsNode
- sverchok.nodes.analyzer.mesh_filter.SvMeshFilterNode
- sverchok.nodes.analyzer.mesh_select_mk2.SvMeshSelectNodeMk2
- sverchok.nodes.analyzer.nearest_point_on_mesh.SvNearestPointOnMeshNode
- sverchok.nodes.analyzer.normals_mk2.SvGetNormalsNodeMk2
- sverchok.nodes.analyzer.object_insolation.SvOBJInsolationNode
- sverchok.nodes.analyzer.origins.SvOrigins
- sverchok.nodes.analyzer.path_length_2.SvPathLengthMk2Node
- sverchok.nodes.analyzer.points_inside_mesh.SvPointInside
- sverchok.nodes.analyzer.project_point_to_line.SvProjectPointToLine
- sverchok.nodes.analyzer.proportional.SvProportionalEditNode
- sverchok.nodes.analyzer.raycaster_lite.SvRaycasterLiteNode
- sverchok.nodes.analyzer.select_similar.SvSelectSimilarNode
- sverchok.nodes.analyzer.sphere_approx.SvSphereApproxNode
- sverchok.nodes.analyzer.steiner_ellipse.SvSteinerEllipseNode
- sverchok.nodes.analyzer.volume.SvVolumeNodeMK2
- sverchok.nodes.analyzer.wave_paint.SvWavePainterNode
- sverchok.nodes.color.color_in_mk1.SvColorsInNodeMK1
- sverchok.nodes.color.color_input.SvColorInputNode
- sverchok.nodes.color.color_mix.SvColorMixNode
- sverchok.nodes.color.color_out_mk1.SvColorsOutNodeMK1
- sverchok.nodes.color.color_ramp.SvColorRampNode
- sverchok.nodes.color.formula_color.SvFormulaColorNode
- sverchok.nodes.color.texture_evaluate_mk2.SvTextureEvaluateNodeMk2
- sverchok.nodes.curve.adaptive_plot.SvAdaptivePlotCurveNode
- sverchok.nodes.curve.adaptive_plot_nurbs.SvAdaptivePlotNurbsCurveNode
- sverchok.nodes.curve.apply_field_to_curve.SvApplyFieldToCurveNode
- sverchok.nodes.curve.approximate_nurbs_curve.SvApproxNurbsCurveMk3Node
- sverchok.nodes.curve.arc_3pt.SvArc3ptCurveNode
- sverchok.nodes.curve.arc_sed.SvArcSedCurveNode
- sverchok.nodes.curve.bezier_fit.SvExBezierCurveFitNode
- sverchok.nodes.curve.bezier_spline.SvBezierSplineNode
- sverchok.nodes.curve.biarc.SvBiArcNode
- sverchok.nodes.curve.blend_curves.SvBlendCurvesMk2Node
- sverchok.nodes.curve.cast_curve.SvCastCurveNode
- sverchok.nodes.curve.catenary_curve.SvExCatenaryCurveNode
- sverchok.nodes.curve.catmull_rom.SvCatmullRomSplineNode
- sverchok.nodes.curve.circlify.SvExCirclifyNode
- sverchok.nodes.curve.concat_curves.SvConcatCurvesNode
- sverchok.nodes.curve.cubic_spline.SvCubicSplineNode
- sverchok.nodes.curve.curvature.SvCurveCurvatureNode
- sverchok.nodes.curve.curve_circle.SvCircleCurveMk2Node
- sverchok.nodes.curve.curve_formula.SvCurveFormulaNode
- sverchok.nodes.curve.curve_frame.SvCurveFrameNode
- sverchok.nodes.curve.curve_frame_on_surface.SvCurveFrameOnSurfNode
- sverchok.nodes.curve.curve_length.SvCurveLengthNode
- sverchok.nodes.curve.curve_lerp.SvCurveLerpCurveNode
- sverchok.nodes.curve.curve_on_surface.SvCurveOnSurfaceNode
- sverchok.nodes.curve.curve_range.SvCurveRangeNode
- sverchok.nodes.curve.curve_segment.SvCurveSegmentNode
- sverchok.nodes.curve.deconstruct_curve.SvDeconstructCurveNode
- sverchok.nodes.curve.elevate_degree.SvCurveElevateDegreeNode
- sverchok.nodes.curve.ellipse.SvEllipseCurveNode
- sverchok.nodes.curve.endpoints.SvCurveEndpointsNode
- sverchok.nodes.curve.eval_curve.SvEvalCurveNode
- sverchok.nodes.curve.extend_curve.SvExtendCurveNode
- sverchok.nodes.curve.extremes.SvExCurveExtremesNode
- sverchok.nodes.curve.fillet_curve.SvFilletCurveNode
- sverchok.nodes.curve.fillet_polyline.SvFilletPolylineNode
- sverchok.nodes.curve.flip_curve.SvFlipCurveNode
- sverchok.nodes.curve.freecad_helix.SvFreeCadHelixNode
- sverchok.nodes.curve.generate_knotvector.SvGenerateKnotvectorNode
- sverchok.nodes.curve.insert_knot.SvCurveInsertKnotNode
- sverchok.nodes.curve.interpolate_frame.SvExSlerpCurveFrameNode
- sverchok.nodes.curve.interpolate_nurbs_curve.SvExInterpolateNurbsCurveNodeMK2
- sverchok.nodes.curve.intersect_curve_plane.SvExCrossCurvePlaneNode
- sverchok.nodes.curve.intersect_curves.SvIntersectNurbsCurvesNode
- sverchok.nodes.curve.iso_uv_curve.SvIsoUvCurveNode
- sverchok.nodes.curve.kinky_curve.SvKinkyCurveNode
- sverchok.nodes.curve.length_parameter.SvCurveLengthParameterMk2Node
- sverchok.nodes.curve.length_rebuild.SvLengthRebuildCurveNode
- sverchok.nodes.curve.line.SvLineCurveNode
- sverchok.nodes.curve.marching_squares.SvExMarchingSquaresNode
- sverchok.nodes.curve.marching_squares_on_surface.SvExMSquaresOnSurfaceNode
- sverchok.nodes.curve.move_nurbs_curve_point.SvNurbsCurveMovePointNode
- sverchok.nodes.curve.nearest_point.SvExNearestPointOnCurveNode
- sverchok.nodes.curve.nurbs_curve.SvExNurbsCurveNode
- sverchok.nodes.curve.nurbs_curve_nodes.SvNurbsCurveNodesNode
- sverchok.nodes.curve.offset_mk2.SvOffsetCurveMk2Node
- sverchok.nodes.curve.offset_on_surface.SvCurveOffsetOnSurfaceNode
- sverchok.nodes.curve.ortho_project.SvExOrthoProjectCurveNode
- sverchok.nodes.curve.point_curve.SvPointCurveNode
- sverchok.nodes.curve.polyarc.SvPolyArcNode
- sverchok.nodes.curve.polyline.SvPolylineNode
- sverchok.nodes.curve.project_curve_surface.SvProjectCurveSurfaceNode
- sverchok.nodes.curve.rbf_curve.SvExRbfCurveNode
- sverchok.nodes.curve.reduce_degree.SvCurveReduceDegreeNode
- sverchok.nodes.curve.refine_nurbs_curve.SvRefineNurbsCurveNode
- sverchok.nodes.curve.remove_excessive_knots.SvCurveRemoveExcessiveKnotsNode
- sverchok.nodes.curve.remove_knot.SvCurveRemoveKnotNode
- sverchok.nodes.curve.reparametrize.SvReparametrizeCurveNode
- sverchok.nodes.curve.rounded_rectangle.SvRoundedRectangleNode
- sverchok.nodes.curve.sort_curves.SvSortCurvesNode
- sverchok.nodes.curve.split_curve.SvSplitCurveNode
- sverchok.nodes.curve.surface_boundary.SvSurfaceBoundaryNode
- sverchok.nodes.curve.tangent_curve.SvTangentsCurveNode
- sverchok.nodes.curve.torsion.SvCurveTorsionNode
- sverchok.nodes.curve.zero_twist_frame.SvCurveZeroTwistFrameNode
- sverchok.nodes.dictionary.dictionary_in.SvDictionaryIn
- sverchok.nodes.dictionary.dictionary_out.SvDictionaryOut
- sverchok.nodes.exchange.FCStd_read.SvReadFCStdNode
- sverchok.nodes.exchange.FCStd_read_mod.SvReadFCStdModNode
- sverchok.nodes.exchange.FCStd_sketch.SvReadFCStdSketchNode
- sverchok.nodes.exchange.FCStd_spreadsheet.SvFCStdSpreadsheetNode
- sverchok.nodes.exchange.FCStd_write.SvWriteFCStdNode
- sverchok.nodes.exchange.approx_subd_to_nurbs.SvApproxSubdtoNurbsNode
- sverchok.nodes.exchange.bezier_in.SvBezierInNode
- sverchok.nodes.exchange.export_rw3dm_json.SvExNurbsToJsonNode
- sverchok.nodes.exchange.gcode_exporter.SvExportGcodeNode
- sverchok.nodes.exchange.import_rw3dm_json.SvExJsonToNurbsNode
- sverchok.nodes.exchange.nurbs_in.SvExNurbsInNode
- sverchok.nodes.exchange.receive_from_sorcar.SvReceiveFromSorcarNode
- sverchok.nodes.field.attractor_field_mk2.SvAttractorFieldNodeMk2
- sverchok.nodes.field.compose_vector_field.SvComposeVectorFieldNode
- sverchok.nodes.field.coordinate_scalar_field.SvCoordScalarFieldNode
- sverchok.nodes.field.curve_bend_field.SvBendAlongCurveFieldNode
- sverchok.nodes.field.decompose_vector_field.SvDecomposeVectorFieldNode
- sverchok.nodes.field.differential_operations.SvFieldDiffOpsNode
- sverchok.nodes.field.field_bend_along_surface.SvBendAlongSurfaceFieldNode
- sverchok.nodes.field.image_field.SvImageFieldNode
- sverchok.nodes.field.merge_scalar_fields.SvMergeScalarFieldsNode
- sverchok.nodes.field.mesh_normal_field.SvExMeshNormalFieldNode
- sverchok.nodes.field.mesh_surface_field.SvMeshSurfaceFieldNode
- sverchok.nodes.field.minimal_sfield.SvExMinimalScalarFieldNode
- sverchok.nodes.field.minimal_vfield.SvExMinimalVectorFieldNode
- sverchok.nodes.field.noise_vfield.SvNoiseVectorFieldNode
- sverchok.nodes.field.rotation_field.SvRotationFieldNode
- sverchok.nodes.field.scalar_field_curvature.SvScalarFieldCurvatureNode
- sverchok.nodes.field.scalar_field_curve_map.SvScalarFieldCurveMapNode
- sverchok.nodes.field.scalar_field_eval.SvScalarFieldEvaluateNode
- sverchok.nodes.field.scalar_field_formula.SvScalarFieldFormulaNode
- sverchok.nodes.field.scalar_field_graph.SvExScalarFieldGraphNode
- sverchok.nodes.field.scalar_field_math.SvScalarFieldMathNode
- sverchok.nodes.field.scalar_field_point.SvScalarFieldPointNode
- sverchok.nodes.field.vector_field_apply.SvVectorFieldApplyNode
- sverchok.nodes.field.vector_field_eval.SvVectorFieldEvaluateNode
- sverchok.nodes.field.vector_field_formula.SvVectorFieldFormulaNode
- sverchok.nodes.field.vector_field_graph.SvVectorFieldGraphNode
- sverchok.nodes.field.vector_field_lines.SvVectorFieldLinesNode
- sverchok.nodes.field.vector_field_math.SvVectorFieldMathNode
- sverchok.nodes.field.voronoi_field.SvVoronoiFieldNode
- sverchok.nodes.generator.basic_3pt_arc.svBasicArcNode
- sverchok.nodes.generator.basic_spline.BasicSplineNode
- sverchok.nodes.generator.box_mk2.SvBoxNodeMk2
- sverchok.nodes.generator.bricks.SvBricksNode
- sverchok.nodes.generator.circle.SvCircleNode
- sverchok.nodes.generator.cricket.SvCricketNode
- sverchok.nodes.generator.cylinder_mk2.SvCylinderNodeMK2
- sverchok.nodes.generator.formula_shape.SvFormulaShapeNode
- sverchok.nodes.generator.icosphere.SvIcosphereNode
- sverchok.nodes.generator.image.ImageNode
- sverchok.nodes.generator.line_mk4.SvLineNodeMK4
- sverchok.nodes.generator.ngon.SvNGonNode
- sverchok.nodes.generator.plane_mk3.SvPlaneNodeMk3
- sverchok.nodes.generator.quad_spline.SvQuadraticSplineNode
- sverchok.nodes.generator.random_vector_mk3.RandomVectorNodeMK3
- sverchok.nodes.generator.segment.SvSegmentGenerator
- sverchok.nodes.generator.sphere.SphereNode
- sverchok.nodes.generator.suzanne.SvSuzanneNode
- sverchok.nodes.generator.torus_mk2.SvTorusNodeMK2
- sverchok.nodes.generators_extended.box_rounded.SvBoxRoundedNode
- sverchok.nodes.generators_extended.conic_section.SvConicSectionNode
- sverchok.nodes.generators_extended.ellipse_mk3.SvEllipseNodeMK3
- sverchok.nodes.generators_extended.hilbert.HilbertNode
- sverchok.nodes.generators_extended.hilbert3d.Hilbert3dNode
- sverchok.nodes.generators_extended.hilbert_image.HilbertImageNode
- sverchok.nodes.generators_extended.pentagon_tiler.SvPentagonTilerNode
- sverchok.nodes.generators_extended.polygon_grid.SvPolygonGridNode
- sverchok.nodes.generators_extended.regular_solid.SvRegularSolid
- sverchok.nodes.generators_extended.ring_mk2.SvRingNodeMK2
- sverchok.nodes.generators_extended.smooth_lines.SvSmoothLines
- sverchok.nodes.generators_extended.spiral_mk2.SvSpiralNodeMK2
- sverchok.nodes.generators_extended.super_ellipsoid.SvSuperEllipsoidNode
- sverchok.nodes.generators_extended.torus_knot_mk2.SvTorusKnotNodeMK2
- sverchok.nodes.generators_extended.triangle.SvTriangleNode
- sverchok.nodes.generators_extended.wfc_texture.SvWFCTextureNode
- sverchok.nodes.layout.converter.ConverterNode
- sverchok.nodes.layout.wifi_in.WifiInNode
- sverchok.nodes.layout.wifi_out.WifiOutNode
- sverchok.nodes.list_main.constant.SvConstantListNode
- sverchok.nodes.list_main.decompose.SvListDecomposeNode
- sverchok.nodes.list_main.delete_levels.ListLevelsNode
- sverchok.nodes.list_main.func.ListFuncNode
- sverchok.nodes.list_main.index.SvIndexListNode
- sverchok.nodes.list_main.join.ListJoinNode
- sverchok.nodes.list_main.length.ListLengthNode
- sverchok.nodes.list_main.match.ListMatchNode
- sverchok.nodes.list_main.statistics.SvListStatisticsNode
- sverchok.nodes.list_main.sum_mk2.ListSumNodeMK2
- sverchok.nodes.list_main.zip.ZipNode
- sverchok.nodes.list_masks.calc_mask.SvCalcMaskNode
- sverchok.nodes.list_masks.index_to_mask.SvIndexToMaskNode
- sverchok.nodes.list_masks.mask.MaskListNode
- sverchok.nodes.list_masks.mask_convert.SvMaskConvertNode
- sverchok.nodes.list_masks.mask_join.SvMaskJoinNodeMK2
- sverchok.nodes.list_masks.mask_to_index.SvMaskToIndexNode
- sverchok.nodes.list_mutators.combinatorics.SvCombinatoricsNode
- sverchok.nodes.list_mutators.filter_empty_lists.SvFixEmptyObjectsNode
- sverchok.nodes.list_mutators.find_closest.SvFindClosestValue
- sverchok.nodes.list_mutators.modifier.SvListModifierNode
- sverchok.nodes.list_mutators.multi_cache.SvMultiCacheNode
- sverchok.nodes.list_mutators.polygon_sort.SvPolygonSortNode
- sverchok.nodes.list_mutators.unique_items.SvUniqueItemsNode
- sverchok.nodes.list_mutators.vd_attr_node_mk2.SvVDAttrsNodeMk2
- sverchok.nodes.list_struct.flip.ListFlipNode
- sverchok.nodes.list_struct.item.SvListItemNode
- sverchok.nodes.list_struct.item_insert.SvListItemInsertNode
- sverchok.nodes.list_struct.levels.SvListLevelsNodeMK2
- sverchok.nodes.list_struct.numpy_array.SvNumpyArrayNode
- sverchok.nodes.list_struct.repeater.ListRepeaterNode
- sverchok.nodes.list_struct.reverse.ListReverseNode
- sverchok.nodes.list_struct.shift_mk2.ShiftNodeMK2
- sverchok.nodes.list_struct.shuffle.ListShuffleNode
- sverchok.nodes.list_struct.slice.ListSliceNode
- sverchok.nodes.list_struct.slice_lite.SvListSliceLiteNode
- sverchok.nodes.list_struct.sort.SvListSortNode
- sverchok.nodes.list_struct.split.SvListSplitNode
- sverchok.nodes.list_struct.start_end.ListFLNode
- sverchok.nodes.logic.custom_switcher.SvCustomSwitcher
- sverchok.nodes.logic.evolver.SvEvolverNode
- sverchok.nodes.logic.genes_holder.SvGenesHolderNode
- sverchok.nodes.logic.input_switch_mod.SvInputSwitchNodeMOD
- sverchok.nodes.logic.logic_node.SvLogicNodeMK2
- sverchok.nodes.logic.loop_in.SvLoopInNode
- sverchok.nodes.logic.loop_out.SvLoopOutNode
- sverchok.nodes.logic.neuro_elman.SvNeuroElman1LNode
- sverchok.nodes.logic.range_switch.SvRangeSwitchNode
- sverchok.nodes.logic.switch_MK2.SvSwitchNodeMK2
- sverchok.nodes.matrix.apply_and_join.SvMatrixApplyJoinNode
- sverchok.nodes.matrix.euler.SvMatrixEulerNode
- sverchok.nodes.matrix.input.SvMatrixValueIn
- sverchok.nodes.matrix.interpolation.MatrixInterpolationNode
- sverchok.nodes.matrix.iterate.SvIterateNode
- sverchok.nodes.matrix.matrix_deform.MatrixDeformNode
- sverchok.nodes.matrix.matrix_in_mk4.SvMatrixInNodeMK4
- sverchok.nodes.matrix.matrix_math.SvMatrixMathNode
- sverchok.nodes.matrix.matrix_normal.SvMatrixNormalNode
- sverchok.nodes.matrix.matrix_out_mk2.SvMatrixOutNodeMK2
- sverchok.nodes.matrix.matrix_track_to.SvMatrixTrackToNode
- sverchok.nodes.matrix.shear.MatrixShearNode
- sverchok.nodes.modifier_change.bevel.SvBevelNode
- sverchok.nodes.modifier_change.delete_loose.SvDeleteLooseNode
- sverchok.nodes.modifier_change.dissolve_mesh_elements.SvDissolveMeshElements
- sverchok.nodes.modifier_change.edge_boom.SvEdgeBoomNode
- sverchok.nodes.modifier_change.edge_split.SvSplitEdgesMk3Node
- sverchok.nodes.modifier_change.edgenet_to_paths.SvEdgenetToPathsNode
- sverchok.nodes.modifier_change.extrude_edges_mk2.SvExtrudeEdgesNodeMk2
- sverchok.nodes.modifier_change.extrude_multi_alt.SvMultiExtrudeAlt
- sverchok.nodes.modifier_change.extrude_region.SvExtrudeRegionNode
- sverchok.nodes.modifier_change.extrude_separate.SvExtrudeSeparateNode
- sverchok.nodes.modifier_change.extrude_separate_lite.SvExtrudeSeparateLiteNode
- sverchok.nodes.modifier_change.flat_geometry.SvFlatGeometryNode
- sverchok.nodes.modifier_change.flip_normals.SvFlipNormalsNode
- sverchok.nodes.modifier_change.follow_active_quads.SvFollowActiveQuads
- sverchok.nodes.modifier_change.holes_fill.SvFillHolesNode
- sverchok.nodes.modifier_change.inset_faces.SvInsetFaces
- sverchok.nodes.modifier_change.limited_dissolve.SvLimitedDissolve
- sverchok.nodes.modifier_change.limited_dissolve_mk2.SvLimitedDissolveMK2
- sverchok.nodes.modifier_change.make_monotone.SvMakeMonotone
- sverchok.nodes.modifier_change.merge_by_distance.SvMergeByDistanceNode
- sverchok.nodes.modifier_change.mesh_beautify.SvMeshBeautify
- sverchok.nodes.modifier_change.mesh_clean.SvMeshCleanNode
- sverchok.nodes.modifier_change.mesh_join_mk2.SvMeshJoinNodeMk2
- sverchok.nodes.modifier_change.mesh_separate.SvSeparateMeshNode
- sverchok.nodes.modifier_change.objects_along_edge.SvDuplicateAlongEdgeNode
- sverchok.nodes.modifier_change.offset.SvOffsetNode
- sverchok.nodes.modifier_change.opensubdivision.SvOpenSubdivisionNode
- sverchok.nodes.modifier_change.planar_edgenet_to_polygons.SvPlanarEdgenetToPolygons
- sverchok.nodes.modifier_change.planar_faces.SvPlanarFacesNode
- sverchok.nodes.modifier_change.poke.SvPokeFacesNode
- sverchok.nodes.modifier_change.polygons_boom.PolygonBoomNode
- sverchok.nodes.modifier_change.polygons_to_edges_mk2.SvPols2EdgsNodeMk2
- sverchok.nodes.modifier_change.recalc_normals.SvRecalcNormalsNode
- sverchok.nodes.modifier_change.relax_mesh.SvRelaxMeshNode
- sverchok.nodes.modifier_change.rigid_origami.SvRigidOrigamiNode
- sverchok.nodes.modifier_change.separate_parts_to_indexes.SvSeparatePartsToIndexes
- sverchok.nodes.modifier_change.smooth.SvSmoothNode
- sverchok.nodes.modifier_change.split_faces.SvSplitFacesNode
- sverchok.nodes.modifier_change.split_mesh_elements.SvSplitMeshElements
- sverchok.nodes.modifier_change.subdivide_mk2.SvSubdivideNodeMK2
- sverchok.nodes.modifier_change.subdivide_to_quads.SvSubdivideToQuadsNode
- sverchok.nodes.modifier_change.triangulate.SvTriangulateNode
- sverchok.nodes.modifier_change.vertices_mask.SvVertMaskNode
- sverchok.nodes.modifier_make.adaptive_polygons_mk3.SvAdaptivePolygonsNodeMk3
- sverchok.nodes.modifier_make.bevel_curve.SvBevelCurveNode
- sverchok.nodes.modifier_make.bisect.SvBisectNode
- sverchok.nodes.modifier_make.clip_verts.SvClipVertsNode
- sverchok.nodes.modifier_make.contour2D.SvContourNode
- sverchok.nodes.modifier_make.csg_booleanMK2.SvCSGBooleanNodeMK2
- sverchok.nodes.modifier_make.cut_object_by_surface.SvCutObjBySurfaceNode
- sverchok.nodes.modifier_make.diamond_mesh.SvDiamondMeshNode
- sverchok.nodes.modifier_make.dual_mesh.SvDualMeshNode
- sverchok.nodes.modifier_make.edges_adaptative.SvAdaptiveEdgeNode
- sverchok.nodes.modifier_make.fractal_curve.SvFractalCurveNode
- sverchok.nodes.modifier_make.framework.SvFrameworkNode
- sverchok.nodes.modifier_make.join_tris.SvJoinTrianglesNode
- sverchok.nodes.modifier_make.lathe.SvLatheNode
- sverchok.nodes.modifier_make.matrix_tube.SvMatrixTubeNode
- sverchok.nodes.modifier_make.offset_line.SvOffsetLineNode
- sverchok.nodes.modifier_make.pipe_tubes.SvPipeNode
- sverchok.nodes.modifier_make.solidify_mk2.SvSolidifyNodeMk2
- sverchok.nodes.modifier_make.sweep_modulator.SvSweepModulator
- sverchok.nodes.modifier_make.unsubdivide.SvUnsubdivideNode
- sverchok.nodes.modifier_make.uv_connect.LineConnectNodeMK2
- sverchok.nodes.modifier_make.wafel.SvWafelNode
- sverchok.nodes.modifier_make.wireframe.SvWireframeNode
- sverchok.nodes.network.file_path.SvFilePathNode
- sverchok.nodes.network.udp_client.UdpClientNode
- sverchok.nodes.number.curve_mapper.SvCurveMapperNode
- sverchok.nodes.number.easing.SvEasingNode
- sverchok.nodes.number.exponential.SvGenExponential
- sverchok.nodes.number.fibonacci.SvGenFibonacci
- sverchok.nodes.number.float_to_int.Float2IntNode
- sverchok.nodes.number.list_input.SvListInputNode
- sverchok.nodes.number.mix_inputs.SvMixInputsNode
- sverchok.nodes.number.mix_numbers.SvMixNumbersNode
- sverchok.nodes.number.number_range.SvGenNumberRange
- sverchok.nodes.number.numbers.SvNumberNode
- sverchok.nodes.number.oscillator.SvOscillatorNode
- sverchok.nodes.number.random.RandomNode
- sverchok.nodes.number.random_num_gen.SvRndNumGen
- sverchok.nodes.number.range_map.SvMapRangeNode
- sverchok.nodes.number.scalar_mk4.SvScalarMathNodeMK4
- sverchok.nodes.number.smooth_numbers.SvSmoothNumbersNode
- sverchok.nodes.object_nodes.armature_analyzer.SvArmaturePropsNode
- sverchok.nodes.object_nodes.assign_materials.SvAssignMaterialListNode
- sverchok.nodes.object_nodes.closest_point_on_mesh2.SvPointOnMeshNodeMK2
- sverchok.nodes.object_nodes.color_uv_texture.SvMeshUVColorNode
- sverchok.nodes.object_nodes.copy_modifiers.SvCopyModifiersNode
- sverchok.nodes.object_nodes.custom_mesh_normals.SvSetCustomMeshNormals
- sverchok.nodes.object_nodes.filter_blenddata.SvFilterObjsNode
- sverchok.nodes.object_nodes.get_asset_properties_mk2.SvGetAssetPropertiesMK2
- sverchok.nodes.object_nodes.getsetprop_mk2.SvGetPropNodeMK2
- sverchok.nodes.object_nodes.getsetprop_mk2.SvSetPropNodeMK2
- sverchok.nodes.object_nodes.lattice_analyzer.SvLatticePropsNode
- sverchok.nodes.object_nodes.material_index.SvMaterialIndexNode
- sverchok.nodes.object_nodes.named_attribute.SvNamedMeshAttributeNode
- sverchok.nodes.object_nodes.object_raycast2.SvOBJRayCastNodeMK2
- sverchok.nodes.object_nodes.points_from_uv_to_mesh.SvUVPointonMeshNode
- sverchok.nodes.object_nodes.sample_uv_color.SvSampleUVColorNode
- sverchok.nodes.object_nodes.scene_raycast2.SvSCNRayCastNodeMK2
- sverchok.nodes.object_nodes.sculpt_mask.SvSculptMaskNode
- sverchok.nodes.object_nodes.select_mesh_verts.SvSelectMeshVerts
- sverchok.nodes.object_nodes.set_blenddata2.SvSetDataObjectNodeMK2
- sverchok.nodes.object_nodes.set_collection.SvSetCollection
- sverchok.nodes.object_nodes.set_custom_uv_map.SvSetCustomUVMap
- sverchok.nodes.object_nodes.set_loop_normals.SvSetLoopNormalsNode
- sverchok.nodes.object_nodes.set_mesh_attribute.SvSetMeshAttributeNode
- sverchok.nodes.object_nodes.sort_blenddata.SvSortObjsNode
- sverchok.nodes.object_nodes.vertex_colors_mk3.SvVertexColorNodeMK3
- sverchok.nodes.object_nodes.weightsmk2.SvVertexGroupNodeMK2
- sverchok.nodes.pulga_physics.pulga_align_force.SvPulgaAlignForceNode
- sverchok.nodes.pulga_physics.pulga_angle_force.SvPulgaAngleForceNode
- sverchok.nodes.pulga_physics.pulga_attraction_force.SvPulgaAttractionForceNode
- sverchok.nodes.pulga_physics.pulga_attractors_force_mk2.SvPulgaAttractorsForceNodeMk2
- sverchok.nodes.pulga_physics.pulga_boundaries_force.SvPulgaBoundingBoxForceNode
- sverchok.nodes.pulga_physics.pulga_collision_force.SvPulgaCollisionForceNode
- sverchok.nodes.pulga_physics.pulga_drag_force.SvPulgaDragForceNode
- sverchok.nodes.pulga_physics.pulga_fit_force.SvPulgaFitForceNode
- sverchok.nodes.pulga_physics.pulga_inflate_force.SvPulgaInflateForceNode
- sverchok.nodes.pulga_physics.pulga_obstacle_force.SvPulgaObstacleForceNode
- sverchok.nodes.pulga_physics.pulga_physics_lite.SvPulgaPhysicsNode
- sverchok.nodes.pulga_physics.pulga_physics_solver.SvPulgaPhysicsSolverNode
- sverchok.nodes.pulga_physics.pulga_pin_force.SvPulgaPinForceNode
- sverchok.nodes.pulga_physics.pulga_random_force.SvPulgaRandomForceNode
- sverchok.nodes.pulga_physics.pulga_springs_force.SvPulgaSpringsForceNode
- sverchok.nodes.pulga_physics.pulga_timed_force.SvPulgaTimedForceNode
- sverchok.nodes.pulga_physics.pulga_vector_force.SvPulgaVectorForceNode
- sverchok.nodes.pulga_physics.pulga_vortex_force.SvPulgaVortexForceNode
- sverchok.nodes.quaternion.quaternion_in_mk2.SvQuaternionInNodeMK2
- sverchok.nodes.quaternion.quaternion_math.SvQuaternionMathNode
- sverchok.nodes.quaternion.quaternion_out_mk2.SvQuaternionOutNodeMK2
- sverchok.nodes.quaternion.rotation_difference.SvRotationDifference
- sverchok.nodes.scene.FCurve_in.SvFCurveInNodeMK1
- sverchok.nodes.scene.cache.SvCacheNode
- sverchok.nodes.scene.collection_picker_mk1.SvCollectionPicker
- sverchok.nodes.scene.curve_in.SvCurveInputNode
- sverchok.nodes.scene.frame_info_mk2.SvFrameInfoNodeMK2
- sverchok.nodes.scene.get_objects_data.SvGetObjectsData
- sverchok.nodes.scene.node_remote_mk2.SvNodeRemoteNodeMK2
- sverchok.nodes.scene.obj_remote_mk2.SvObjRemoteNodeMK2
- sverchok.nodes.scene.objects_in_lite.SvObjInLite
- sverchok.nodes.scene.particles_MK2.SvParticlesMK2Node
- sverchok.nodes.scene.selection_grabber_lite.SvSelectionGrabberLite
- sverchok.nodes.scene.timer.SvTimerNode
- sverchok.nodes.scene.uv_texture.SvUVtextureNode
- sverchok.nodes.script.formula_interpolate.SvFormulaInterpolateNode
- sverchok.nodes.script.formula_mk5.SvFormulaNodeMk5
- sverchok.nodes.script.generative_art.SvGenerativeArtNode
- sverchok.nodes.script.mesh_eval.SvMeshEvalNode
- sverchok.nodes.script.multi_exec.SvExecNodeMod
- sverchok.nodes.script.numexpr_node.SvNumExprNode
- sverchok.nodes.script.profile_mk3.SvProfileNodeMK3
- sverchok.nodes.script.script1_lite.SvScriptNodeLite
- sverchok.nodes.script.sn_functor_b.SvSNFunctorB
- sverchok.nodes.script.topology_simple.SvTopologySimple
- sverchok.nodes.solid.bound_box.SvSolidBoundBoxNode
- sverchok.nodes.solid.box_solid.SvBoxSolidNode
- sverchok.nodes.solid.center_of_mass.SvSolidCenterOfMassNode
- sverchok.nodes.solid.chamfer_solid.SvChamferSolidNode
- sverchok.nodes.solid.cone_solid.SvConeSolidNode
- sverchok.nodes.solid.cylinder_solid.SvCylinderSolidNode
- sverchok.nodes.solid.export_solid.SvExportSolidNode
- sverchok.nodes.solid.extrude_face.SvSolidFaceExtrudeNode
- sverchok.nodes.solid.face_area.SvSolidFaceAreaNode
- sverchok.nodes.solid.fillet_solid.SvFilletSolidNode
- sverchok.nodes.solid.general_fuse.SvSolidGeneralFuseNode
- sverchok.nodes.solid.hollow_solid.SvHollowSolidNode
- sverchok.nodes.solid.import_solid.SvImportSolidNode
- sverchok.nodes.solid.is_closed.SvIsSolidClosedNode
- sverchok.nodes.solid.make_compound.SvCompoundSolidNode
- sverchok.nodes.solid.mesh_to_solid.SvMeshToSolidNode
- sverchok.nodes.solid.mirror_solid.SvMirrorSolidNode
- sverchok.nodes.solid.offset_solid.SvOffsetSolidNode
- sverchok.nodes.solid.points_inside_solid.SvIsInsideSolidNode
- sverchok.nodes.solid.polygon_face.SvSolidPolygonFaceNode
- sverchok.nodes.solid.projection_trim_face.SvProjectTrimFaceNode
- sverchok.nodes.solid.refine.SvRefineSolidNode
- sverchok.nodes.solid.revolve_face.SvSolidFaceRevolveNode
- sverchok.nodes.solid.ruled_solid.SvRuledSolidNode
- sverchok.nodes.solid.slice_solid.SvSliceSolidNode
- sverchok.nodes.solid.solid_area.SvSolidAreaNode
- sverchok.nodes.solid.solid_boolean.SvSolidBooleanNode
- sverchok.nodes.solid.solid_distance.SvSolidDistanceNode
- sverchok.nodes.solid.solid_edges.SvSolidEdgesNode
- sverchok.nodes.solid.solid_faces.SvSolidFacesNode
- sverchok.nodes.solid.solid_from_faces.SvSolidFromFacesNode
- sverchok.nodes.solid.solid_section.SvSolidSectionNode
- sverchok.nodes.solid.solid_select.SvSelectSolidNode
- sverchok.nodes.solid.solid_to_mesh_mk2.SvSolidToMeshNodeMk2
- sverchok.nodes.solid.solid_vertices.SvSolidVerticesNode
- sverchok.nodes.solid.solid_viewer.SvSolidViewerNode
- sverchok.nodes.solid.solid_volume.SvSolidVolumeNode
- sverchok.nodes.solid.solidify_face.SvSolidFaceSolidifyNode
- sverchok.nodes.solid.sphere_solid.SvSphereSolidNode
- sverchok.nodes.solid.split_solid.SvSplitSolidNode
- sverchok.nodes.solid.sweep_face.SvSweepSolidFaceNode
- sverchok.nodes.solid.torus_solid.SvToursSolidNode
- sverchok.nodes.solid.transform_solid.SvTransformSolidNode
- sverchok.nodes.solid.validate.SvSolidValidateNode
- sverchok.nodes.solid.wire_face.SvSolidWireFaceNode
- sverchok.nodes.spatial.concave_hull.SvConcaveHullNode
- sverchok.nodes.spatial.convex_hull_mk2.SvConvexHullNodeMK2
- sverchok.nodes.spatial.delaunay3d.SvDelaunay3dMk2Node
- sverchok.nodes.spatial.delaunay_2d.DelaunayTriangulation2DNode
- sverchok.nodes.spatial.delaunay_2d_cdt.SvDelaunay2DCdt
- sverchok.nodes.spatial.field_random_probe.SvFieldRandomProbeMk3Node
- sverchok.nodes.spatial.homogenous_vector_field.SvHomogenousVectorField
- sverchok.nodes.spatial.lloyd2d.SvLloyd2dNode
- sverchok.nodes.spatial.lloyd3d.SvLloyd3dNode
- sverchok.nodes.spatial.lloyd_on_mesh.SvLloydOnMeshNode
- sverchok.nodes.spatial.lloyd_on_sphere.SvLloydOnSphereNode
- sverchok.nodes.spatial.lloyd_solid.SvLloydSolidNode
- sverchok.nodes.spatial.lloyd_solid_face.SvLloydSolidFaceNode
- sverchok.nodes.spatial.populate_solid.SvPopulateSolidMk2Node
- sverchok.nodes.spatial.populate_surface.SvPopulateSurfaceMk2Node
- sverchok.nodes.spatial.random_points_on_mesh.SvRandomPointsOnMesh
- sverchok.nodes.spatial.voronoi3d.SvExVoronoi3DNode
- sverchok.nodes.spatial.voronoi_2d.Voronoi2DNode
- sverchok.nodes.spatial.voronoi_on_mesh.SvVoronoiOnMeshNode
- sverchok.nodes.spatial.voronoi_on_solid.SvVoronoiOnSolidNode
- sverchok.nodes.spatial.voronoi_on_surface.SvVoronoiOnSurfaceNode
- sverchok.nodes.spatial.voronoi_sphere.SvExVoronoiSphereNode
- sverchok.nodes.surface.adaptive_tessellate.SvAdaptiveTessellateNode
- sverchok.nodes.surface.apply_field_to_surface.SvApplyFieldToSurfaceNode
- sverchok.nodes.surface.approximate_nurbs_surface.SvExApproxNurbsSurfaceNodeMK2
- sverchok.nodes.surface.blend_surface.SvBlendSurfaceNodeMk2
- sverchok.nodes.surface.coons_patch.SvCoonsPatchNode
- sverchok.nodes.surface.curvatures.SvSurfaceCurvaturesNode
- sverchok.nodes.surface.deconstruct_surface.SvDeconstructSurfaceNode
- sverchok.nodes.surface.evaluate_surface.SvEvalSurfaceNode
- sverchok.nodes.surface.extrude_curve.SvExtrudeCurveCurveSurfaceNode
- sverchok.nodes.surface.extrude_point.SvExtrudeCurvePointNode
- sverchok.nodes.surface.extrude_vector.SvExtrudeCurveVectorNode
- sverchok.nodes.surface.flip_surface.SvFlipSurfaceNode
- sverchok.nodes.surface.gauss_curvature.SvSurfaceGaussCurvatureNode
- sverchok.nodes.surface.gordon_surface.SvGordonSurfaceNode
- sverchok.nodes.surface.implicit_surface_raycast.SvExImplSurfaceRaycastNode
- sverchok.nodes.surface.interpolate_nurbs_surface.SvExInterpolateNurbsSurfaceNodeMK2
- sverchok.nodes.surface.interpolating_surface.SvInterpolatingSurfaceNode
- sverchok.nodes.surface.intersect_curve_surface.SvExCrossCurveSurfaceNode
- sverchok.nodes.surface.marching_cubes.SvExMarchingCubesNode
- sverchok.nodes.surface.min_surface_from_curve.SvExMinSurfaceFromCurveNode
- sverchok.nodes.surface.minimal_surface.SvExMinimalSurfaceNode
- sverchok.nodes.surface.normals.SvSurfaceNormalsNode
- sverchok.nodes.surface.nurbs_birail.SvNurbsBirailNode
- sverchok.nodes.surface.nurbs_loft.SvNurbsLoftNode
- sverchok.nodes.surface.nurbs_surface.SvExNurbsSurfaceNode
- sverchok.nodes.surface.nurbs_sweep.SvNurbsSweepNode
- sverchok.nodes.surface.pipe.SvPipeSurfaceNode
- sverchok.nodes.surface.plane.SvPlaneSurfaceNode
- sverchok.nodes.surface.quads_to_nurbs.SvExQuadsToNurbsNode
- sverchok.nodes.surface.raycast.SvExRaycastSurfaceNode
- sverchok.nodes.surface.revolution_surface.SvRevolutionSurfaceNode
- sverchok.nodes.surface.ruled_surface.SvCurveLerpNode
- sverchok.nodes.surface.subdomain.SvSurfaceSubdomainNode
- sverchok.nodes.surface.surface_bevel_curve.SvBendCurveSurfaceNode
- sverchok.nodes.surface.surface_domain.SvSurfaceDomainNode
- sverchok.nodes.surface.surface_elevate_degree.SvSurfaceElevateDegreeNode
- sverchok.nodes.surface.surface_extremes.SvExSurfaceExtremesNode
- sverchok.nodes.surface.surface_formula.SvSurfaceFormulaNode
- sverchok.nodes.surface.surface_insert_knot.SvSurfaceInsertKnotNode
- sverchok.nodes.surface.surface_lerp.SvSurfaceLerpNode
- sverchok.nodes.surface.surface_nearest_point.SvExNearestPointOnSurfaceNode
- sverchok.nodes.surface.surface_ortho_project.SvExOrthoProjectSurfaceNode
- sverchok.nodes.surface.surface_reduce_degree.SvSurfaceReduceDegreeNode
- sverchok.nodes.surface.surface_remove_excessive_knots.SvSurfaceRemoveExcessiveKnotsNode
- sverchok.nodes.surface.surface_remove_knot.SvSurfaceRemoveKnotNode
- sverchok.nodes.surface.surface_reparametrize.SvReparametrizeSurfaceNode
- sverchok.nodes.surface.surface_sphere.SvSphereNode
- sverchok.nodes.surface.swap.SvSwapSurfaceNode
- sverchok.nodes.surface.taper_sweep.SvTaperSweepSurfaceNode
- sverchok.nodes.surface.tessellate_trim.SvExTessellateTrimSurfaceNode
- sverchok.nodes.svg.circle_svg.SvSvgCircleNode
- sverchok.nodes.svg.dimensions_svg_mk2.SvSvgDimensionNodeMK2
- sverchok.nodes.svg.fill_stroke_mk2.SvSvgFillStrokeNodeMk2
- sverchok.nodes.svg.group_svg.SvSvgGroupNode
- sverchok.nodes.svg.mesh_svg.SvSvgMeshNode
- sverchok.nodes.svg.path_svg_mk2.SvSvgPathNodeMk2
- sverchok.nodes.svg.pattern_svg.SvSvgPatternNode
- sverchok.nodes.svg.svg_document.SvSvgDocumentNode
- sverchok.nodes.svg.text_svg.SvSvgTextNode
- sverchok.nodes.text.datetime_strings.SvDatetimeStrings
- sverchok.nodes.text.debug_print.SvDebugPrintNode
- sverchok.nodes.text.gtext.SvGTextNode
- sverchok.nodes.text.note.NoteNode
- sverchok.nodes.text.shape.SvDataShapeNode
- sverchok.nodes.text.simple_text.SvSimpleTextNode
- sverchok.nodes.text.stethoscope_v28.SvStethoscopeNodeMK2
- sverchok.nodes.text.string_tools.SvStringsToolsNode
- sverchok.nodes.text.text_in_mk2.SvTextInNodeMK2
- sverchok.nodes.text.text_out_mk2.SvTextOutNodeMK2
- sverchok.nodes.text.viewer_text_mk3.ViewerNodeTextMK3
- sverchok.nodes.transforms.align_mesh_by_mesh.SvAlignMeshByMesh
- sverchok.nodes.transforms.apply.MatrixApplyNode
- sverchok.nodes.transforms.barycentric_transform.SvBarycentricTransformNode
- sverchok.nodes.transforms.bend_along_path.SvBendAlongPathNode
- sverchok.nodes.transforms.bend_along_surface.SvBendAlongSurfaceNode
- sverchok.nodes.transforms.cast.SvCastNode
- sverchok.nodes.transforms.deform.SvSimpleDeformNode
- sverchok.nodes.transforms.formula_deform_mk2.SvFormulaDeformMK2Node
- sverchok.nodes.transforms.mirror_mk2.SvMirrorNodeMk2
- sverchok.nodes.transforms.move_mk3.SvMoveNodeMk3
- sverchok.nodes.transforms.noise_displace.SvNoiseDisplaceNode
- sverchok.nodes.transforms.randomize.SvRandomizeVerticesNode
- sverchok.nodes.transforms.rotate_mk3.SvRotationNodeMk3
- sverchok.nodes.transforms.scale_mk3.SvScaleNodeMk3
- sverchok.nodes.transforms.symmetrize.SvSymmetrizeNode
- sverchok.nodes.transforms.texture_displace_mk2.SvDisplaceNodeMk2
- sverchok.nodes.transforms.transform_mesh.SvTransformMesh
- sverchok.nodes.transforms.transform_select.SvTransformSelectNode
- sverchok.nodes.vector.attractor.SvAttractorNode
- sverchok.nodes.vector.axis_input_mk2.SvAxisInputNodeMK2
- sverchok.nodes.vector.drop.VectorDropNode
- sverchok.nodes.vector.fractal.SvVectorFractal
- sverchok.nodes.vector.interpolation_mk2.SvInterpolationNodeMK2
- sverchok.nodes.vector.interpolation_mk3.SvInterpolationNodeMK3
- sverchok.nodes.vector.interpolation_stripes.SvInterpolationStripesNode
- sverchok.nodes.vector.lerp.SvVectorLerp
- sverchok.nodes.vector.math_mk3.SvVectorMathNodeMK3
- sverchok.nodes.vector.noise_mk3.SvNoiseNodeMK3
- sverchok.nodes.vector.quad_grid.SvQuadGridSortVertsNode
- sverchok.nodes.vector.turbulence.SvTurbulenceNode
- sverchok.nodes.vector.variable_lacunarity.SvLacunarityNode
- sverchok.nodes.vector.vector_in.GenVectorsNode
- sverchok.nodes.vector.vector_out.VectorsOutNode
- sverchok.nodes.vector.vector_polar_in.VectorPolarInNode
- sverchok.nodes.vector.vector_polar_out.VectorPolarOutNode
- sverchok.nodes.vector.vector_rewire.SvVectorRewire
- sverchok.nodes.vector.vertices_delete_doubles.VertsDelDoublesNode
- sverchok.nodes.vector.vertices_sort.SvVertSortNode
- sverchok.nodes.viz.console_node.SvConsoleNode
- sverchok.nodes.viz.dupli_instances_lite.SvDupliInstancesLite
- sverchok.nodes.viz.dupli_instances_mk5.SvDupliInstancesMK5
- sverchok.nodes.viz.empty_out.SvEmptyOutNode
- sverchok.nodes.viz.geo_nodes_viewer.SvGeoNodesViewerNode
- sverchok.nodes.viz.instancer.SvInstancerNodeMK3
- sverchok.nodes.viz.light_viewer.SvLightViewerNode
- sverchok.nodes.viz.mesh_viewer.SvMeshViewer
- sverchok.nodes.viz.polyline_viewer.SvPolylineViewerNode
- sverchok.nodes.viz.vd_matrix.SvMatrixViewer28
- sverchok.nodes.viz.viewer_2d.SvViewer2D
- sverchok.nodes.viz.viewer_bezier_curve.SvBezierCurveOutNode
- sverchok.nodes.viz.viewer_curves.SvCurveViewerNodeV28
- sverchok.nodes.viz.viewer_draw_curve.SvCurveViewerDrawNode
- sverchok.nodes.viz.viewer_draw_mk4.SvViewerDrawMk4
- sverchok.nodes.viz.viewer_draw_surface.SvSurfaceViewerDrawNode
- sverchok.nodes.viz.viewer_gp.SvGreasePencilStrokes
- sverchok.nodes.viz.viewer_idx28.SvIDXViewer28
- sverchok.nodes.viz.viewer_metaball.SvMetaballOutNode
- sverchok.nodes.viz.viewer_nurbs_curve.SvNurbsCurveOutNode
- sverchok.nodes.viz.viewer_nurbs_surface.SvNurbsSurfaceOutNode
- sverchok.nodes.viz.viewer_skin.SvSkinViewerNodeV28
- sverchok.nodes.viz.viewer_texture.SvTextureViewerNode
- sverchok.nodes.viz.viewer_texture_lite.SvTextureViewerNodeLite
- sverchok.nodes.viz.viewer_typography.SvTypeViewerNodeV28
- sverchok.nodes.viz.viewer_waveform_output.SvWaveformViewer
- sverchok.old_nodes.getsetprop.SvGetPropNode
- sverchok.old_nodes.getsetprop.SvSetPropNode
Class variables
var sv_category
-
Add node to a category by its name to display with Shift+S
Static methods
def poll(ntree)
-
Can be overridden to make impossible to add certain nodes either to main trees or to group trees. Also since Blender 3.4 presence of this method is preventing Sverchok nodes from appearing in build-in tree editors. See details.
Expand source code
@classmethod def poll(cls, ntree): """Can be overridden to make impossible to add certain nodes either to main trees or to group trees. Also since Blender 3.4 presence of this method is preventing Sverchok nodes from appearing in build-in tree editors. See [details](https://developer.blender.org/T101259#1423746).""" return ntree.bl_idname in ['SverchCustomTreeType', 'SvGroupTree']
Instance variables
var absolute_location : tuple
-
When a node is inside a frame (and parented to it) then node.location is relative to its parent's location. This function returns the location in absolute screen terms whether the node is framed or not.
Expand source code
@property def absolute_location(self) -> tuple[float, float]: """ When a node is inside a frame (and parented to it) then node.location is relative to its parent's location. This function returns the location in absolute screen terms whether the node is framed or not. """ return recursive_framed_location_finder(self, self.location[:])
-
Returns information whether buttons should be shown in big variant
Expand source code
@property def prefs_over_sized_buttons(self) -> bool: """Returns information whether buttons should be shown in big variant  """ try: addon = bpy.context.preferences.addons.get(sverchok.__name__) prefs = addon.preferences except Exception as err: print('failed to access addon preferences for button size', err) return False return prefs.over_sized_buttons
var sv_default_color
-
Returns default color of the node which can be changed in add-on settings.
Expand source code
@property def sv_default_color(self): """Returns default color of the node which can be changed in add-on settings.""" return color_def.get_color(self.bl_idname)
var sv_internal_links : Iterable[tuple[bpy_types.NodeSocket, bpy_types.NodeSocket]]
-
Override the property to change logic of connecting sockets when the node is muted. Also, there are some basic implementations
sverchok.utils.nodes_mixins.sockets_config
Expand source code
@property def sv_internal_links(self) -> Iterable[tuple[NodeSocket, NodeSocket]]: """Override the property to change logic of connecting sockets when the node is muted. Also, there are some basic implementations `sverchok.utils.nodes_mixins.sockets_config`""" for link in self.internal_links: yield link.from_socket, link.to_socket
Methods
-
This method is used to display extra UI element of a node which are generated automatically. To display elements specific to certain nodes use
SverchCustomTreeNode.sv_draw_buttons()
.Expand source code
@final def draw_buttons(self, context, layout): """This method is used to display extra UI element of a node which are generated automatically. To display elements specific to certain nodes use `SverchCustomTreeNode.sv_draw_buttons`.""" if self.id_data.bl_idname == SverchCustomTree.bl_idname: row = None # should be initialized lazily to safe space if self.is_animation_dependent: row = row or layout.row(align=True) row.prop(self, 'is_animatable', icon='ANIM', icon_only=True) if self.is_scene_dependent: row = row or layout.row(align=True) row.prop(self, 'is_interactive', icon='SCENE_DATA', icon_only=True) if self.is_animation_dependent or self.is_scene_dependent: row = row or layout.row(align=True) row.prop(self, 'refresh', icon='FILE_REFRESH') self.sv_draw_buttons(context, layout)
-
This method is used to display extra UI element of a node which are generated automatically. To display elements specific to certain nodes use
SverchCustomTreeNode.sv_draw_buttons_ext()
. This UI is displayed on a property panel of the tree editor.Expand source code
def draw_buttons_ext(self, context, layout): """This method is used to display extra UI element of a node which are generated automatically. To display elements specific to certain nodes use `SverchCustomTreeNode.sv_draw_buttons_ext`. This UI is displayed on a property panel of the tree editor.""" if self.id_data.bl_idname == SverchCustomTree.bl_idname: row = layout.row(align=True) if self.is_animation_dependent: row.prop(self, 'is_animatable', icon='ANIM') if self.is_scene_dependent: row.prop(self, 'is_interactive', icon='SCENE_DATA') if self.is_animation_dependent or self.is_scene_dependent: row.prop(self, 'refresh', icon='FILE_REFRESH') self.sv_draw_buttons_ext(context, layout)
def migrate_from(self, old_node)
-
This method is called by
sverchok.ui.nodes_replacement.SvReplaceNode
. Override it to correctly copy settings from old_node to this (new) node. This is called afterSverchCustomTreeNode.migrate_links_from()
. Default implementation does nothing.Expand source code
def migrate_from(self, old_node): """ This method is called by `sverchok.ui.nodes_replacement.SvReplaceNode`. Override it to correctly copy settings from old_node to this (new) node. This is called after `SverchCustomTreeNode.migrate_links_from`. Default implementation does nothing. """ pass
def migrate_links_from(self, old_node, operator)
-
This method is called by
sverchok.ui.nodes_replacement.SvReplaceNode
. By default, it removes existing links from old_node and creates corresponding links for this (new) node. Override it to implement custom re-linking at node replacement. Most nodes do not have to override this method.Expand source code
def migrate_links_from(self, old_node, operator): """ This method is called by `sverchok.ui.nodes_replacement.SvReplaceNode`. By default, it removes existing links from old_node and creates corresponding links for this (new) node. Override it to implement custom re-linking at node replacement. Most nodes do not have to override this method. """ tree = self.id_data # Copy incoming / outgoing links old_in_links = [link for link in tree.links if link.to_node == old_node] old_out_links = [link for link in tree.links if link.from_node == old_node] for old_link in old_in_links: new_target_socket_name = operator.get_new_input_name(old_link.to_socket.name) if new_target_socket_name in self.inputs: new_target_socket = self.inputs[new_target_socket_name] new_link = tree.links.new(old_link.from_socket, new_target_socket) else: self.debug("New node %s has no input named %s, skipping", self.name, new_target_socket_name) tree.links.remove(old_link) for old_link in old_out_links: new_source_socket_name = operator.get_new_output_name(old_link.from_socket.name) # We have to remove old link before creating new one # Blender would not allow two links pointing to the same target socket old_target_socket = old_link.to_socket tree.links.remove(old_link) if new_source_socket_name in self.outputs: new_source_socket = self.outputs[new_source_socket_name] new_link = tree.links.new(new_source_socket, old_target_socket) else: self.debug("New node %s has no output named %s, skipping", self.name, new_source_socket_name)
-
Draw menu items with node replacement operators. This is called from
SverchCustomTreeNode.rclick_menu()
method by default. Items are defined byreplacement_nodes
class property. Expected format is:replacement_nodes = [ (new_node_bl_idname, inputs_mapping_dict, outputs_mapping_dict) ]
where:
new_node_bl_idname
is bl_idname of replacement node class,inputs_mapping_dict
is a dictionary mapping names of inputs of this node to names of inputs to new node,outputs_mapping_dict
is a dictionary mapping names of outputs of this node to names of outputs of new node.
inputs_mapping_dict
andoutputs_mapping_dict
can be None.Expand source code
def node_replacement_menu(self, context, layout): """ Draw menu items with node replacement operators. This is called from `SverchCustomTreeNode.rclick_menu` method by default. Items are defined by `replacement_nodes` class property. Expected format is: replacement_nodes = [ (new_node_bl_idname, inputs_mapping_dict, outputs_mapping_dict) ] where: - `new_node_bl_idname` is bl_idname of replacement node class, - `inputs_mapping_dict` is a dictionary mapping names of inputs of this node to names of inputs to new node, - `outputs_mapping_dict` is a dictionary mapping names of outputs of this node to names of outputs of new node. `inputs_mapping_dict` and `outputs_mapping_dict` can be None. """ if hasattr(self, "replacement_nodes"): for bl_idname, inputs_mapping, outputs_mapping in self.replacement_nodes: node_class = bpy.types.Node.bl_rna_get_subclass_py(bl_idname) if node_class: text = "Replace with {}".format(node_class.bl_label) op = layout.operator("node.sv_replace_node", text=text) op.old_node_name = self.name op.new_bl_idname = bl_idname set_inputs_mapping(op, inputs_mapping) set_outputs_mapping(op, outputs_mapping) else: self.error("Can't build replacement menu: no such node class: %s",bl_idname)
-
Override this method to add specific items into the node's right-click menu. Default implementation calls `SverchCustomTreeNode.node_replacement_menu'.
Expand source code
def rclick_menu(self, context, layout): """ Override this method to add specific items into the node's right-click menu. Default implementation calls `SverchCustomTreeNode.node_replacement_menu'. """ self.node_replacement_menu(context, layout)
def set_temp_color(self, color=None)
-
This method memorize its initial color and override it with given one if given color is None it tries to return its initial color or do nothing
Expand source code
def set_temp_color(self, color=None): """This method memorize its initial color and override it with given one if given color is None it tries to return its initial color or do nothing""" if color is None: # looks like the node should return its initial color (user choice) if 'user_color' in self: self.use_custom_color = self['use_user_color'] del self['use_user_color'] self.color = self['user_color'] del self['user_color'] # set temporary color else: # save overridden color (only once) if 'user_color' not in self: self['use_user_color'] = self.use_custom_color self['user_color'] = self.color self.use_custom_color = True self.color = color
-
Override to display node properties, text, operators etc. Read more in Blender docs.
Expand source code
def sv_draw_buttons(self, context, layout): """Override to display node properties, text, operators etc. Read more in [Blender docs](https://docs.blender.org/api/3.3/bpy.types.UILayout.html).""" pass
-
Override to display node properties, text, operators etc. Read more in Blender docs. This UI is displayed on a property panel of the tree editor.
Expand source code
def sv_draw_buttons_ext(self, context, layout): """Override to display node properties, text, operators etc. Read more in [Blender docs](https://docs.blender.org/api/3.3/bpy.types.UILayout.html). This UI is displayed on a property panel of the tree editor.""" self.sv_draw_buttons(context, layout)
Inherited members
class UpdateNodes
-
Everything related with update system of nodes
Expand source code
class UpdateNodes: """Everything related with update system of nodes""" n_id: StringProperty(options={'SKIP_SAVE'}) """Identifier of the node, should be used via `UpdateNodes.node_id` property. ```text ⚠️ There is no sense to override this property ``` """ @property def node_id(self): """Identifier of the node. [Rational](#blender-data-blocks-ids)""" if not self.n_id: self.n_id = str(hash(self) ^ hash(time.monotonic())) return self.n_id def update_interactive_mode(self, context): """When `UpdateNodes.is_interactive` mode is on the method updates only outdated nodes""" if self.is_interactive: self.process_node(context) is_interactive: BoolProperty( default=True, description="Update node upon changes in the scene", update=update_interactive_mode, name="Interactive") """When this option is on arbitrary changes in scene will update this node. Those changes can be: - moving objects - changing edit / object mode - mesh editing - assign materials - etc. This option is used to display it in UI so user could switch it on/off. it should be set to True (together with `UpdateNodes.is_scene_dependent`) for nodes which read data from blender scene.""" is_scene_dependent = False """The option switches on to display automatically the `UpdateNodes.is_interactive` option as a button inside a node but in this case the `SverchCustomTreeNode.draw_buttons` method should not be overridden and `SverchCustomTreeNode.sv_draw_buttons` should be used instead.  """ def refresh_node(self, context): """Together with `UpdateNodes.refresh` property it is used as an operator which updates the node.""" if self.refresh: self.refresh = False self.process_node(context) refresh: BoolProperty(name="Update Node", description="Update Node", update=refresh_node) """See `UpdateNodes.refresh_node`.  The button is automatically displayed when at least `UpdateNodes.is_scene_dependent` or `UpdateNodes.is_animation_dependent` is on. Also the node should use `SverchCustomTreeNode.sv_draw_buttons`. """ is_animatable: BoolProperty(name="Animate Node", description="Update Node on frame change", default=True, update=lambda s, c: s.process_node(c)) """A switch for user to make a node to update on frame changes in a scene. Use `UpdateNodes.is_animation_dependent` to display the option in node UI.""" is_animation_dependent = False """ Use this to display the `UpdateNodes.is_animatable` option in node UI. Also the node should use `SverchCustomTreeNode.sv_draw_buttons`. """ def sv_init(self, context): """ This method will be called during node creation Typically it is used for socket creating and assigning properties to sockets """ pass def sv_update(self): """ This method can be overridden in inherited classes. It will be triggered upon any `node tree` editor changes (new/copy/delete links/nodes). Calling of this method is unordered among other calls of the method of other nodes in a tree. Typically, it is used to change output socket types dependent on what type is connected to a node. """ pass def sv_copy(self, original): """ Override this method to do anything node-specific (clean properties) at the moment of node being copied. """ pass def sv_free(self): """ Override this method to do anything node-specific upon node removal """ pass @final def init(self, context): """ This function is triggered upon node creation, functionality: - sets default colors of the node - show alpha/beta state of the node - logs further errors - delegates further initialization information to `UpdateNodes.sv_init` """ if self.sv_default_color: self.use_custom_color = True self.color = self.sv_default_color if hasattr(self, 'sv_icon') and self.sv_icon in {'SV_ALPHA', 'SV_BETA'}: frame = self.id_data.nodes.new("NodeFrame") self.parent = frame frame.label = f'{"Alpha" if self.sv_icon == "SV_ALPHA" else "Beta"} Node' frame.use_custom_color = True frame.color = (0.3, 0, 0.7) frame.shrink = True frame['in_development'] = True # can be used to distinguish the frame with catch_log_error(): self.sv_init(context) def sv_new_input(self, socket_type, name, **attrib_dict): """Alias of creating and setting socket properties. Example: ```py self.sv_new_input('SvStringsSocket', "Polygons", hide_safe=True, prop_name='scale_factor') ```""" socket = self.inputs.new(socket_type, name) for att in attrib_dict: setattr(socket, att, attrib_dict[att]) return socket @final def free(self): """Called upon the node removal - calls `UpdateNodes.sv_free - cleans socket data catch - cleans drawings in the tree editor space""" self.sv_free() for s in chain(self.inputs, self.outputs): s.sv_forget() self.update_ui() @final def copy(self, original): """Called upon the node being copied - refreshes node and socket ids - calls `UpdateNodes.sv_copy`""" self.n_id = "" for sock in chain(self.inputs, self.outputs): sock.s_id = '' self.sv_copy(original) @final def update(self): """ The method will be triggered upon editor changes, typically before node tree update method. It calls `UpdateNodes.sv_update`. ```text ⚠️ It checks special flag in the tree of the node. The flag is set by json import module. If the tree has the flag the node skips farther execution of the method. This is done for performance reason and actually there is no reason to execute the method since the import module totally controls building of the tree. ``` The flag can be set by `SvNodeTreeCommon.init_tree`. """ if 'init_tree' in self.id_data: # tree is building by a script - let it do this return self.sv_update() def update_ui(self, error=None, update_time=None): """This method is intended to use by update system to show node errors in the tree editors space and to show execution time""" sv_settings = bpy.context.preferences.addons[sverchok.__name__].preferences exception_color = sv_settings.exception_color no_data_color = sv_settings.no_data_color error_pref = "error" update_pref = "update_time" # update error colors if error is not None: color = no_data_color if isinstance(error, SvNoDataError) else exception_color self.set_temp_color(color) sv_bgl.draw_text(self, str(error), error_pref + self.node_id, color, 1.3, "UP") else: sv_bgl.callback_disable(error_pref + self.node_id) self.set_temp_color() # show update timing if update_time is not None: update_time = int(update_time * 1000) sv_bgl.draw_text(self, f'{update_time}ms', update_pref + self.node_id, align="UP", dynamic_location=False) else: sv_bgl.callback_disable(update_pref + self.node_id) def insert_link(self, link): """It will be triggered only if one socket is connected with another by user. There is no useful use for the trigger currently.""" def process_node(self, context): """Call this method to revaluate the node whenever its properties were changed""" self.id_data.update_nodes([self])
Subclasses
Class variables
var is_animatable : <_PropertyDeferred,
, {'name': 'Animate Node', 'description': 'Update Node on frame change', 'default': True, 'update': UpdateNodes. at 0x7f2f1d916430>, 'attr': 'is_animatable'}> -
A switch for user to make a node to update on frame changes in a scene. Use
UpdateNodes.is_animation_dependent
to display the option in node UI. var is_animation_dependent
-
Use this to display the
UpdateNodes.is_animatable
option in node UI. Also the node should useSverchCustomTreeNode.sv_draw_buttons()
. var is_interactive : <_PropertyDeferred,
, {'default': True, 'description': 'Update node upon changes in the scene', 'update': UpdateNodes.update_interactive_mode() at 0x7f2f1d916310>, 'name': 'Interactive', 'attr': 'is_interactive'}> -
When this option is on arbitrary changes in scene will update this node. Those changes can be:
- moving objects
- changing edit / object mode
- mesh editing
- assign materials
- etc.
This option is used to display it in UI so user could switch it on/off. it should be set to True (together with
UpdateNodes.is_scene_dependent
) for nodes which read data from blender scene. var is_scene_dependent
-
The option switches on to display automatically the
UpdateNodes.is_interactive
option as a button inside a node but in this case theSverchCustomTreeNode.draw_buttons()
method should not be overridden andSverchCustomTreeNode.sv_draw_buttons()
should be used instead. var n_id : <_PropertyDeferred,
, {'options': {'SKIP_SAVE'}, 'attr': 'n_id'}> -
Identifier of the node, should be used via
UpdateNodes.node_id
property.⚠️ There is no sense to override this property
var refresh : <_PropertyDeferred,
, {'name': 'Update Node', 'description': 'Update Node', 'update': UpdateNodes.refresh_node() at 0x7f2f1d9163a0>, 'attr': 'refresh'}> -
See
UpdateNodes.refresh_node()
.The button is automatically displayed when at least
UpdateNodes.is_scene_dependent
orUpdateNodes.is_animation_dependent
is on. Also the node should useSverchCustomTreeNode.sv_draw_buttons()
.
Instance variables
var node_id
-
Identifier of the node. Rational
Expand source code
@property def node_id(self): """Identifier of the node. [Rational](#blender-data-blocks-ids)""" if not self.n_id: self.n_id = str(hash(self) ^ hash(time.monotonic())) return self.n_id
Methods
def copy(self, original)
-
Called upon the node being copied
- refreshes node and socket ids
- calls
UpdateNodes.sv_copy()
Expand source code
@final def copy(self, original): """Called upon the node being copied - refreshes node and socket ids - calls `UpdateNodes.sv_copy`""" self.n_id = "" for sock in chain(self.inputs, self.outputs): sock.s_id = '' self.sv_copy(original)
def free(self)
-
Called upon the node removal
- calls `UpdateNodes.sv_free
- cleans socket data catch
- cleans drawings in the tree editor space
Expand source code
@final def free(self): """Called upon the node removal - calls `UpdateNodes.sv_free - cleans socket data catch - cleans drawings in the tree editor space""" self.sv_free() for s in chain(self.inputs, self.outputs): s.sv_forget() self.update_ui()
def init(self, context)
-
This function is triggered upon node creation, functionality:
- sets default colors of the node
- show alpha/beta state of the node
- logs further errors
- delegates further initialization information to
UpdateNodes.sv_init()
Expand source code
@final def init(self, context): """ This function is triggered upon node creation, functionality: - sets default colors of the node - show alpha/beta state of the node - logs further errors - delegates further initialization information to `UpdateNodes.sv_init` """ if self.sv_default_color: self.use_custom_color = True self.color = self.sv_default_color if hasattr(self, 'sv_icon') and self.sv_icon in {'SV_ALPHA', 'SV_BETA'}: frame = self.id_data.nodes.new("NodeFrame") self.parent = frame frame.label = f'{"Alpha" if self.sv_icon == "SV_ALPHA" else "Beta"} Node' frame.use_custom_color = True frame.color = (0.3, 0, 0.7) frame.shrink = True frame['in_development'] = True # can be used to distinguish the frame with catch_log_error(): self.sv_init(context)
def insert_link(self, link)
-
It will be triggered only if one socket is connected with another by user. There is no useful use for the trigger currently.
Expand source code
def insert_link(self, link): """It will be triggered only if one socket is connected with another by user. There is no useful use for the trigger currently."""
def process_node(self, context)
-
Call this method to revaluate the node whenever its properties were changed
Expand source code
def process_node(self, context): """Call this method to revaluate the node whenever its properties were changed""" self.id_data.update_nodes([self])
def refresh_node(self, context)
-
Together with
UpdateNodes.refresh
property it is used as an operator which updates the node.Expand source code
def refresh_node(self, context): """Together with `UpdateNodes.refresh` property it is used as an operator which updates the node.""" if self.refresh: self.refresh = False self.process_node(context)
def sv_copy(self, original)
-
Override this method to do anything node-specific (clean properties) at the moment of node being copied.
Expand source code
def sv_copy(self, original): """ Override this method to do anything node-specific (clean properties) at the moment of node being copied. """ pass
def sv_free(self)
-
Override this method to do anything node-specific upon node removal
Expand source code
def sv_free(self): """ Override this method to do anything node-specific upon node removal """ pass
def sv_init(self, context)
-
This method will be called during node creation Typically it is used for socket creating and assigning properties to sockets
Expand source code
def sv_init(self, context): """ This method will be called during node creation Typically it is used for socket creating and assigning properties to sockets """ pass
def sv_new_input(self, socket_type, name, **attrib_dict)
-
Alias of creating and setting socket properties. Example:
self.sv_new_input('SvStringsSocket', "Polygons", hide_safe=True, prop_name='scale_factor')
Expand source code
def sv_new_input(self, socket_type, name, **attrib_dict): """Alias of creating and setting socket properties. Example: ```py self.sv_new_input('SvStringsSocket', "Polygons", hide_safe=True, prop_name='scale_factor') ```""" socket = self.inputs.new(socket_type, name) for att in attrib_dict: setattr(socket, att, attrib_dict[att]) return socket
def sv_update(self)
-
This method can be overridden in inherited classes. It will be triggered upon any
node tree
editor changes (new/copy/delete links/nodes). Calling of this method is unordered among other calls of the method of other nodes in a tree. Typically, it is used to change output socket types dependent on what type is connected to a node.Expand source code
def sv_update(self): """ This method can be overridden in inherited classes. It will be triggered upon any `node tree` editor changes (new/copy/delete links/nodes). Calling of this method is unordered among other calls of the method of other nodes in a tree. Typically, it is used to change output socket types dependent on what type is connected to a node. """ pass
def update(self)
-
The method will be triggered upon editor changes, typically before node tree update method. It calls
UpdateNodes.sv_update()
.⚠️ It checks special flag in the tree of the node. The flag is set by json import module. If the tree has the flag the node skips farther execution of the method. This is done for performance reason and actually there is no reason to execute the method since the import module totally controls building of the tree.
The flag can be set by
SvNodeTreeCommon.init_tree()
.Expand source code
@final def update(self): """ The method will be triggered upon editor changes, typically before node tree update method. It calls `UpdateNodes.sv_update`. ```text ⚠️ It checks special flag in the tree of the node. The flag is set by json import module. If the tree has the flag the node skips farther execution of the method. This is done for performance reason and actually there is no reason to execute the method since the import module totally controls building of the tree. ``` The flag can be set by `SvNodeTreeCommon.init_tree`. """ if 'init_tree' in self.id_data: # tree is building by a script - let it do this return self.sv_update()
def update_interactive_mode(self, context)
-
When
UpdateNodes.is_interactive
mode is on the method updates only outdated nodesExpand source code
def update_interactive_mode(self, context): """When `UpdateNodes.is_interactive` mode is on the method updates only outdated nodes""" if self.is_interactive: self.process_node(context)
def update_ui(self, error=None, update_time=None)
-
This method is intended to use by update system to show node errors in the tree editors space and to show execution time
Expand source code
def update_ui(self, error=None, update_time=None): """This method is intended to use by update system to show node errors in the tree editors space and to show execution time""" sv_settings = bpy.context.preferences.addons[sverchok.__name__].preferences exception_color = sv_settings.exception_color no_data_color = sv_settings.no_data_color error_pref = "error" update_pref = "update_time" # update error colors if error is not None: color = no_data_color if isinstance(error, SvNoDataError) else exception_color self.set_temp_color(color) sv_bgl.draw_text(self, str(error), error_pref + self.node_id, color, 1.3, "UP") else: sv_bgl.callback_disable(error_pref + self.node_id) self.set_temp_color() # show update timing if update_time is not None: update_time = int(update_time * 1000) sv_bgl.draw_text(self, f'{update_time}ms', update_pref + self.node_id, align="UP", dynamic_location=False) else: sv_bgl.callback_disable(update_pref + self.node_id)