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
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')
-rw-r--r--source/blender/makesrna/RNA_enum_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_action.c6
-rw-r--r--source/blender/makesrna/intern/rna_internal.h3
-rw-r--r--source/blender/makesrna/intern/rna_pose.c97
-rw-r--r--source/blender/makesrna/intern/rna_space.c12
5 files changed, 73 insertions, 47 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 21eba3faf02..d2eeaa72fed 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -55,6 +55,8 @@ extern EnumPropertyItem image_type_items[];
extern EnumPropertyItem image_color_mode_items[];
extern EnumPropertyItem image_depth_mode_items[];
+extern EnumPropertyItem color_sets_items[];
+
extern EnumPropertyItem beztriple_keyframe_type_items[];
extern EnumPropertyItem beztriple_handle_type_items[];
extern EnumPropertyItem beztriple_interpolation_mode_items[];
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index c264210fd91..b63109ed137 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -480,10 +480,8 @@ static void rna_def_action_group(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Expanded", "Action Group is expanded");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
- prop = RNA_def_property(srna, "custom_color", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "customCol");
- RNA_def_property_ui_text(prop, "Custom Color", "Index of custom color set");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ /* color set */
+ rna_def_actionbone_group_common(srna, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
/* fcurve.keyframe_points */
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index a2054622031..cb90211eff9 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -193,6 +193,9 @@ void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const
const char *structname_slots, const char *update);
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);
+
void rna_ID_name_get(struct PointerRNA *ptr, char *value);
int rna_ID_name_length(struct PointerRNA *ptr);
void rna_ID_name_set(struct PointerRNA *ptr, const char *value);
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[] = {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 0e2fc6e8f11..e4d380ef48c 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2262,6 +2262,12 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
"(Action and Shape Key Editors only)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+ prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWGCOLORS);
+ RNA_def_property_ui_text(prop, "Show Group Colors",
+ "Draw groups and channels with colours matching their corresponding groups");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
/* editing */
prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
@@ -2367,6 +2373,12 @@ static void rna_def_space_graph(BlenderRNA *brna)
"(disable for better performance)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+ prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWGCOLORS);
+ RNA_def_property_ui_text(prop, "Show Group Colors",
+ "Draw groups and channels with colours matching their corresponding groups");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
/* editing */
prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);