[Bf-blender-cvs] [3e29175af38] master: Fix T89982: Geometry Nodes: 'New' Button tries to create node_tree on active modifier, rather than button context

Philipp Oeser noreply at git.blender.org
Tue Jul 20 16:55:33 CEST 2021


Commit: 3e29175af3885434dc97e76c83349be7edff766c
Author: Philipp Oeser
Date:   Tue Jul 20 13:47:45 2021 +0200
Branches: master
https://developer.blender.org/rB3e29175af3885434dc97e76c83349be7edff766c

Fix T89982: Geometry Nodes: 'New' Button tries to create node_tree on active modifier, rather than button context

When done from the Properties Editor, the context's modifier should be
used (this is where the button is located), when done from elsewhere,
the active modifier is still the way to go (since the context modifier is
not available then)

Maniphest Tasks: T89982

Differential Revision: https://developer.blender.org/D11972

===================================================================

M	release/scripts/startup/bl_operators/geometry_nodes.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/geometry_nodes.py b/release/scripts/startup/bl_operators/geometry_nodes.py
index 71ef89a066b..ec2887a1a74 100644
--- a/release/scripts/startup/bl_operators/geometry_nodes.py
+++ b/release/scripts/startup/bl_operators/geometry_nodes.py
@@ -81,7 +81,10 @@ class NewGeometryNodeTreeAssign(Operator):
         return geometry_modifier_poll(context)
 
     def execute(self, context):
-        modifier = context.object.modifiers.active
+        if context.area.type == 'PROPERTIES':
+            modifier = context.modifier
+        else:
+            modifier = context.object.modifiers.active
 
         if not modifier:
             return {'CANCELLED'}



More information about the Bf-blender-cvs mailing list