[Bf-blender-cvs] [05ffe05ebcd] blender-v2.93-release: 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
Mon Jul 26 08:52:30 CEST 2021


Commit: 05ffe05ebcd36688e3f3c178e3797aeffb1eb647
Author: Philipp Oeser
Date:   Tue Jul 20 13:47:45 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB05ffe05ebcd36688e3f3c178e3797aeffb1eb647

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 0c7a2a01b7a..d272e163178 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