[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47554] trunk/blender/source/blender: Bugfix [#31735] Performance issue related to object parenting to armature

Joshua Leung aligorith at gmail.com
Thu Jun 7 07:29:24 CEST 2012


Revision: 47554
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47554
Author:   aligorith
Date:     2012-06-07 05:29:10 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
Bugfix [#31735] Performance issue related to object parenting to armature

In the file included with the bugreport, framerates were dropping from 60fps to
11fps for an armature with several lattices parented, and a 5fps drop everytime
an object was parented to the armature.

Upon (re-)inspection of the code, it became apparent that this was being caused
by a block of code that would recalculate the parent (perhaps recursively) as it
thought the parent state was for the wrong timestamp. However, the timestamps
this was using was never really updated (except for a single place, which set it
to a single fixed value to force recalculations to take place), which meant that
this branch was run all the time. AFACT, this is a remnant from some of the old
timeoffset stuff + pre-Depsgraph timestamping hacks that are no longer used/set.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2012-06-07 01:46:28 UTC (rev 47553)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2012-06-07 05:29:10 UTC (rev 47554)
@@ -1927,12 +1927,7 @@
 void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
 {
 	float slowmat[4][4] = MAT4_UNITY;
-	float stime = ctime;
 	
-	/* new version: correct parent+vertexparent and track+parent */
-	/* this one only calculates direct attached parent and track */
-	/* is faster, but should keep track of timeoffs */
-	
 	if (ob == NULL) return;
 	
 	/* execute drivers only, as animation has already been done */
@@ -1941,21 +1936,8 @@
 	if (ob->parent) {
 		Object *par = ob->parent;
 		
-		/* hurms, code below conflicts with depgraph... (ton) */
-		/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
-		if (stime != par->ctime) {
-			// only for ipo systems? 
-			Object tmp = *par;
-			
-			if (par->proxy_from) ;  // was a copied matrix, no where_is! bad...
-			else BKE_object_where_is_calc_time(scene, par, ctime);
-			
-			solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
-			
-			*par = tmp;
-		}
-		else
-			solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
+		/* calculate parent matrix */
+		solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
 		
 		/* "slow parent" is definitely not threadsafe, and may also give bad results jumping around 
 		 * An old-fashioned hack which probably doesn't really cut it anymore
@@ -1974,10 +1956,7 @@
 		bConstraintOb *cob;
 		
 		cob = constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
-		
-		/* constraints need ctime, not stime. Some call BKE_object_where_is_calc_time and bsystem_time */
 		solve_constraints(&ob->constraints, cob, ctime);
-		
 		constraints_clear_evalob(cob);
 	}
 	

Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/scene.c	2012-06-07 01:46:28 UTC (rev 47553)
+++ trunk/blender/source/blender/blenkernel/intern/scene.c	2012-06-07 05:29:10 UTC (rev 47554)
@@ -610,8 +610,6 @@
 		/* not too nice... for recovering objects with lost data */
 		//if (ob->pose == NULL) base->flag &= ~OB_POSEMODE;
 		ob->flag = base->flag;
-		
-		ob->ctime = -1234567.0;  /* force ipo to be calculated later */
 	}
 	/* no full animation update, this to enable render code to work (render code calls own animation updates) */
 }

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-06-07 01:46:28 UTC (rev 47553)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-06-07 05:29:10 UTC (rev 47554)
@@ -6578,9 +6578,6 @@
 	/* no return after this point, otherwise leaks */
 	view3d_cached_text_draw_begin();
 	
-	/* patch? children objects with a timeoffs change the parents. How to solve! */
-	/* if ( ((int)ob->ctime) != F_(scene->r.cfra)) BKE_object_where_is_calc(scene, ob); */
-	
 	/* draw motion paths (in view space) */
 	if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 		bAnimVizSettings *avs = &ob->avs;




More information about the Bf-blender-cvs mailing list