[Bf-blender-cvs] [b6f0ad5] master: Disable color editing for bone group color sets unless custom colors is selected.

Lukas Tönne noreply at git.blender.org
Wed Oct 15 13:54:26 CEST 2014


Commit: b6f0ad5d9744d963d005a9d723033dd29616a056
Author: Lukas Tönne
Date:   Wed Oct 15 13:52:43 2014 +0200
Branches: master
https://developer.blender.org/rBb6f0ad5d9744d963d005a9d723033dd29616a056

Disable color editing for bone group color sets unless custom colors is
selected.

The bone group colors are not actually used _unless_ when the set is
"custom colors". But they were still editable, which is very confusing.

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

M	release/scripts/startup/bl_ui/properties_data_armature.py
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_pose.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index c6823f1..6a8f9c5 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -144,6 +144,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel):
             if group.color_set:
                 col = split.column()
                 sub = col.row(align=True)
+                sub.enabled = group.is_custom_color_set # only custom colors are editable
                 sub.prop(group.colors, "normal", text="")
                 sub.prop(group.colors, "select", text="")
                 sub.prop(group.colors, "active", text="")
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 83b7a81..051e727 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -207,6 +207,7 @@ void rna_def_render_layer_common(struct StructRNA *srna, int scene);
 
 void rna_def_actionbone_group_common(struct StructRNA *srna, int update_flag, const char *update_cb);
 void rna_ActionGroup_colorset_set(struct PointerRNA *ptr, int value);
+int rna_ActionGroup_is_custom_colorset_get(struct PointerRNA *ptr);
 
 void rna_ID_name_get(struct PointerRNA *ptr, char *value);
 int rna_ID_name_length(struct PointerRNA *ptr);
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 9f05d61..f9d0e86 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -179,6 +179,13 @@ void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
 	}
 }
 
+int rna_ActionGroup_is_custom_colorset_get(PointerRNA *ptr)
+{
+	bActionGroup *grp = ptr->data;
+	
+	return (bool)(grp->customCol < 0);
+}
+
 static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
 {
 	Object *ob = ptr->id.data;
@@ -675,6 +682,11 @@ void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const cha
 	RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
 	RNA_def_property_update(prop, update_flag, update_cb);
 	
+	prop = RNA_def_property(srna, "is_custom_color_set", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", NULL);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Custom Color Set", "Color set is user-defined instead of a fixed theme color set");
+	
 	/* TODO: editing the colors for this should result in changes to the color type... */
 	prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);




More information about the Bf-blender-cvs mailing list