Commit: d4e638baac4352f022f89c6d189f7e7ee46eb073
Author: Dalai Felinto
Date:   Mon Jan 9 18:09:22 2023 +0100
Branches: master
https://developer.blender.org/rBd4e638baac4352f022f89c6d189f7e7ee46eb073

User Interface: Re-organization of Geometry Nodes Add Node Menu

The menus are growing too large. This patches move some categories under
sub-menus, and shuffle some entries around.

We already had sub-categories split by separators. This change now
goes a step further and embrace 3-level menus.

Inspired by the "Simpler Add Menu" add-on by Quackers (waiting to hear
back to know Quackers real name).

Inspired by the "Simpler Add Menu" add-on by Alfonso Martinez II.

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

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

M       release/scripts/startup/bl_ui/node_add_menu_geometry.py

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

diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py 
b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
index cc5f210e536..f86601da88c 100644
--- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py
+++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
@@ -12,9 +12,10 @@ class NODE_MT_geometry_node_GEO_ATTRIBUTE(Menu):
     def draw(self, _context):
         layout = self.layout
         node_add_menu.add_node_type(layout, "GeometryNodeAttributeStatistic")
+        node_add_menu.add_node_type(layout, "GeometryNodeAttributeDomainSize")
+        layout.separator()
         node_add_menu.add_node_type(layout, "GeometryNodeBlurAttribute")
         node_add_menu.add_node_type(layout, "GeometryNodeCaptureAttribute")
-        node_add_menu.add_node_type(layout, "GeometryNodeAttributeDomainSize")
         node_add_menu.add_node_type(layout, "GeometryNodeRemoveAttribute")
         node_add_menu.add_node_type(layout, "GeometryNodeStoreNamedAttribute")
         node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
@@ -27,12 +28,13 @@ class NODE_MT_geometry_node_GEO_COLOR(Menu):
     def draw(self, _context):
         layout = self.layout
         node_add_menu.add_node_type(layout, "ShaderNodeValToRGB")
+        node_add_menu.add_node_type(layout, "ShaderNodeRGBCurve")
+        layout.separator()
         node_add_menu.add_node_type(layout, "FunctionNodeCombineColor")
         props = node_add_menu.add_node_type(layout, "ShaderNodeMix", 
label=iface_("Mix Color"))
         ops = props.settings.add()
         ops.name = "data_type"
         ops.value = "'RGBA'"
-        node_add_menu.add_node_type(layout, "ShaderNodeRGBCurve")
         node_add_menu.add_node_type(layout, "FunctionNodeSeparateColor")
         node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
 
@@ -43,19 +45,23 @@ class NODE_MT_geometry_node_GEO_CURVE(Menu):
 
     def draw(self, _context):
         layout = self.layout
-        node_add_menu.add_node_type(layout, "GeometryNodeCurveLength")
-        node_add_menu.add_node_type(layout, "GeometryNodeCurveToMesh")
-        node_add_menu.add_node_type(layout, "GeometryNodeCurveToPoints")
-        node_add_menu.add_node_type(layout, 
"GeometryNodeDeformCurvesOnSurface")
-        node_add_menu.add_node_type(layout, "GeometryNodeFillCurve")
-        node_add_menu.add_node_type(layout, "GeometryNodeFilletCurve")
-        node_add_menu.add_node_type(layout, "GeometryNodeResampleCurve")
-        node_add_menu.add_node_type(layout, "GeometryNodeReverseCurve")
-        node_add_menu.add_node_type(layout, "GeometryNodeSampleCurve")
-        node_add_menu.add_node_type(layout, "GeometryNodeSubdivideCurve")
-        node_add_menu.add_node_type(layout, "GeometryNodeTrimCurve")
+        layout.menu("NODE_MT_geometry_node_GEO_CURVE_READ")
+        layout.menu("NODE_MT_geometry_node_GEO_CURVE_WRITE")
         layout.separator()
