forked from bartvdbraak/blender
Expose shading node shading compatibility to the RNA
This way it is possible to probe shading compatibility of a given node from python, making things like versioning code much easier to perform. it's only valid for shading nodes, for other nodes the property also exists but reads as an empty enum. To access this compatibilities: node.shading_compatibility
This commit is contained in:
parent
21eb3ce44a
commit
82702db407
@ -7109,7 +7109,13 @@ static void rna_def_node(BlenderRNA *brna)
|
|||||||
static EnumPropertyItem dummy_static_type_items[] = {
|
static EnumPropertyItem dummy_static_type_items[] = {
|
||||||
{NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
|
{NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
|
||||||
{0, NULL, 0, NULL, NULL}};
|
{0, NULL, 0, NULL, NULL}};
|
||||||
|
|
||||||
|
static EnumPropertyItem node_shading_compatibilities[] = {
|
||||||
|
{NODE_OLD_SHADING, "OLD_SHADING", 0, "Old Shading", "Old shading system compatibility"},
|
||||||
|
{NODE_NEW_SHADING, "NEW_SHADING", 0, "New Shading", "New shading system compatibility"},
|
||||||
|
{0, NULL, 0, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
srna = RNA_def_struct(brna, "Node", NULL);
|
srna = RNA_def_struct(brna, "Node", NULL);
|
||||||
RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
|
RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
|
||||||
RNA_def_struct_sdna(srna, "bNode");
|
RNA_def_struct_sdna(srna, "bNode");
|
||||||
@ -7249,6 +7255,12 @@ static void rna_def_node(BlenderRNA *brna)
|
|||||||
parm = RNA_def_boolean(func, "result", false, "Result", "");
|
parm = RNA_def_boolean(func, "result", false, "Result", "");
|
||||||
RNA_def_function_return(func, parm);
|
RNA_def_function_return(func, parm);
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "shading_compatibility", PROP_ENUM, PROP_NONE);
|
||||||
|
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
|
||||||
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||||
|
RNA_def_property_enum_sdna(prop, NULL, "typeinfo->compatibility");
|
||||||
|
RNA_def_property_enum_items(prop, node_shading_compatibilities);
|
||||||
|
|
||||||
/* registration */
|
/* registration */
|
||||||
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
||||||
RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
|
RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
|
||||||
|
Loading…
Reference in New Issue
Block a user