Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-07-05 11:46:00 +0300
committerJacques Lucke <jacques@blender.org>2021-07-05 11:46:36 +0300
commit9009ac2c3d62e0d30d96b8d35ff5ff620cfe053b (patch)
treeb5b25b36ed769fcdc707aa4d6efd1146fb54621d /release/scripts/startup
parent04313f1bb5ff89168099cdc03d1855ae5118d29c (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')
-rw-r--r--release/scripts/startup/bl_operators/node.py62
-rw-r--r--release/scripts/startup/bl_operators/spreadsheet.py13
-rw-r--r--release/scripts/startup/bl_ui/space_spreadsheet.py3
-rw-r--r--release/scripts/startup/nodeitems_builtins.py3
4 files changed, 7 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 = []
diff --git a/release/scripts/startup/bl_ui/space_spreadsheet.py b/release/scripts/startup/bl_ui/space_spreadsheet.py
index 178be9ef0b7..ad696f23db4 100644
--- a/release/scripts/startup/bl_ui/space_spreadsheet.py
+++ b/release/scripts/startup/bl_ui/space_spreadsheet.py
@@ -54,6 +54,9 @@ class SPREADSHEET_HT_header(bpy.types.Header):
pin_icon = 'PINNED' if space.is_pinned else 'UNPINNED'
layout.operator("spreadsheet.toggle_pin", text="", icon=pin_icon, emboss=False)
+ if space.object_eval_state == 'VIEWER_NODE' and len(context_path) < 3:
+ layout.label(text="No active viewer node.", icon='INFO')
+
layout.separator_spacer()
row = layout.row(align=True)
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index c85d7a9db04..4a7d34f1b69 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -581,6 +581,9 @@ geometry_node_categories = [
NodeItem("ShaderNodeVectorMath"),
NodeItem("ShaderNodeVectorRotate"),
]),
+ GeometryNodeCategory("GEO_OUTPUT", "Output", items=[
+ NodeItem("GeometryNodeViewer"),
+ ]),
GeometryNodeCategory("GEO_VOLUME", "Volume", items=[
NodeItem("GeometryNodePointsToVolume"),
NodeItem("GeometryNodeVolumeToMesh"),