Fix #111142: Node group property 'bl_static_type' returns empty string for node groups and custom nodes #111154

Merged
Jacques Lucke merged 1 commits from mod_moder/blender:tmp_fix_enum_ntype_name into main 2023-08-16 09:29:57 +02:00
8 changed files with 10 additions and 6 deletions

View File

@ -755,6 +755,7 @@ bool nodeGroupPoll(const struct bNodeTree *nodetree,
void node_type_base_custom(struct bNodeType *ntype,
const char *idname,
const char *name,
const char *enum_name,
short nclass);
/**

View File

@ -4301,12 +4301,14 @@ void node_type_base(bNodeType *ntype, const int type, const char *name, const sh
void node_type_base_custom(bNodeType *ntype,
const char *idname,
const char *name,
const char *enum_name,
const short nclass)
{
STRNCPY(ntype->idname, idname);
ntype->type = NODE_CUSTOM;
STRNCPY(ntype->ui_name, name);
ntype->nclass = nclass;
ntype->enum_name_legacy = enum_name;
blender::bke::node_type_base_defaults(ntype);
}

View File

@ -1794,7 +1794,7 @@ static bNodeType *rna_Node_register_base(Main *bmain,
/* setup dummy node & node type to store static properties in */
memset(&dummy_nt, 0, sizeof(bNodeType));
/* this does some additional initialization of default values */
node_type_base_custom(&dummy_nt, identifier, "", 0);
node_type_base_custom(&dummy_nt, identifier, "", "CUSTOM", 0);
memset(&dummy_node, 0, sizeof(bNode));
dummy_node.typeinfo = &dummy_nt;

View File

@ -22,7 +22,7 @@ void register_node_type_cmp_group()
/* NOTE: Cannot use sh_node_type_base for node group, because it would map the node type
* to the shared NODE_GROUP integer type id. */
node_type_base_custom(&ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP);
node_type_base_custom(&ntype, "CompositorNodeGroup", "Group", "GROUP", NODE_CLASS_GROUP);
ntype.type = NODE_GROUP;
ntype.poll = cmp_node_poll_default;
ntype.poll_instance = node_group_poll_instance;

View File

@ -42,7 +42,7 @@ static void register_node_type_geo_group()
{
static bNodeType ntype;
node_type_base_custom(&ntype, "GeometryNodeGroup", "Group", NODE_CLASS_GROUP);
node_type_base_custom(&ntype, "GeometryNodeGroup", "Group", "GROUP", NODE_CLASS_GROUP);
ntype.type = NODE_GROUP;
ntype.poll = geo_node_poll_default;
ntype.poll_instance = node_group_poll_instance;

View File

@ -34,7 +34,8 @@ static void register_undefined_types()
STRNCPY(blender::bke::NodeTreeTypeUndefined.ui_name, N_("Undefined"));
STRNCPY(blender::bke::NodeTreeTypeUndefined.ui_description, N_("Undefined Node Tree Type"));
node_type_base_custom(&blender::bke::NodeTypeUndefined, "NodeUndefined", "Undefined", 0);
node_type_base_custom(
&blender::bke::NodeTypeUndefined, "NodeUndefined", "Undefined", "UNDEFINED", 0);
blender::bke::NodeTypeUndefined.poll = node_undefined_poll;
STRNCPY(blender::bke::NodeSocketTypeUndefined.idname, "NodeSocketUndefined");

View File

@ -85,7 +85,7 @@ void register_node_type_sh_group()
/* NOTE: cannot use #sh_node_type_base for node group, because it would map the node type
* to the shared #NODE_GROUP integer type id. */
node_type_base_custom(&ntype, "ShaderNodeGroup", "Group", NODE_CLASS_GROUP);
node_type_base_custom(&ntype, "ShaderNodeGroup", "Group", "GROUP", NODE_CLASS_GROUP);
ntype.type = NODE_GROUP;
ntype.poll = sh_node_poll_default;
ntype.poll_instance = node_group_poll_instance;

View File

@ -143,7 +143,7 @@ void register_node_type_tex_group()
/* NOTE: Cannot use #sh_node_type_base for node group, because it would map the node type
* to the shared #NODE_GROUP integer type id. */
node_type_base_custom(&ntype, "TextureNodeGroup", "Group", NODE_CLASS_GROUP);
node_type_base_custom(&ntype, "TextureNodeGroup", "Group", "GROUP", NODE_CLASS_GROUP);
ntype.type = NODE_GROUP;
ntype.poll = tex_node_poll_default;
ntype.poll_instance = node_group_poll_instance;