Node panels: RNA for node group interfaces #110952
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#110952
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "LukasTonne/blender:node-panels-rna"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part 2/3 of #109135, #110272
Defines the RNA API for the new node tree interfaces.
The bulk of the RNA definition lives in
rna_node_tree_interface.cc
. The legacy socket interfaces remain in place and will be removed later.Since the socket items share the
bNodeSocketValueXXX
structs with thebNodeSocket
types they also use the same RNA. Therna_def_node_socket_interface_subtypes
function is exposed so that when defining the interface RNA it can use the same code as the regular socket RNA.@ -50,6 +50,7 @@ const EnumPropertyItem *rna_node_tree_type_itemf(void *data,
bool (*poll)(void *data, struct bNodeTreeType *),
bool *r_free);
int rna_node_socket_idname_to_enum(const char *idname);
This was removed in an earlier commit, but interfaces use it to create selectable socket type buttons. The previous interface implementation used an operator with its own enum for this purpose, but the new interface can do this with a regular property.
@ -561,2 +563,3 @@
/* ******** Node Socket Subtypes ******** */
static void rna_NodeSocketStandard_float_range(
void rna_NodeSocketStandard_float_range(
The interface definition uses the same range callbacks as node sockets, but gets defined in a different compilation unit, so they need to be exposed.
Generally seems okay. I think I might have been misreading some of the diff, since you mentioned in the description that you were keeping the old interface RNA definitions temporarily. But I guess it wasn't clear which parts you want to keep or remove long term.
@ -4727,6 +4727,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_nla.cc", nullptr, RNA_def_nla},
{"rna_nodetree.cc", nullptr, RNA_def_nodetree},
{"rna_node_socket.cc", nullptr, RNA_def_node_socket_subtypes},
{"rna_node_tree_interface.cc", NULL, RNA_def_node_tree_interface},
nullptr
@ -942,0 +992,4 @@
func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
RNA_def_function_output(func, parm);
/* XXX Legacy socket interface, this will be removed. */
It's a bit confusing reading "legacy, will be removed" in new code in a PR for a system that's replacing the old interface-- is this comment still relevant? Maybe a chance to do it right or remove deprecated methods? Am I missing something?
Yeah, splitting up PRs can get a bit confusing, i'm replacing the comment with
Reason this shows up as "new code" is that i've moved the final socket subtypes definitions. Previously
rna_def_node_socket_standard_types
included both theNodeSocketInterfaceStandard
base struct and the final types (NodeSocketFloatUnsigned
etc.).Final types are now defined in
rna_def_node_socket_subtypes
, and a similar functionrna_def_node_socket_interface_subtypes
is called for defining the respective interface structs.@ -1681,0 +2014,4 @@
const char *label;
};
/* XXX would like to have this in BKE and base all the subtype stuff (nodeStaticSocketType***)
I'd rephrase this comment as a "note" or something, or change it in this PR. Or maybe you had a different plan
@ -1681,0 +2018,4 @@
* on the same central list instead of repeating the same switch statements everywhere.
* But makesrna cannot have a dependency on BKE, so this list would have to live in RNA itself,
* with BKE etc. accessing the RNA API to get the subtypes info. */
static blender::Span<bNodeSocketStaticTypeInfo> nodeSocketStaticTypeInfo()
Might be nice to use snake_case here like most other "new" functions
@ -1681,0 +2020,4 @@
* with BKE etc. accessing the RNA API to get the subtypes info. */
static blender::Span<bNodeSocketStaticTypeInfo> nodeSocketStaticTypeInfo()
{
static const blender::Array<bNodeSocketStaticTypeInfo> node_socket_subtypes = {
I think
std::array
is generally preferred for static arrays since it doesn't allocate or store the sizeUsing a simple
static const bNodeSocketStaticTypeInfo node_socket_subtypes[]
now.TIL C++ range-based loops actually also work for such plain arrays :)
https://stackoverflow.com/questions/7939399/how-does-the-range-based-for-work-for-plain-arrays
@blender-bot build
I find the way this is split from the other change confusing, with old code looking new in the diff, and new code commented out. But I don't have a good enough understanding to suggest a better way to organize things, and the next step will come soon anyway I suppose.
Only idea I'd have is possibly removing or re-adding some code in a separate commit.
@ -0,0 +32,4 @@
# include "WM_api.hh"
/* Internal RNA function declarations, used to invoke registered callbacks. */
extern "C" {
Do these have to be declared with "extern C" still?
Correct, this
extern "C"
doesn't seem to be needed any more. makesrna generates .cc files now with regular C++ linkage for these functions (and for some reason declares these functions asextern
but defines them in the same file anyway). Nodes RNA seems to be the last place using extern "C" declarations for registerable function implementations, will fix those. It probably works either way because these are free functions at root namespace level.@ -0,0 +59,4 @@
if (socket_typeinfo && socket_typeinfo->ext_interface.srna) {
return socket_typeinfo->ext_interface.srna;
}
else {
else after return
extern "C"
from RNA function declarations. 8f3a01b9cf@blender-bot build
@blender-bot build