Nodes: Panel declarations for grouping sockets #108649

Merged
Lukas Tönne merged 27 commits from LukasTonne/blender:node-socket-categories into main 2023-06-14 18:02:46 +02:00
6 changed files with 17 additions and 2 deletions
Showing only changes of commit 066d40b7b5 - Show all commits

View File

@ -974,6 +974,9 @@ class NODE_PT_socket_panels(Panel):
@classmethod
def poll(cls, context):
if not context.preferences.experimental.use_node_panels:
return False
snode = context.space_data
if snode is None:
return False

View File

@ -2410,6 +2410,7 @@ class USERPREF_PT_experimental_new_features(ExperimentalPanel, Panel):
("blender/blender/projects/10", "Pipeline, Assets & IO Project Page")),
({"property": "use_override_templates"}, ("blender/blender/issues/73318", "Milestone 4")),
({"property": "use_new_volume_nodes"}, ("blender/blender/issues/103248", "#103248")),
({"property": "use_node_panels"}, ("blender/blender/issues/105248", "#105248")),
),
)

View File

@ -3701,6 +3701,10 @@ bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree,
void ntreeEnsureSocketInterfacePanelOrder(bNodeTree *ntree)
{
if (!U.experimental.use_node_panels) {
return;
}
/* Store panel index for sorting. */
blender::Map<const bNodePanel *, int> panel_index_map;
LukasTonne marked this conversation as resolved Outdated

VectorSet and VectorSet::index_of` are probably a more natural choice here, with a bit less boilerplate.

`VectorSet` and VectorSet::index_of` are probably a more natural choice here, with a bit less boilerplate.
int index = 0;

View File

@ -1481,7 +1481,9 @@ static void std_node_socket_interface_draw(bContext * /*C*/, uiLayout *layout, P
uiItemR(col, ptr, "hide_in_modifier", DEFAULT_FLAGS, nullptr, 0);
}
uiItemPointerR(col, ptr, "panel", &tree_ptr, "socket_panels", nullptr, 0);
if (U.experimental.use_node_panels) {
uiItemPointerR(col, ptr, "socket_panel", &tree_ptr, "panels", nullptr, 0);
}
}
static void node_socket_virtual_draw_color(bContext * /*C*/,

View File

@ -680,7 +680,8 @@ typedef struct UserDef_Experimental {
char enable_overlay_next;
char enable_workbench_next;
char use_new_volume_nodes;
char _pad[4];
char use_node_panels;
char _pad[3];
/** `makesdna` does not allow empty structs. */
} UserDef_Experimental;

View File

@ -6742,6 +6742,10 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_new_volume_nodes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
prop, "New Volume Nodes", "Enables visibility of the new Volume nodes in the UI");
prop = RNA_def_property(srna, "use_node_panels", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
prop, "Node Panels", "Enable node panels UI for grouping sockets in node groups");
}
static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)