Shading Nodes: Refactor Add menu #111798

Merged
Pablo Vazquez merged 2 commits from pablovazquez/blender:ui-nodes-shading-menu-refactor into main 2023-09-01 20:46:19 +02:00
Member

Refactor the Add menu in Shading nodes, with manually created menus,
inspired by Geometry Nodes and more recently the Compositor.

Minor sorting adjustments by splitting categories in groups, with
separators in between groups, and sorted alphabetically. Shading
node group assets are also populated in the menus.

Before After
before after

This is the first part of the re-organization of the Add menu project,
proposal for which categories and organization coming in another
patch after this.

This patch also:

  • Move the Layout menu to a more generic bit that can be shared
    with Geometry Nodes and the Compositor.
  • Add a poll to add_node_type so nodes show up by mode
    or render engine.

Part of #111746

Refactor the Add menu in Shading nodes, with manually created menus, inspired by Geometry Nodes and more recently the Compositor. Minor sorting adjustments by splitting categories in groups, with separators in between groups, and sorted alphabetically. Shading node group assets are also populated in the menus. |Before|After| |----|----| |![before](/attachments/1351f636-8f17-44de-90bc-6ba9165996ae)|![after](/attachments/52809de8-ae0d-4c30-baab-f270a4839176)| This is the first part of the re-organization of the Add menu project, proposal for which categories and organization coming in another patch after this. This patch also: * Move the Layout menu to a more generic bit that can be shared with Geometry Nodes and the Compositor. * Add a poll to add_node_type so nodes show up by mode or render engine. Part of #111746
Pablo Vazquez added the
Interest
Render & Cycles
Module
User Interface
labels 2023-09-01 18:44:19 +02:00
Pablo Vazquez added 1 commit 2023-09-01 18:44:33 +02:00
Refactor the Add menu in Shading nodes, with manually created menus,
inspired by Geometry Nodes and more recently the Compositor.

Minor sorting adjustments by splitting categories in groups, with
separators in between groups, and sorted alphabetically. Shading
node group assets are also populated in the menus.

This is the first part of the re-organization of the Add menu project,
proposal coming in another patch after this.

This patch also:
* Move the Layout menu to a more generic bit that can be shared
  with Geometry Nodes and the Compositor.
* Add a poll to add_node_type so nodes show up or not by mode
  or render engine.

Part of #111746
Pablo Vazquez added this to the User Interface project 2023-09-01 18:45:03 +02:00
Hans Goudey reviewed 2023-09-01 18:54:33 +02:00
Hans Goudey left a comment
Member

What do you think about just using if statements like if context.space_data.geometry_nodes_type == 'TOOL': rather than passing the poll? I guess that takes up more lines, but it seems a bit simpler?

What do you think about just using if statements like `if context.space_data.geometry_nodes_type == 'TOOL':` rather than passing the poll? I guess that takes up more lines, but it seems a bit simpler?
@ -71,7 +75,19 @@ def add_repeat_zone(layout, label):
return props
class NODE_MT_category_LAYOUT(Menu):
Member

NODE_MT_category_LAYOUT -> NODE_MT_category_layout. The only reason for the caps was to use the same menu idnames as before the refactor. Since this is different that doesn't matter anymore.

`NODE_MT_category_LAYOUT` -> `NODE_MT_category_layout`. The only reason for the caps was to use the same menu idnames as before the refactor. Since this is different that doesn't matter anymore.
pablovazquez marked this conversation as resolved
Contributor

Is Group menu being removed? It is a nice way to see all group nodes that are loaded in the blend file, I'd keep it. Also I never understood separate menu for Script, it's one of the least used nodes and just takes up space, when it can be in Input since technically that's what it is, it has no sockets on it's own

Is Group menu being removed? It is a nice way to see all group nodes that are loaded in the blend file, I'd keep it. Also I never understood separate menu for Script, it's one of the least used nodes and just takes up space, when it can be in Input since technically that's what it is, it has no sockets on it's own

can be in Input since technically that's what it is, it has no sockets

You can customize it however you like, so it's not an input. It's more like a group, but it's still better to leave it alone at the top menu level.

> can be in Input since technically that's what it is, it has no sockets You can customize it however you like, so it's not an input. It's more like a group, but it's still better to leave it alone at the top menu level.
Pablo Vazquez added 1 commit 2023-09-01 20:32:32 +02:00
* Use lowercase for layout category name.
* Add Group category
Author
Member

Is Group menu being removed?

Oops. Oversight from my side. I updated the patch with a dedicated menu for shading nodes, but I think once all menus are refactored, we should share the same menu with all. Just like I did with Layout now.

I never understood separate menu for Script

This patch is meant just as a refactor, using the same categories as they are currently. A separate patch will take care of re-organization.

> Is Group menu being removed? Oops. Oversight from my side. I updated the patch with a dedicated menu for shading nodes, but I think once all menus are refactored, we should share the same menu with all. Just like I did with Layout now. > I never understood separate menu for Script This patch is meant just as a refactor, using the same categories as they are currently. A separate patch will take care of re-organization.
Author
Member

What do you think about just using if statements like if context.space_data.geometry_nodes_type == 'TOOL': rather than passing the poll? I guess that takes up more lines, but it seems a bit simpler?

I had it that way when I started but quickly ended up having way too many checks, which, if we want to sort nodes alphabetically, ends up in so much repetition because some nodes check for specific engines (or a combination of them), or object types (lights or objects that support materials).

Since the polls were already in place in nodeitems_builtins.py I thought of reusing that.

> What do you think about just using if statements like `if context.space_data.geometry_nodes_type == 'TOOL':` rather than passing the poll? I guess that takes up more lines, but it seems a bit simpler? I had it that way when I started but quickly ended up having way too many checks, which, if we want to sort nodes alphabetically, ends up in so much repetition because some nodes check for specific engines (or a combination of them), or object types (lights or objects that support materials). Since the polls were already in place in `nodeitems_builtins.py` I thought of reusing that.
Hans Goudey approved these changes 2023-09-01 20:40:34 +02:00
Pablo Vazquez merged commit 9db4c0ca4b into main 2023-09-01 20:46:19 +02:00
Pablo Vazquez deleted branch ui-nodes-shading-menu-refactor 2023-09-01 20:46:20 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#111798
No description provided.