Cleanup: avoid using NOD_static_types.h for creating the node.type enum #110810
|
@ -238,6 +238,8 @@ typedef struct bNodeType {
|
|||
char ui_name[64]; /* MAX_NAME */
|
||||
char ui_description[256];
|
||||
int ui_icon;
|
||||
/** Should usually use the idname instead, but this enum type is still exposed in Python. */
|
||||
const char *enum_name_legacy;
|
||||
|
||||
float width, minwidth, maxwidth;
|
||||
float height, minheight, maxheight;
|
||||
|
|
|
@ -4503,6 +4503,8 @@ void node_type_base(bNodeType *ntype, const int type, const char *name, const sh
|
|||
ntype->rna_ext.srna = RNA_struct_find(#Category #StructName); \
|
||||
BLI_assert(ntype->rna_ext.srna != nullptr); \
|
||||
RNA_struct_blender_type_set(ntype->rna_ext.srna, ntype); \
|
||||
ntype->enum_name_legacy = EnumName; \
|
||||
STRNCPY(ntype->ui_description, UIDesc); \
|
||||
break;
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -784,17 +784,19 @@ static const EnumPropertyItem *rna_node_static_type_itemf(bContext * /*C*/,
|
|||
category = "FunctionNode";
|
||||
}
|
||||
|
||||
# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
|
||||
if (STREQ(#Category, "Node") || STREQ(#Category, category)) { \
|
||||
tmp.value = ID; \
|
||||
tmp.identifier = EnumName; \
|
||||
tmp.name = UIName; \
|
||||
tmp.description = UIDesc; \
|
||||
tmp.icon = ICON_NONE; \
|
||||
RNA_enum_item_add(&item, &totitem, &tmp); \
|
||||
NODE_TYPES_BEGIN (ntype) {
|
||||
if (ntype->enum_name_legacy &&
|
||||
(BLI_str_startswith(ntype->idname, "Node") || BLI_str_startswith(ntype->idname, category)))
|
||||
{
|
||||
tmp.value = ntype->type;
|
||||
tmp.identifier = ntype->enum_name_legacy;
|
||||
tmp.name = ntype->ui_name;
|
||||
tmp.description = ntype->ui_description;
|
||||
tmp.icon = ICON_NONE;
|
||||
RNA_enum_item_add(&item, &totitem, &tmp);
|
||||
}
|
||||
# include "../../nodes/NOD_static_types.h"
|
||||
# undef DefNode
|
||||
}
|
||||
NODE_TYPES_END;
|
||||
|
||||
RNA_enum_item_end(&item, &totitem);
|
||||
*r_free = true;
|
||||
|
|
Loading…
Reference in New Issue