diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-16 14:30:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-16 14:30:53 +0400 |
commit | 68dd3980638b6a1f0c766a1e023b393c0f36cacd (patch) | |
tree | 64846808a06af598e5df551ac4b500a352e46a17 /source/blender/editors/space_view3d/drawanimviz.c | |
parent | e9ab58ad8f0fbcb84a08e8013d4b024bea648f96 (diff) |
remove duplicate if'0'd functions, same versions are in drawarmature.c.
also added note of function to de-duplicate.
Diffstat (limited to 'source/blender/editors/space_view3d/drawanimviz.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawanimviz.c | 266 |
1 files changed, 0 insertions, 266 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 30042433ef2..1784d949761 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -312,269 +312,3 @@ void draw_motion_paths_cleanup(View3D *v3d) if (v3d->zbuf) glEnable(GL_DEPTH_TEST); glPopMatrix(); } - -#if 0 // XXX temp file guards - -/* ***************************** Onion Skinning (Ghosts) ******************************** */ - -#if 0 // XXX only for bones -/* helper function for ghost drawing - sets/removes flags for temporarily - * hiding unselected bones while drawing ghosts - */ -static void ghost_poses_tag_unselected(Object *ob, short unset) -{ - bArmature *arm= ob->data; - bPose *pose= ob->pose; - bPoseChannel *pchan; - - /* don't do anything if no hiding any bones */ - if ((arm->flag & ARM_GHOST_ONLYSEL)==0) - return; - - /* loop over all pchans, adding/removing tags as appropriate */ - for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) { - if ((pchan->bone) && (arm->layer & pchan->bone->layer)) { - if (unset) { - /* remove tags from all pchans if cleaning up */ - pchan->bone->flag &= ~BONE_HIDDEN_PG; - } - else { - /* set tags on unselected pchans only */ - if ((pchan->bone->flag & BONE_SELECTED)==0) - pchan->bone->flag |= BONE_HIDDEN_PG; - } - } - } -} -#endif // XXX only for bones - -/* draw ghosts that occur within a frame range - * note: object should be in posemode - */ -static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base *base) -{ - Object *ob= base->object; - AnimData *adt= BKE_animdata_from_id(&ob->id); - bArmature *arm= ob->data; - bPose *posen, *poseo; - float start, end, stepsize, range, colfac; - int cfrao, flago, ipoflago; - - start = (float)arm->ghostsf; - end = (float)arm->ghostef; - if (end <= start) - return; - - stepsize= (float)(arm->ghostsize); - range= (float)(end - start); - - /* store values */ - ob->mode &= ~OB_MODE_POSE; - cfrao= CFRA; - flago= arm->flag; - arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES); - ipoflago= ob->ipoflag; - ob->ipoflag |= OB_DISABLE_PATH; - - /* copy the pose */ - poseo= ob->pose; - copy_pose(&posen, ob->pose, 1); - ob->pose= posen; - armature_rebuild_pose(ob, ob->data); /* child pointers for IK */ - ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */ - - glEnable(GL_BLEND); - if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - - /* draw from first frame of range to last */ - for (CFRA= (int)start; CFRA < end; CFRA += (int)stepsize) { - colfac = (end - (float)CFRA) / range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); - - BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); - } - glDisable(GL_BLEND); - if (v3d->zbuf) glEnable(GL_DEPTH_TEST); - - ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */ - free_pose(posen); - - /* restore */ - CFRA= cfrao; - ob->pose= poseo; - arm->flag= flago; - armature_rebuild_pose(ob, ob->data); - ob->mode |= OB_MODE_POSE; - ob->ipoflag= ipoflago; -} - -/* draw ghosts on keyframes in action within range - * - object should be in posemode - */ -static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *base) -{ - Object *ob= base->object; - AnimData *adt= BKE_animdata_from_id(&ob->id); - bAction *act= (adt) ? adt->action : NULL; - bArmature *arm= ob->data; - bPose *posen, *poseo; - DLRBT_Tree keys; - ActKeyColumn *ak, *akn; - float start, end, range, colfac, i; - int cfrao, flago; - - start = (float)arm->ghostsf; - end = (float)arm->ghostef; - if (end <= start) - return; - - /* get keyframes - then clip to only within range */ - BLI_dlrbTree_init(&keys); - action_to_keylist(adt, act, &keys, NULL); - BLI_dlrbTree_linkedlist_sync(&keys); - - range= 0; - for (ak= keys.first; ak; ak= akn) { - akn= ak->next; - - if ((ak->cfra < start) || (ak->cfra > end)) - BLI_freelinkN((ListBase *)&keys, ak); - else - range++; - } - if (range == 0) return; - - /* store values */ - ob->mode &= ~OB_MODE_POSE; - cfrao= CFRA; - flago= arm->flag; - arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES); - ob->ipoflag |= OB_DISABLE_PATH; - - /* copy the pose */ - poseo= ob->pose; - copy_pose(&posen, ob->pose, 1); - ob->pose= posen; - armature_rebuild_pose(ob, ob->data); /* child pointers for IK */ - ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */ - - glEnable(GL_BLEND); - if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - - /* draw from first frame of range to last */ - for (ak=keys.first, i=0; ak; ak=ak->next, i++) { - colfac = i/range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); - - CFRA= (int)ak->cfra; - - BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); - } - glDisable(GL_BLEND); - if (v3d->zbuf) glEnable(GL_DEPTH_TEST); - - ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */ - BLI_dlrbTree_free(&keys); - free_pose(posen); - - /* restore */ - CFRA= cfrao; - ob->pose= poseo; - arm->flag= flago; - armature_rebuild_pose(ob, ob->data); - ob->mode |= OB_MODE_POSE; -} - -/* draw ghosts around current frame - * - object is supposed to be armature in posemode - */ -static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) -{ - Object *ob= base->object; - AnimData *adt= BKE_animdata_from_id(&ob->id); - bArmature *arm= ob->data; - bPose *posen, *poseo; - float cur, start, end, stepsize, range, colfac, actframe, ctime; - int cfrao, flago; - - /* pre conditions, get an action with sufficient frames */ - if ELEM(NULL, adt, adt->action) - return; - - calc_action_range(adt->action, &start, &end, 0); - if (start == end) - return; - - stepsize= (float)(arm->ghostsize); - range= (float)(arm->ghostep)*stepsize + 0.5f; /* plus half to make the for loop end correct */ - - /* store values */ - ob->mode &= ~OB_MODE_POSE; - cfrao= CFRA; - actframe= BKE_nla_tweakedit_remap(adt, (float)CFRA, 0); - flago= arm->flag; - arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES); - - /* copy the pose */ - poseo= ob->pose; - copy_pose(&posen, ob->pose, 1); - ob->pose= posen; - armature_rebuild_pose(ob, ob->data); /* child pointers for IK */ - ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */ - - glEnable(GL_BLEND); - if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - - /* draw from darkest blend to lowest */ - for(cur= stepsize; cur<range; cur+=stepsize) { - ctime= cur - (float)fmod(cfrao, stepsize); /* ensures consistent stepping */ - colfac= ctime/range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); - - /* only within action range */ - if (actframe+ctime >= start && actframe+ctime <= end) { - CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe+ctime, NLATIME_CONVERT_MAP); - - if (CFRA != cfrao) { - BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); - } - } - - ctime= cur + (float)fmod((float)cfrao, stepsize) - stepsize+1.0f; /* ensures consistent stepping */ - colfac= ctime/range; - UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac))); - - /* only within action range */ - if ((actframe-ctime >= start) && (actframe-ctime <= end)) { - CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe-ctime, NLATIME_CONVERT_MAP); - - if (CFRA != cfrao) { - BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); - } - } - } - glDisable(GL_BLEND); - if (v3d->zbuf) glEnable(GL_DEPTH_TEST); - - ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */ - free_pose(posen); - - /* restore */ - CFRA= cfrao; - ob->pose= poseo; - arm->flag= flago; - armature_rebuild_pose(ob, ob->data); - ob->mode |= OB_MODE_POSE; -} - - - -#endif // XXX temp file guards |