Animation Editor Code Cleanups:

Removing some unused functions that have become redundant in recent times.
This commit is contained in:
2009-12-20 05:09:55 +00:00
parent be323efa35
commit 170c464920
4 changed files with 4 additions and 94 deletions

View File

@@ -315,64 +315,6 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s
/* apply to F-Curve */
ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, map_cb, NULL);
}
/* *************************************************** */
/* ANIMATION EDITOR UI-WIDGETS */
/* ui button event */
#define B_REDR 1
/* standard header buttons for Animation Editors */
short ANIM_headerUI_standard_buttons (const bContext *C, bDopeSheet *ads, uiBlock *block, short xco, short yco)
{
Main *mainptr= CTX_data_main(C);
ScrArea *sa= CTX_wm_area(C);
short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));
/* check if the DopeSheet data exists, just in case... */
if (ads) {
/* more 'generic' filtering options */
if (nlaActive) uiBlockBeginAlign(block);
uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Only display selected Objects");
if (nlaActive) uiDefIconButBitI(block, TOGN, ADS_FILTER_NLA_NOACT, B_REDR, ICON_ACTION, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Include AnimData blocks with no NLA Data");
if (nlaActive) uiBlockEndAlign(block);
xco += 5;
/* datatype based - only available datatypes are shown */
uiBlockBeginAlign(block);
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display World Animation");
uiDefIconButBitI(block, TOGN, ADS_FILTER_NONTREE, B_REDR, ICON_NODETREE, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Node Tree Animation");
if (mainptr && mainptr->key.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
if (mainptr && mainptr->mat.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Material Data");
if (mainptr && mainptr->lamp.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Lamp Data");
if (mainptr && mainptr->camera.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Camera Data");
if (mainptr && mainptr->curve.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Curve Data");
if (mainptr && mainptr->mball.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display MetaBall Data");
if (mainptr && mainptr->armature.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Armature Data");
if (mainptr && mainptr->particle.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Particle Data");
uiBlockEndAlign(block);
xco += 30;
}
else {
// XXX this case shouldn't happen at all... for now, just pad out same amount of space
printf("ERROR: dopesheet data not available when drawing Animation Editor header \n");
xco += 11*XIC + 30;
}
// TODO: include auto-snapping menu here too...
/* return the width of the buttons */
return xco;
}
/* *************************************************** */

View File

@@ -181,39 +181,12 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
/* ------------------------------- Color Codes for F-Curve Channels ---------------------------- */
#if 0
/* used for FCURVE_COLOR_AUTO_RAINBOW */
// XXX this still doesn't work too great when there are more than 32 curves (which happens most of the time)
void ipo_rainbow (int cur, int tot, float *out)
{
float dfac, fac, sat;
dfac= (float)(1.0/( (float)tot+1.0));
/* this calculation makes 2 or 4 different cycles of rainbow colors */
// 2 different cycles - for hue
if(cur< tot/2) fac= (float)(cur*2.0f*dfac);
else fac= (float)((cur-tot/2)*2.0f*dfac +dfac);
// third cycle with altered hue
if(tot > 32) fac= fac*1.95f;
// clamping for excessive ranges
if(fac>1.0f) fac-= 1.0f;
// saturation adjustments for more visible range
if(fac>0.5f && fac<0.8f) sat= 0.5f;
else sat= 0.6f;
hsv_to_rgb(fac, sat, 1.0f, out, out+1, out+2);
}
#endif
/* step between the major distinguishable color bands of the primary colors */
#define HSV_BANDWIDTH 0.3f
/* testbed for FCURVE_COLOR_AUTO_RAINBOW determination methods */
/* used to determine the colour of F-Curves with FCURVE_COLOR_AUTO_RAINBOW set */
//void fcurve_rainbow (unsigned int cur, unsigned int tot, float *out)
void ipo_rainbow (int cur, int tot, float *out)
void getcolor_fcurve_rainbow (int cur, int tot, float *out)
{
float hue, val, sat, fac;
int grouping;

View File

@@ -424,11 +424,6 @@ void ANIM_draw_cfra(const struct bContext *C, struct View2D *v2d, short flag);
/* main call to draw preview range curtains */
void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d);
/* ------------- Preview Range Drawing -------------- */
/* standard header buttons for Animation Editors */
short ANIM_headerUI_standard_buttons(const struct bContext *C, struct bDopeSheet *ads, struct uiBlock *block, short xco, short yco);
/* ************************************************* */
/* F-MODIFIER TOOLS */
@@ -445,7 +440,7 @@ void ANIM_uiTemplate_fmodifier_draw(const struct bContext *C, struct uiLayout *l
int getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu);
/* Automatically determine a color for the nth F-Curve */
void ipo_rainbow(int cur, int tot, float *out);
void getcolor_fcurve_rainbow(int cur, int tot, float *out);
/* ------------- NLA-Mapping ----------------------- */
/* anim_draw.c */

View File

@@ -548,7 +548,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
/* determine color 'automatically' using 'magic function' which uses the given args
* of current item index + total items to determine some RGB color
*/
ipo_rainbow(i, items, fcu->color);
getcolor_fcurve_rainbow(i, items, fcu->color);
}
break;
}