[Bf-blender-cvs] [ff66f3d] master: Anim Editors: Refactored animchannel type definition callbacks to use bools
Joshua Leung
noreply at git.blender.org
Sat Nov 23 07:00:08 CET 2013
Commit: ff66f3d3adc1022d732fba4f4d120067fa87f3f8
Author: Joshua Leung
Date: Sat Nov 23 18:44:39 2013 +1300
http://developer.blender.org/rBff66f3d3adc1022d732fba4f4d120067fa87f3f8
Anim Editors: Refactored animchannel type definition callbacks to use bools
Changes:
- acf.name_prop() and acf.has_setting() now return bools instead of shorts
- Renamed a few name_prop() callbacks whose names ended in "_nameprop"
instead of "_name_prop", which made it difficult to safely find all
such instances
===================================================================
M source/blender/editors/animation/anim_channels_defines.c
M source/blender/editors/include/ED_anim_api.h
===================================================================
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 1d9022e..958f721 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -342,7 +342,7 @@ static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
}
/* name property for ID block entries */
-static short acf_generic_idblock_nameprop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+static bool acf_generic_idblock_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
{
RNA_id_pointer_create(ale->id, ptr);
*prop = RNA_struct_name_property(ptr->type);
@@ -352,7 +352,7 @@ static short acf_generic_idblock_nameprop(bAnimListElem *ale, PointerRNA *ptr, P
/* name property for ID block entries which are just subheading "fillers" */
-static short acf_generic_idfill_nameprop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+static bool acf_generic_idfill_name_prop(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);
@@ -365,19 +365,19 @@ static short acf_generic_idfill_nameprop(bAnimListElem *ale, PointerRNA *ptr, Pr
#if 0
/* channel type has no settings */
-static short acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static bool acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
{
- return 0;
+ return false;
}
#endif
/* check if some setting exists for this object-based data-expander (datablock only) */
-static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
+static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* expand is always supported */
case ACHANNEL_SETTING_EXPAND:
- return 1;
+ return true;
/* mute is only supported for NLA */
case ACHANNEL_SETTING_MUTE:
@@ -385,11 +385,11 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle
/* select is ok for most "ds*" channels (e.g. dsmat) */
case ACHANNEL_SETTING_SELECT:
- return 1;
+ return true;
/* other flags are never supported */
default:
- return 0;
+ return false;
}
}
@@ -438,7 +438,7 @@ static int acf_summary_icon(bAnimListElem *UNUSED(ale))
}
/* check if some setting exists for this channel */
-static short acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
+static bool acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
/* only expanded is supported, as it is used for hiding all stuff which the summary covers */
return (setting == ACHANNEL_SETTING_EXPAND);
@@ -509,7 +509,7 @@ static int acf_scene_icon(bAnimListElem *UNUSED(ale))
}
/* check if some setting exists for this channel */
-static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
+static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* muted only in NLA */
@@ -523,10 +523,10 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
@@ -593,7 +593,7 @@ static bAnimChannelType ACF_SCENE =
NULL, /* offset */
acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
+ acf_generic_idblock_name_prop, /* name prop */
acf_scene_icon, /* icon */
acf_scene_setting_valid, /* has setting */
@@ -649,7 +649,7 @@ static void acf_object_name(bAnimListElem *ale, char *name)
}
/* check if some setting exists for this channel */
-static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
{
Base *base = (Base *)ale->data;
Object *ob = base->object;
@@ -666,10 +666,10 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
@@ -737,7 +737,7 @@ static bAnimChannelType ACF_OBJECT =
NULL, /* offset */
acf_object_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
+ acf_generic_idblock_name_prop, /* name prop */
acf_object_icon, /* icon */
acf_object_setting_valid, /* has setting */
@@ -803,7 +803,7 @@ static void acf_group_name(bAnimListElem *ale, char *name)
}
/* name property for group entries */
-static short acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+static bool 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);
@@ -812,20 +812,20 @@ static short acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRN
}
/* check if some setting exists for this channel */
-static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
+static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
{
/* for now, all settings are supported, though some are only conditionally */
switch (setting) {
/* unsupported */
case ACHANNEL_SETTING_SOLO: /* Only available in NLA Editor for tracks */
- return 0;
+ return false;
/* conditionally supported */
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
return (ac->spacetype == SPACE_IPO);
default: /* always supported */
- return 1;
+ return true;
}
}
@@ -903,7 +903,7 @@ static void acf_fcurve_name(bAnimListElem *ale, char *name)
}
/* "name" property for fcurve entries */
-static short acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
+static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
{
FCurve *fcu = (FCurve *)ale->data;
@@ -924,7 +924,7 @@ static short acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyR
}
/* check if some setting exists for this channel */
-static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
{
FCurve *fcu = (FCurve *)ale->data;
@@ -932,21 +932,21 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
/* unsupported */
case ACHANNEL_SETTING_SOLO: /* Solo Flag is only for NLA */
case ACHANNEL_SETTING_EXPAND: /* F-Curves are not containers */
- return 0;
+ return false;
/* conditionally available */
case ACHANNEL_SETTING_PROTECT: /* Protection is only valid when there's keyframes */
if (fcu->bezt)
- return 1;
+ return true;
else
- return 0; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
+ return false; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
return (ac->spacetype == SPACE_IPO);
/* always available */
default:
- return 1;
+ return true;
}
}
@@ -1012,16 +1012,16 @@ static int acf_fillactd_icon(bAnimListElem *UNUSED(ale))
}
/* check if some setting exists for this channel */
-static short acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
+static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* only select and expand supported */
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
@@ -1079,7 +1079,7 @@ static bAnimChannelType ACF_FILLACTD =
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
- acf_generic_idfill_nameprop, /* name prop */
+ acf_generic_idfill_name_prop, /* name prop */
acf_fillactd_icon, /* icon */
acf_fillactd_setting_valid, /* has setting */
@@ -1102,15 +1102,15 @@ static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name)
/* check if some setting exists for this channel */
// TODO: this could be made more generic
-static short acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
+static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* only expand supported */
case ACHANNEL_SETTING_EXPAND:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
@@ -1235,7 +1235,7 @@ static bAnimChannelType ACF_DSMAT =
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
+ acf_generic_idblock_name_prop, /* name prop */
acf_dsmat_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1311,7 +1311,7 @@ static bAnimChannelType ACF_DSLAM =
acf_generic_basic_offset, /* offset */
acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
+ acf_generic_idblock_name_prop, /* name prop */
acf_dslam_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
@@ -1394,7 +1394,7 @@ static bAnimChannelType ACF_DSTEX =
acf_dstex_offset, /* offset */
acf_generic_idblock_name, /* name */
- acf_generic_idfill
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list