+        layout.menu("NODE_MT_geometry_node_GEO_CURVE_OPERATIONS")
+        layout.menu("NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE")
+        layout.menu("NODE_MT_geometry_node_curve_topology")
+        node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
+
+
+class NODE_MT_geometry_node_GEO_CURVE_READ(Menu):
+    bl_idname = "NODE_MT_geometry_node_GEO_CURVE_READ"
+    bl_label = "Read"
+
+    def draw(self, _context):
+        layout = self.layout
         node_add_menu.add_node_type(layout, 
"GeometryNodeInputCurveHandlePositions")
+        node_add_menu.add_node_type(layout, "GeometryNodeCurveLength")
         node_add_menu.add_node_type(layout, "GeometryNodeInputTangent")
         node_add_menu.add_node_type(layout, "GeometryNodeInputCurveTilt")
         node_add_menu.add_node_type(layout, 
"GeometryNodeCurveEndpointSelection")
@@ -64,7 +70,14 @@ class NODE_MT_geometry_node_GEO_CURVE(Menu):
         node_add_menu.add_node_type(layout, "GeometryNodeSplineLength")
         node_add_menu.add_node_type(layout, "GeometryNodeSplineParameter")
         node_add_menu.add_node_type(layout, 
"GeometryNodeInputSplineResolution")
-        layout.separator()
+        node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
+
+class NODE_MT_geometry_node_GEO_CURVE_WRITE(Menu):
+    bl_idname = "NODE_MT_geometry_node_GEO_CURVE_WRITE"
+    bl_label = "Write"
+
+    def draw(self, _context):
+        layout = self.layout
         node_add_menu.add_node_type(layout, "GeometryNodeSetCurveNormal")
         node_add_menu.add_node_type(layout, "GeometryNodeSetCurveRadius")
         node_add_menu.add_node_type(layout, "GeometryNodeSetCurveTilt")
@@ -76,9 +89,28 @@ class NODE_MT_geometry_node_GEO_CURVE(Menu):
         node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
 
 
+class NODE_MT_geometry_node_GEO_CURVE_OPERATIONS(Menu):
+    bl_idname = "NODE_MT_geometry_node_GEO_CURVE_OPERATIONS"
+    bl_label = "Operations"
+
+    def draw(self, _context):
+        layout = self.layout
+        node_add_menu.add_node_type(layout, "GeometryNodeCurveToMesh")
+        node_add_menu.add_node_type(layout, "GeometryNodeCurveToPoints")
+        node_add_menu.add_node_type(layout, 
"GeometryNodeDeformCurvesOnSurface")
+        node_add_menu.add_node_type(layout, "GeometryNodeFillCurve")
+        node_add_menu.add_node_type(layout, "GeometryNodeFilletCurve")
+        node_add_menu.add_node_type(layout, "GeometryNodeResampleCurve")
+        node_add_menu.add_node_type(layout, "GeometryNodeReverseCurve")
+        node_add_menu.add_node_type(layout, "GeometryNodeSampleCurve")
+        node_add_menu.add_node_type(layout, "GeometryNodeSubdivideCurve")
+        node_add_menu.add_node_type(layout, "GeometryNodeTrimCurve")
+        node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
+
+
 class NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE(Menu):
     bl_idname = "NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE"
-    bl_label = "Curve Primitives"
+    bl_label = "Primitives"
 
     def draw(self, _context):
         layout = self.layout
@@ -95,7 +127,7 @@ class NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE(Menu):
 
 class NODE_MT_geometry_node_curve_topology(Menu):
     bl_idname = "NODE_MT_geometry_node_curve_topology"
-    bl_label = "Curve Topology"
+    bl_label = "Topology"
 
     def draw(self, _context):
         layout = self.layout
@@ -109,25 +141,69 @@ class NODE_MT_geometry_node_GEO_GEOMETRY(Menu):
     bl_idname = "NODE_MT_geometry_node_GEO_GEOMETRY"
     bl_label = "Geometry"
 
