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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-16 14:30:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-16 14:30:53 +0400
commit68dd3980638b6a1f0c766a1e023b393c0f36cacd (patch)
tree64846808a06af598e5df551ac4b500a352e46a17 /source
parente9ab58ad8f0fbcb84a08e8013d4b024bea648f96 (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')
-rw-r--r--source/blender/editors/space_action/action_select.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c13
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c266
3 files changed, 9 insertions, 272 deletions
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 1382d58482d..414999b2f2b 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -360,6 +360,8 @@ static EnumPropertyItem prop_column_select_types[] = {
/* ------------------- */
/* Selects all visible keyframes between the specified markers */
+/* TODO, this is almost an _exact_ duplicate of a function of the same name in graph_select.c
+ * should de-duplicate - campbell */
static void markers_selectkeys_between (bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 2ba79ee230a..c1268ec61f0 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -386,6 +386,8 @@ static EnumPropertyItem prop_column_select_types[] = {
/* ------------------- */
/* Selects all visible keyframes between the specified markers */
+/* TODO, this is almost an _exact_ duplicate of a function of the same name in action_select.c
+ * should de-duplicate - campbell */
static void markers_selectkeys_between (bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
@@ -393,7 +395,7 @@ static void markers_selectkeys_between (bAnimContext *ac)
int filter;
KeyframeEditFunc ok_cb, select_cb;
- KeyframeEditData ked;
+ KeyframeEditData ked= {{NULL}};
float min, max;
/* get extreme markers */
@@ -404,9 +406,8 @@ static void markers_selectkeys_between (bAnimContext *ac)
/* get editing funcs + data */
ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
select_cb= ANIM_editkeyframes_select(SELECT_ADD);
-
- memset(&ked, 0, sizeof(KeyframeEditData));
- ked.f1= min;
+
+ ked.f1= min;
ked.f2= max;
/* filter data */
@@ -416,8 +417,8 @@ static void markers_selectkeys_between (bAnimContext *ac)
/* select keys in-between */
for (ale= anim_data.first; ale; ale= ale->next) {
AnimData *adt= ANIM_nla_mapping_get(ac, ale);
-
- if (adt) {
+
+ if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
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