[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38961] branches/soc-2011-pepper/source/ blender: Animation channels can now be renamed by Ctrl-Clicking on them, as in
Joshua Leung
aligorith at gmail.com
Wed Aug 3 03:22:35 CEST 2011
Revision: 38961
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38961
Author: aligorith
Date: 2011-08-03 01:22:31 +0000 (Wed, 03 Aug 2011)
Log Message:
-----------
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
Modified Paths:
--------------
branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c
branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
branches/soc-2011-pepper/source/blender/editors/space_action/action_draw.c
branches/soc-2011-pepper/source/blender/editors/space_graph/graph_draw.c
branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c
branches/soc-2011-pepper/source/blender/makesdna/DNA_action_types.h
Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c 2011-08-02 23:52:07 UTC (rev 38960)
+++ branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c 2011-08-03 01:22:31 UTC (rev 38961)
@@ -325,6 +325,26 @@
BLI_strncpy(name, id->name+2, ANIM_CHAN_NAME_SIZE);
}
+/* name property for ID block entries */
+static short acf_generic_idblock_nameprop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+{
+ RNA_id_pointer_create(ale->id, ptr);
+ *prop = RNA_struct_name_property(ptr->type);
+
+ return (*prop != NULL);
+}
+
+
+/* name property for ID block entries which are just subheading "fillers" */
+static short acf_generic_idfill_nameprop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+{
+ /* actual ID we're representing is stored in ale->data not ale->id, as id gives the owner */
+ RNA_id_pointer_create(ale->data, ptr);
+ *prop = RNA_struct_name_property(ptr->type);
+
+ return (*prop != NULL);
+}
+
/* Settings ------------------------------------------- */
#if 0
@@ -455,6 +475,7 @@
NULL, /* offset */
acf_summary_name, /* name */
+ NULL, /* name prop */
acf_summary_icon, /* icon */
acf_summary_setting_valid, /* has setting */
@@ -556,6 +577,7 @@
NULL, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_scene_icon, /* icon */
acf_scene_setting_valid, /* has setting */
@@ -702,6 +724,7 @@
NULL, /* offset */
acf_object_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_object_icon, /* icon */
acf_object_setting_valid, /* has setting */
@@ -749,6 +772,15 @@
BLI_strncpy(name, agrp->name, ANIM_CHAN_NAME_SIZE);
}
+/* name property for group entries */
+static short acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+{
+ RNA_pointer_create(ale->id, &RNA_ActionGroup, ale->data, ptr);
+ *prop = RNA_struct_name_property(ptr->type);
+
+ return (*prop != NULL);
+}
+
/* check if some setting exists for this channel */
static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
{
@@ -819,6 +851,7 @@
acf_generic_group_offset, /* offset */
acf_group_name, /* name */
+ acf_group_name_prop, /* name prop */
NULL, /* icon */
acf_group_setting_valid, /* has setting */
@@ -905,6 +938,7 @@
acf_generic_group_offset, /* offset */
acf_fcurve_name, /* name */
+ NULL, /* name prop */
NULL, /* icon */
acf_fcurve_setting_valid, /* has setting */
@@ -989,6 +1023,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
acf_fillactd_icon, /* icon */
acf_fillactd_setting_valid, /* has setting */
@@ -1067,6 +1102,7 @@
acf_generic_basic_offset, /* offset */
acf_filldrivers_name, /* name */
+ NULL, /* name prop */
acf_filldrivers_icon, /* icon */
acf_filldrivers_setting_valid, /* has setting */
@@ -1144,6 +1180,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dsmat_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1220,6 +1257,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dslam_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1303,6 +1341,7 @@
acf_dstex_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
acf_dstex_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1379,6 +1418,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
acf_dscam_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1465,6 +1505,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dscur_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1541,6 +1582,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dsskey_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1617,6 +1659,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
acf_dswor_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1693,6 +1736,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dspart_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1769,6 +1813,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dsmball_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1845,6 +1890,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dsarm_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1932,6 +1978,7 @@
acf_dsntree_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dsntree_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -2008,6 +2055,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dsmesh_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -2084,6 +2132,7 @@
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dslat_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -2108,17 +2157,17 @@
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
return SPK_DS_EXPAND;
-
+
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
-
+
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
*neg= 1;
return ADT_CURVES_NOT_VISIBLE;
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
-
+
default: /* unsupported */
return 0;
}
@@ -2135,7 +2184,7 @@
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
GET_ACF_FLAG_PTR(spk->flag);
-
+
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
@@ -2143,7 +2192,7 @@
GET_ACF_FLAG_PTR(spk->adt->flag)
else
return NULL;
-
+
default: /* unsupported */
return NULL;
}
@@ -2153,15 +2202,16 @@
static bAnimChannelType ACF_DSSPK=
{
"Speaker Expander", /* type name */
-
+
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop,/* backdrop */
acf_generic_indention_1, /* indent level */
acf_generic_basic_offset, /* offset */
-
+
acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
acf_dsspk_icon, /* icon */
-
+
acf_generic_dataexpand_setting_valid, /* has setting */
acf_dsspk_setting_flag, /* flag for setting */
acf_dsspk_setting_ptr /* pointer for setting */
@@ -2184,6 +2234,22 @@
}
}
+/* name property for ShapeKey entries */
+static short acf_shapekey_nameprop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+{
+ KeyBlock *kb= (KeyBlock *)ale->data;
+
+ /* if the KeyBlock had a name, use it, otherwise use the index */
+ if (kb && kb->name[0]) {
+ RNA_pointer_create(ale->id, &RNA_ShapeKey, kb, ptr);
+ *prop = RNA_struct_name_property(ptr->type);
+
+ return (*prop != NULL);
+ }
+
+ return 0;
+}
+
/* check if some setting exists for this channel */
static short acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
@@ -2250,6 +2316,7 @@
acf_generic_basic_offset, /* offset */
acf_shapekey_name, /* name */
+ acf_shapekey_nameprop, /* name prop */
NULL, /* icon */
acf_shapekey_setting_valid, /* has setting */
@@ -2324,6 +2391,7 @@
acf_generic_group_offset, /* offset */
acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
acf_gpd_icon, /* icon */
acf_gpd_setting_valid, /* has setting */
@@ -2342,6 +2410,19 @@
BLI_strncpy(name, gpl->info, ANIM_CHAN_NAME_SIZE);
}
+/* name property for grease pencil layer entries */
+static short acf_gpl_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+{
+ if (ale->data) {
+ RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, ptr);
+ *prop = RNA_struct_name_property(ptr->type);
+
+ return (*prop != NULL);
+ }
+
+ return 0;
+}
+
/* check if some setting exists for this channel */
static short acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
@@ -2399,6 +2480,7 @@
acf_generic_group_offset, /* offset */
acf_gpl_name, /* name */
+ acf_gpl_name_prop, /* name prop */
NULL, /* icon */
acf_gpl_setting_valid, /* has setting */
@@ -2450,7 +2532,7 @@
animchannelTypeInfo[type++]= &ACF_DSTEX; /* Texture Channel */
animchannelTypeInfo[type++]= &ACF_DSLAT; /* Lattice Channel */
animchannelTypeInfo[type++]= &ACF_DSSPK; /* Speaker Channel */
-
+
animchannelTypeInfo[type++]= &ACF_SHAPEKEY; /* ShapeKey */
animchannelTypeInfo[type++]= &ACF_GPD; /* Grease Pencil Datablock */
@@ -2642,6 +2724,8 @@
#define ICON_WIDTH 17
// XXX hardcoded width of sliders
#define SLIDER_WIDTH 80
+// XXX hardcoded width of rename textboxes
+#define RENAME_TEXT_WIDTH 100
/* Draw the given channel */
// TODO: make this use UI controls for the buttons
@@ -2731,6 +2815,7 @@
}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list