Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2012-05-24 05:25:31 +0400
committerJoshua Leung <aligorith@gmail.com>2012-05-24 05:25:31 +0400
commit8e97203f7d1101d8069b22f0f9a5666812704e22 (patch)
tree160ce3d1d9751745629d71c42ce3f6f963698843 /source/blender/makesrna/intern/rna_pose.c
parent57b488574a0720eb749e9daa16df1979db9bbe6f (diff)
Restoring Group Colours for Animation Channels - Part 1
This commit restores the group colours support for F-Curves and F-Curve Groups in the DopeSheet and Graph Editors. Currently the relevant settings for groups are only exposed via RNA, but a followup commit will add support for automatically setting these colours. By default, DopeSheet and Graph Editors are set to display these colours if/when they are available. This functionality used to be in 2.48, and is a useful mechanism for visually distinguishing between channels for different controls when animating (if group colours are used on the rigs too).
Diffstat (limited to 'source/blender/makesrna/intern/rna_pose.c')
-rw-r--r--source/blender/makesrna/intern/rna_pose.c97
1 files changed, 54 insertions, 43 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 6ec0932dba8..83d40b26cd0 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -60,6 +60,33 @@ EnumPropertyItem posebone_rotmode_items[] = {
{0, NULL, 0, NULL, NULL}
};
+/* Bone and Group Color Sets */
+EnumPropertyItem color_sets_items[] = {
+ {0, "DEFAULT", 0, "Default Colors", ""},
+ {1, "THEME01", 0, "01 - Theme Color Set", ""},
+ {2, "THEME02", 0, "02 - Theme Color Set", ""},
+ {3, "THEME03", 0, "03 - Theme Color Set", ""},
+ {4, "THEME04", 0, "04 - Theme Color Set", ""},
+ {5, "THEME05", 0, "05 - Theme Color Set", ""},
+ {6, "THEME06", 0, "06 - Theme Color Set", ""},
+ {7, "THEME07", 0, "07 - Theme Color Set", ""},
+ {8, "THEME08", 0, "08 - Theme Color Set", ""},
+ {9, "THEME09", 0, "09 - Theme Color Set", ""},
+ {10, "THEME10", 0, "10 - Theme Color Set", ""},
+ {11, "THEME11", 0, "11 - Theme Color Set", ""},
+ {12, "THEME12", 0, "12 - Theme Color Set", ""},
+ {13, "THEME13", 0, "13 - Theme Color Set", ""},
+ {14, "THEME14", 0, "14 - Theme Color Set", ""},
+ {15, "THEME15", 0, "15 - Theme Color Set", ""},
+ {16, "THEME16", 0, "16 - Theme Color Set", ""},
+ {17, "THEME17", 0, "17 - Theme Color Set", ""},
+ {18, "THEME18", 0, "18 - Theme Color Set", ""},
+ {19, "THEME19", 0, "19 - Theme Color Set", ""},
+ {20, "THEME20", 0, "20 - Theme Color Set", ""},
+ {-1, "CUSTOM", 0, "Custom Color Set", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
#include "BIK_api.h"
@@ -107,7 +134,8 @@ static char *rna_PoseBone_path(PointerRNA *ptr)
return BLI_sprintfN("pose.bones[\"%s\"]", ((bPoseChannel *)ptr->data)->name);
}
-static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value)
+/* shared for actions groups and bone groups */
+void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
{
bActionGroup *grp = ptr->data;
@@ -622,34 +650,31 @@ static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
#else
-static void rna_def_bone_group(BlenderRNA *brna)
+/* common properties for Action/Bone Groups - related to color */
+void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
{
- static EnumPropertyItem prop_colorSets_items[] = {
- {0, "DEFAULT", 0, "Default Colors", ""},
- {1, "THEME01", 0, "01 - Theme Color Set", ""},
- {2, "THEME02", 0, "02 - Theme Color Set", ""},
- {3, "THEME03", 0, "03 - Theme Color Set", ""},
- {4, "THEME04", 0, "04 - Theme Color Set", ""},
- {5, "THEME05", 0, "05 - Theme Color Set", ""},
- {6, "THEME06", 0, "06 - Theme Color Set", ""},
- {7, "THEME07", 0, "07 - Theme Color Set", ""},
- {8, "THEME08", 0, "08 - Theme Color Set", ""},
- {9, "THEME09", 0, "09 - Theme Color Set", ""},
- {10, "THEME10", 0, "10 - Theme Color Set", ""},
- {11, "THEME11", 0, "11 - Theme Color Set", ""},
- {12, "THEME12", 0, "12 - Theme Color Set", ""},
- {13, "THEME13", 0, "13 - Theme Color Set", ""},
- {14, "THEME14", 0, "14 - Theme Color Set", ""},
- {15, "THEME15", 0, "15 - Theme Color Set", ""},
- {16, "THEME16", 0, "16 - Theme Color Set", ""},
- {17, "THEME17", 0, "17 - Theme Color Set", ""},
- {18, "THEME18", 0, "18 - Theme Color Set", ""},
- {19, "THEME19", 0, "19 - Theme Color Set", ""},
- {20, "THEME20", 0, "20 - Theme Color Set", ""},
- {-1, "CUSTOM", 0, "Custom Color Set", ""},
- {0, NULL, 0, NULL, NULL}
- };
+ PropertyRNA *prop;
+ /* color set + colors */
+ prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "customCol");
+ RNA_def_property_enum_items(prop, color_sets_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ActionGroup_colorset_set", NULL);
+ RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
+ RNA_def_property_update(prop, update_flag, update_cb);
+
+ /* 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);
+ RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
+ /* NOTE: the DNA data is not really a pointer, but this code works :) */
+ RNA_def_property_pointer_sdna(prop, NULL, "cs");
+ RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set");
+ RNA_def_property_update(prop, update_flag, update_cb);
+}
+
+static void rna_def_bone_group(BlenderRNA *brna)
+{
StructRNA *srna;
PropertyRNA *prop;
@@ -667,22 +692,8 @@ static void rna_def_bone_group(BlenderRNA *brna)
/* TODO: add some runtime-collections stuff to access grouped bones */
- /* color set + colors */
- prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "customCol");
- RNA_def_property_enum_items(prop, prop_colorSets_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_BoneGroup_color_set_set", NULL);
- RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* 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);
- RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
- /* NOTE: the DNA data is not really a pointer, but this code works :) */
- RNA_def_property_pointer_sdna(prop, NULL, "cs");
- RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+ /* color set */
+ rna_def_actionbone_group_common(srna, NC_OBJECT | ND_POSE, "rna_Pose_update");
}
static EnumPropertyItem prop_iksolver_items[] = {