diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-22 11:48:20 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-22 11:52:17 +0300 |
commit | 82702db4078768eb4b9a59050b17ab1b537eb48a (patch) | |
tree | 3472cf668c3512bdc19daa5317c031c8f00065e8 /source/blender/makesrna/intern/rna_nodetree.c | |
parent | 21eb3ce44a36b057279ba811011e387bdbf6ac69 (diff) |
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
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 32a844c3fd0..ed3896b050d 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -7109,7 +7109,13 @@ static void rna_def_node(BlenderRNA *brna) static EnumPropertyItem dummy_static_type_items[] = { {NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"}, {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); RNA_def_struct_ui_text(srna, "Node", "Node in a node tree"); 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", ""); 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 */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname"); |