+    def draw(self, _context):
+        layout = self.layout
+        layout.menu("NODE_MT_geometry_node_GEO_GEOMETRY_READ")
+        layout.menu("NODE_MT_geometry_node_GEO_GEOMETRY_WRITE")
+        layout.menu("NODE_MT_geometry_node_GEO_GEOMETRY_OPERATIONS")
+        layout.menu("NODE_MT_geometry_node_GEO_GEOMETRY_SAMPLE")
+        layout.separator()
+        node_add_menu.add_node_type(layout, "GeometryNodeJoinGeometry")
+        node_add_menu.add_node_type(layout, "GeometryNodeGeometryToInstance")
+        node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
+
+class NODE_MT_geometry_node_GEO_GEOMETRY_READ(Menu):
+    bl_idname = "NODE_MT_geometry_node_GEO_GEOMETRY_READ"
+    bl_label = "Read"
+
+    def draw(self, _context):
+        layout = self.layout
+        node_add_menu.add_node_type(layout, "GeometryNodeInputID")
+        node_add_menu.add_node_type(layout, "GeometryNodeInputIndex")
+        node_add_menu.add_node_type(layout, "GeometryNodeInputNamedAttribute")
+        node_add_menu.add_node_type(layout, "GeometryNodeInputNormal")
+        node_add_menu.add_node_type(layout, "GeometryNodeInputPosition")
+        node_add_menu.add_node_type(layout, "GeometryNodeInputRadius")
+        node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
+
+
+class NODE_MT_geometry_node_GEO_GEOMETRY_WRITE(Menu):
+    bl_idname = "NODE_MT_geometry_node_GEO_GEOMETRY_WRITE"
+    bl_label = "Write"
+
+    def draw(self, _context):
+        layout = self.layout
+        node_add_menu.add_node_type(layout, "GeometryNodeSetID")
+        node_add_menu.add_node_type(layout, "GeometryNodeSetPosition")
+        node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
+
+class NODE_MT_geometry_node_GEO_GEOMETRY_OPERATIONS(Menu):
+    bl_idname = "NODE_MT_geometry_node_GEO_GEOMETRY_OPERATIONS"
+    bl_label = "Operations"
+
     def draw(self, _context):
         layout = self.layout
         node_add_menu.add_node_type(layout, "GeometryNodeBoundBox")
         node_add_menu.add_node_type(layout, "GeometryNodeConvexHull")
         node_add_menu.add_node_type(layout, "GeometryNodeDeleteGeometry")
         node_add_menu.add_node_type(layout, "GeometryNodeDuplicateElements")
-        node_add_menu.add_node_type(layout, "GeometryNodeProximity")
-        node_add_menu.add_node_type(layout, "GeometryNodeGeometryToInstance")
-        node_add_menu.add_node_type(layout, "GeometryNodeJoinGeometry")
         node_add_menu.add_node_type(layout, "GeometryNodeMergeByDistance")
+        node_add_menu.add_node_type(layout, "GeometryNodeTransform")
+        layout.separator()
+        node_add_menu.add_node_type(layout, "GeometryNodeSeparateComponents")
+        node_add_menu.add_node_type(layout, "GeometryNodeSeparateGeometry")
+        node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
+
+class NODE_MT_geometry_node_GEO_GEOMETRY_SAMPLE(Menu):
+    bl_idname = "NODE_MT_geometry_node_GEO_GEOMETRY_SAMPLE"
+    bl_label = "Sample"
+
+    def draw(self, _context):
+        layout = self.layout
+        node_add_menu.add_node_type(layout, "GeometryNodeProximity")
         node_add_menu.add_node_type(layout, "GeometryNodeRaycast")
         node_add_menu.add_node_type(layout, "GeometryNodeSampleIndex")
         node_add_menu.add_node_type(layout, "GeometryNodeSampleNearest")
-        node_add_menu.add_node_type(layout, "GeometryNodeSeparateComponents")
-        node_add_menu.add_node_type(layout, "GeometryNodeSeparateGeometry")
-        node_add_menu.add_node_type(layout, "GeometryNodeTransform")
-        layout.separator()
-        node_add_menu.add_node_type(layout, "GeometryNodeSetID")
-        node_add_menu.add_node_type(layout, "GeometryNodeSetPosition")
         node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
 
 
@@ -135

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to