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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <mail@jlucke.com>2021-07-05 11:54:29 +0300
committerJacques Lucke <mail@jlucke.com>2021-07-05 11:54:29 +0300
commit6a2c44135019377ae124a0b358c8539f64057c11 (patch)
tree073b81b9aec2f6c4a3adbda8d06e190598a1387c
parent6c1a227b3fa329d56bdaf0e4ebd6d72aa92d2bfe (diff)
Node Wrangler: change preview shortcut for geometry nodes
The ctr+shift+LMB was in conflict with the new viewer node introduced in rB9009ac2c3d62e0d30d96b8d35ff5ff620cfe053b. Since the builtin viewer node does not support viewport visualization yet, the operator is still kept in node wrangler. Just the shortcut is changed to shift+alt+LMB. Differential Revision: https://developer.blender.org/D11786
-rw-r--r--node_wrangler.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/node_wrangler.py b/node_wrangler.py
index 118408c4..cf70308b 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -1710,6 +1710,11 @@ class NWPreviewNode(Operator, NWBase):
bl_description = "Connect active node to Emission Shader for shadeless previews, or to the geometry node tree's output"
bl_options = {'REGISTER', 'UNDO'}
+ # If false, the operator is not executed if the current node group happens to be a geometry nodes group.
+ # This is needed because geometry nodes has its own viewer node that uses the same shortcut as in the compositor.
+ # Geometry Nodes support can be removed here once the viewer node is supported in the viewport.
+ run_in_geometry_nodes: BoolProperty(default=True)
+
def __init__(self):
self.shader_output_type = ""
self.shader_output_ident = ""
@@ -1864,6 +1869,10 @@ class NWPreviewNode(Operator, NWBase):
def invoke(self, context, event):
space = context.space_data
+ # Ignore operator when running in wrong context.
+ if self.run_in_geometry_nodes != (space.tree_type == "GeometryNodeTree"):
+ return {'PASS_THROUGH'}
+
shader_type = space.shader_type
self.init_shader_variables(space, shader_type)
shader_types = [x[1] for x in shaders_shader_nodes_props]
@@ -5206,7 +5215,8 @@ kmi_defs = (
# Swap Outputs
(NWSwapLinks.bl_idname, 'S', 'PRESS', False, False, True, None, "Swap Outputs"),
# Preview Node
- (NWPreviewNode.bl_idname, 'LEFTMOUSE', 'PRESS', True, True, False, None, "Preview node output"),
+ (NWPreviewNode.bl_idname, 'LEFTMOUSE', 'PRESS', True, True, False, (('run_in_geometry_nodes', False),), "Preview node output"),
+ (NWPreviewNode.bl_idname, 'LEFTMOUSE', 'PRESS', False, True, True, (('run_in_geometry_nodes', True),), "Preview node output"),
# Reload Images
(NWReloadImages.bl_idname, 'R', 'PRESS', False, False, True, None, "Reload images"),
# Lazy Mix