diff options
author | Jacques Lucke <jacques@blender.org> | 2021-07-05 11:46:00 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-07-05 11:46:36 +0300 |
commit | 9009ac2c3d62e0d30d96b8d35ff5ff620cfe053b (patch) | |
tree | b5b25b36ed769fcdc707aa4d6efd1146fb54621d /release/scripts/startup/bl_operators | |
parent | 04313f1bb5ff89168099cdc03d1855ae5118d29c (diff) |
Geometry Nodes: new Viewer node
This adds a viewer node similar to the one in the compositor.
The icon in the headers of nodes is removed because it served
the same purpose and is not necessary anymore.
Node outputs can be connected to the active viewer using
ctrl+shift+LMB, just like in the compositor. Right now this collides
with the shortcut used in the node wrangler addon, which will
be changed separately.
As of now, the viewed geometry is only visible in the spreadsheet.
Viewport visualization will be added separately.
There are a couple of benefits of using a viewer node compared
to the old approach with the icon in the node header:
* Better support for nodes that have more than one geometry output.
* It's more consistent with the compositor.
* If attributes become decoupled from geometry in the future,
the viewer can have a separate input for the attribute to visualize.
* The viewer node could potentially have visualization settings.
* Allows to keep "visualization points" around by having multiple
viewer nodes.
* Less visual clutter in node headers.
Differential Revision: https://developer.blender.org/D11470
Diffstat (limited to 'release/scripts/startup/bl_operators')
-rw-r--r-- | release/scripts/startup/bl_operators/node.py | 62 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/spreadsheet.py | 13 |
2 files changed, 1 insertions, 74 deletions
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index 3cefaf6929b..2959232fa51 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -306,67 +306,6 @@ class NODE_OT_tree_path_parent(Operator): return {'FINISHED'} -class NODE_OT_active_preview_toggle(Operator): - '''Toggle active preview state of node''' - bl_idname = "node.active_preview_toggle" - bl_label = "Toggle Active Preview" - bl_options = {'REGISTER', 'UNDO'} - - @classmethod - def poll(cls, context): - space = context.space_data - if space is None: - return False - if space.type != 'NODE_EDITOR': - return False - if space.edit_tree is None: - return False - if space.edit_tree.nodes.active is None: - return False - return True - - def execute(self, context): - node_editor = context.space_data - ntree = node_editor.edit_tree - active_node = ntree.nodes.active - - if active_node.active_preview: - self._disable_preview(context, active_node) - else: - self._enable_preview(context, node_editor, ntree, active_node) - - return {'FINISHED'} - - @classmethod - def _enable_preview(cls, context, node_editor, ntree, active_node): - spreadsheets = cls._find_unpinned_spreadsheets(context) - - for spreadsheet in spreadsheets: - spreadsheet.set_geometry_node_context(node_editor, active_node) - - for node in ntree.nodes: - node.active_preview = False - active_node.active_preview = True - - @classmethod - def _disable_preview(cls, context, active_node): - spreadsheets = cls._find_unpinned_spreadsheets(context) - for spreadsheet in spreadsheets: - spreadsheet.context_path.clear() - - active_node.active_preview = False - - @staticmethod - def _find_unpinned_spreadsheets(context): - spreadsheets = [] - for window in context.window_manager.windows: - for area in window.screen.areas: - space = area.spaces.active - if space.type == 'SPREADSHEET' and not space.is_pinned: - spreadsheets.append(space) - return spreadsheets - - classes = ( NodeSetting, @@ -375,5 +314,4 @@ classes = ( NODE_OT_add_search, NODE_OT_collapse_hide_unused_toggle, NODE_OT_tree_path_parent, - NODE_OT_active_preview_toggle, ) diff --git a/release/scripts/startup/bl_operators/spreadsheet.py b/release/scripts/startup/bl_operators/spreadsheet.py index 5cc83d4eddd..1907a69a3d3 100644 --- a/release/scripts/startup/bl_operators/spreadsheet.py +++ b/release/scripts/startup/bl_operators/spreadsheet.py @@ -47,18 +47,7 @@ class SPREADSHEET_OT_toggle_pin(Operator): def unpin(self, context): space = context.space_data space.is_pinned = False - - space.context_path.clear() - - # Try to find a node with an active preview in any open editor. - if space.object_eval_state == 'EVALUATED': - node_editors = self.find_geometry_node_editors(context) - for node_editor in node_editors: - ntree = node_editor.edit_tree - for node in ntree.nodes: - if node.active_preview: - space.set_geometry_node_context(node_editor, node) - return + space.context_path.guess() def find_geometry_node_editors(self, context): editors = [] |