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

27 Commits

Author SHA1 Message Date
Lukas Tönne 581b462642 Merge branch 'main' into node-socket-categories
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-14 17:22:15 +02:00
Lukas Tönne e66992a7b2 Replace Map with VectorSet for cleaner sorting code.
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-13 12:41:44 +02:00
Lukas Tönne ab52f3e5b1 Make panels() span accessor use const bNodePanel. 2023-06-13 12:41:08 +02:00
Lukas Tönne 5e1c8395c9 Cleanup: Rename python classes to use "panel" instead "socket_panel". 2023-06-12 11:53:16 +02:00
Lukas Tönne 26c1d070b5 Fix naming of "panel"/"panels" properties. 2023-06-12 10:52:03 +02:00
Lukas Tönne 066d40b7b5 Experimental flag to hide node panels and their effects for now. 2023-06-12 10:49:51 +02:00
Lukas Tönne e42ff76e92 Merge branch 'main' into node-socket-categories 2023-06-12 10:27:52 +02:00
Lukas Tönne 63244d616d Cleanup: clang format. 2023-06-09 16:54:35 +02:00
Lukas Tönne f9003d386b Renamed bNodeSocketPanel to just bNodePanel.
While sockets will be the first thing to populate such panels there can
be other things in future that go into them.
2023-06-09 16:28:11 +02:00
Lukas Tönne de64025766 Merge branch 'main' into node-socket-categories 2023-06-09 15:56:38 +02:00
Lukas Tönne 57f33fe531 Added missing copy and free code for socket panels in node trees. 2023-06-09 10:57:42 +02:00
Lukas Tönne 397e9f83a7 Remove the panel identifier, it's no longer needed. 2023-06-08 18:17:48 +02:00
Lukas Tönne 661be297f0 Replace panel_id in node tree interface sockets with a simple pointer. 2023-06-08 18:11:31 +02:00
Lukas Tönne ab0d8761d2 Use array of pointers for node panels instead plain array.
This has the advantage that pointers to panel declarations remain valid
after most panel API functions. This is important for python scripting
where a panel is referenced by pointer internally.
2023-06-08 16:55:32 +02:00
Lukas Tönne 48d9028fda Revert "Switch from arrays to ListBase for the categories in node trees."
This reverts commit 284a6bd094.
2023-06-08 14:12:04 +02:00
Lukas Tönne 284a6bd094 Switch from arrays to ListBase for the categories in node trees. 2023-06-08 13:03:45 +02:00
Lukas Tönne 3d1aae86c5 Merge branch 'main' into node-socket-categories 2023-06-08 11:51:17 +02:00
Lukas Tönne f172423441 Cleanup: Rename "category" to "panel". 2023-06-08 11:33:46 +02:00
Lukas Tönne 7b28d4c3f4 Merge branch 'main' into node-socket-categories 2023-06-08 10:28:35 +02:00
Lukas Tönne 4f0b237e50 Cleanup: remove some newlines. 2023-06-07 11:10:58 +02:00
Lukas Tönne 530678fc8d Use std::copy for category add/remove/move methods. 2023-06-07 11:07:43 +02:00
Lukas Tönne df7713dcfc Use __func__ for MEM_malloc strings. 2023-06-06 18:36:26 +02:00
Lukas Tönne d7aa257d2d Cleanup: comment style fixes. 2023-06-06 18:34:12 +02:00
Lukas Tönne c7ab5dc068 Added a `category_id` identifier for stable Panel<->category relations.
Instead of just an index, we now use the category_id to specify the
category of a socket as well as associating a panel with a category.
This has two consequences:
1. No need to remap indices after adding/removing/moving a category.
    Flip side is that finding the category of a socket now requires a
    linear search. In future this could be more efficient using a map,
    but that is a separate task.
2. Now the panel open/closed state bits are associated with a stable
    identifier, so panels will retain their state when moving.
2023-06-06 17:14:08 +02:00
Lukas Tönne 5bf853f3aa Removed unused variable. 2023-06-06 12:18:54 +02:00
Lukas Tönne 5c8233edb3 Removed unnecessary range check of unsigned integer variable. 2023-06-06 11:25:18 +02:00
Lukas Tönne 909430f5dc Category declarations in node trees for organizing modifier UI.
Adds an optional list of "categories" to node trees. Each socket can be
assigned a category. Sub-panels will be created in the future for these
categories (TODO).

Sockets of the same category will remain together even when adding,
removing, or moving sockets or categories, renaming, etc.
A socket can be moved up or down within a category but each category
remains a contiguous block. Actual tree views may be created later.
2023-06-06 11:10:41 +02:00