ee14c4aa34d7ecd5c4a4ae490ec24d9f0010e711
Node groups already have panels, but they modify the node declaration
directly, which is not something we want to do for builtin nodes. For
those the `PanelDeclarationBuilder` should be used.
`PanelDeclarationBuilder` has `add_input`/`add_output` methods just like `NodeDeclarationBuilder`. Adding sockets to a panel increases its size by one. All sockets must be added in order: Adding sockets or panels to the root `NodeDeclarationBuilder` after a panel will complete the panel and adding more sockets to it after that will fail. This is to enforce a stable item order where indices don't change after adding a socket, which is important for things like field dependencies.
Example:
```cpp
static void node_declare(NodeDeclarationBuilder &b)
{
// Currently this is necessary to enable custom layouts and panels.
// Will go away eventually when most nodes uses custom layout.
b.use_custom_socket_order();
// Create a panel.
PanelDeclarationBuilder &pb = b.add_panel("My Panel").description("A demo panel").default_closed(true);
// Add to the panel instead of the root layout.
pb.add_input<decl::Color>("Color").default_value({0.8f, 0.8f, 0.8f, 1.0f});
pb.add_input<decl::Float>("Weight").unavailable();
// Continue socket declarations as usual.
b.add_output<decl::Shader>("BSDF");
// !!! Warning: continuing the panel after other items is not allowed and will show an error.
pb.add_output<decl::Float>("Bad Socket");
}
```
Pull Request: https://projects.blender.org/blender/blender/pulls/111695
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
