[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42666] trunk/blender/source/blender/ editors: remove duplicate if'0'd functions, same versions are in drawarmature.c.

Campbell Barton ideasman42 at gmail.com
Fri Dec 16 11:31:04 CET 2011


Revision: 42666
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42666
Author:   campbellbarton
Date:     2011-12-16 10:30:53 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
remove duplicate if'0'd functions, same versions are in drawarmature.c.
also added note of function to de-duplicate.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_action/action_select.c
    trunk/blender/source/blender/editors/space_graph/graph_select.c
    trunk/blender/source/blender/editors/space_view3d/drawanimviz.c

Modified: trunk/blender/source/blender/editors/space_action/action_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_select.c	2011-12-16 10:18:59 UTC (rev 42665)
+++ trunk/blender/source/blender/editors/space_action/action_select.c	2011-12-16 10:30:53 UTC (rev 42666)
@@ -360,6 +360,8 @@
 /* ------------------- */ 
 
 /* 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};

Modified: trunk/blender/source/blender/editors/space_graph/graph_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_select.c	2011-12-16 10:18:59 UTC (rev 42665)
+++ trunk/blender/source/blender/editors/space_graph/graph_select.c	2011-12-16 10:30:53 UTC (rev 42666)
@@ -386,6 +386,8 @@
 /* ------------------- */ 
 
 /* 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 @@
 	int filter;
 	
 	KeyframeEditFunc ok_cb, select_cb;
-	KeyframeEditData ked;
+	KeyframeEditData ked= {{NULL}};
 	float min, max;
 	
 	/* get extreme markers */
@@ -404,9 +406,8 @@
 	/* 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 @@
 	/* 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);

Modified: trunk/blender/source/blender/editors/space_view3d/drawanimviz.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawanimviz.c	2011-12-16 10:18:59 UTC (rev 42665)
+++ trunk/blender/source/blender/editors/space_view3d/drawanimviz.c	2011-12-16 10:30:53 UTC (rev 42666)
@@ -312,269 +312,3 @@
 	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




More information about the Bf-blender-cvs mailing list