[Bf-blender-cvs] [df1d319a79f] blender2.8: Static Override: Fix order of operations issue in material slots.

Bastien Montagne noreply at git.blender.org
Tue Jun 5 12:08:26 CEST 2018


Commit: df1d319a79f189fec9df881166b7a8dfb43b209e
Author: Bastien Montagne
Date:   Tue Jun 5 12:07:20 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBdf1d319a79f189fec9df881166b7a8dfb43b209e

Static Override: Fix order of operations issue in material slots.

*Really* not happy with that kind of constraint, but no choice for
now...

===================================================================

M	source/blender/makesrna/intern/rna_object.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index d9a9a7b93e3..a6653c680e0 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1566,6 +1566,15 @@ static void rna_def_material_slot(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
 	RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
 
+	/* WARNING! Order is crucial for override to work properly here... :/
+	 * 'link' must come before material pointer, since it defines where (in object or obdata) that one is set! */
+	prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, link_items);
+	RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
+	RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+	RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
+	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
+
 	prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -1574,13 +1583,6 @@ static void rna_def_material_slot(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
 
-	prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_items(prop, link_items);
-	RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
-	RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-	RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
-	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
-
 	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "Material slot name");



More information about the Bf-blender-cvs mailing list