[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41764] trunk/blender/source/blender: Bugfix [#29125] Motion paths odd behaviour

Joshua Leung aligorith at gmail.com
Sat Nov 12 05:40:59 CET 2011


Revision: 41764
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41764
Author:   aligorith
Date:     2011-11-12 04:40:53 +0000 (Sat, 12 Nov 2011)
Log Message:
-----------
Bugfix [#29125] Motion paths odd behaviour

* Made it impossible to try to calculate/create new motion paths lasting 0
frames (i.e. 250 to 250) since we cannot allocate a zero-length array for these.
Start frame can now be at most end-frame - 1, and end frame at least start frame
+ 1

* If an invalid configuration does occur, warnings/reports will now be issued in
response to this instead of silently failing (as per this bugreport).

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_anim.h
    trunk/blender/source/blender/blenkernel/intern/anim.c
    trunk/blender/source/blender/editors/armature/poseobject.c
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/blender/makesrna/intern/rna_animviz.c

Modified: trunk/blender/source/blender/blenkernel/BKE_anim.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_anim.h	2011-11-12 03:59:45 UTC (rev 41763)
+++ trunk/blender/source/blender/blenkernel/BKE_anim.h	2011-11-12 04:40:53 UTC (rev 41764)
@@ -40,6 +40,7 @@
 struct bAnimVizSettings;
 struct bMotionPath;
 struct bPoseChannel;
+struct ReportList;
 
 /* ---------------------------------------------------- */
 /* Animation Visualisation */
@@ -49,7 +50,7 @@
 void animviz_free_motionpath_cache(struct bMotionPath *mpath);
 void animviz_free_motionpath(struct bMotionPath *mpath);
 
-struct bMotionPath *animviz_verify_motionpaths(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan);
+struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan);
 
 void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets);
 void animviz_calc_motionpaths(struct Scene *scene, ListBase *targets);

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c	2011-11-12 03:59:45 UTC (rev 41763)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c	2011-11-12 04:40:53 UTC (rev 41764)
@@ -67,6 +67,7 @@
 #include "BKE_utildefines.h"
 #include "BKE_depsgraph.h"
 #include "BKE_anim.h"
+#include "BKE_report.h"
 
 
 // XXX bad level call...
@@ -147,7 +148,7 @@
  *	- ob: object to add paths for (must be provided)
  *	- pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed)
  */
-bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel *pchan)
+bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan)
 {
 	bAnimVizSettings *avs;
 	bMotionPath *mpath, **dst;
@@ -170,6 +171,11 @@
 
 	/* avoid 0 size allocs */
 	if (avs->path_sf >= avs->path_ef) {
+		BKE_reportf(reports, RPT_ERROR,
+					"Motion Path frame extents invalid for %s (%d to %d).%s\n",
+					(pchan)? pchan->name : ob->id.name,
+					avs->path_sf, avs->path_ef,
+					(avs->path_sf == avs->path_ef)? " Cannot have single-frame paths." : "");
 		return NULL;
 	}
 

Modified: trunk/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseobject.c	2011-11-12 03:59:45 UTC (rev 41763)
+++ trunk/blender/source/blender/editors/armature/poseobject.c	2011-11-12 04:40:53 UTC (rev 41764)
@@ -199,7 +199,7 @@
 /* For the object with pose/action: create path curves for selected bones 
  * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
  */
-static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
+static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
 {
 	ScrArea *sa= CTX_wm_area(C);
 	Scene *scene= CTX_data_scene(C);
@@ -218,7 +218,7 @@
 	CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) 
 	{
 		/* verify makes sure that the selected bone has a bone with the appropriate settings */
-		animviz_verify_motionpaths(scene, ob, pchan);
+		animviz_verify_motionpaths(op->reports, scene, ob, pchan);
 	}
 	CTX_DATA_END;
 	

Modified: trunk/blender/source/blender/editors/object/object_edit.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_edit.c	2011-11-12 03:59:45 UTC (rev 41763)
+++ trunk/blender/source/blender/editors/object/object_edit.c	2011-11-12 04:40:53 UTC (rev 41764)
@@ -1461,7 +1461,7 @@
 /* For the object with pose/action: create path curves for selected bones 
  * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
  */
-static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
+static int object_calculate_paths_exec (bContext *C, wmOperator *op)
 {
 	Scene *scene= CTX_data_scene(C);
 	
@@ -1469,7 +1469,7 @@
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)  
 	{
 		/* verify makes sure that the selected bone has a bone with the appropriate settings */
-		animviz_verify_motionpaths(scene, ob, NULL);
+		animviz_verify_motionpaths(op->reports, scene, ob, NULL);
 	}
 	CTX_DATA_END;
 	

Modified: trunk/blender/source/blender/makesrna/intern/rna_animviz.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_animviz.c	2011-11-12 03:59:45 UTC (rev 41763)
+++ trunk/blender/source/blender/makesrna/intern/rna_animviz.c	2011-11-12 04:40:53 UTC (rev 41764)
@@ -71,7 +71,7 @@
 {
 	bAnimVizSettings *data= (bAnimVizSettings*)ptr->data;
 	
-	CLAMP(value, 1, data->path_ef);
+	CLAMP(value, 1, data->path_ef-1);
 	data->path_sf= value;
 }
 
@@ -79,7 +79,8 @@
 {
 	bAnimVizSettings *data= (bAnimVizSettings*)ptr->data;
 	
-	CLAMP(value, data->path_sf, (int)(MAXFRAMEF/2));
+	// XXX: watchit! Path Start > MAXFRAME/2 could be a problem...
+	CLAMP(value, data->path_sf+1, (int)(MAXFRAMEF/2));
 	data->path_ef= value;
 }
 




More information about the Bf-blender-cvs mailing list