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
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2011-11-12 08:40:53 +0400
committerJoshua Leung <aligorith@gmail.com>2011-11-12 08:40:53 +0400
commit8da281210063e3216d19848ecc82545fb1aeb58f (patch)
tree2b7d10e08685c0980c2cee21aeb846d66a51d97a /source/blender
parent4e83c67baa9ee50d9f1620186ce71de68c21202f (diff)
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).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_anim.h3
-rw-r--r--source/blender/blenkernel/intern/anim.c8
-rw-r--r--source/blender/editors/armature/poseobject.c4
-rw-r--r--source/blender/editors/object/object_edit.c4
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c5
5 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 44aebdf6205..c2b4e30ef3b 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -40,6 +40,7 @@ struct ListBase;
struct bAnimVizSettings;
struct bMotionPath;
struct bPoseChannel;
+struct ReportList;
/* ---------------------------------------------------- */
/* Animation Visualisation */
@@ -49,7 +50,7 @@ void animviz_settings_init(struct bAnimVizSettings *avs);
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);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index c1f294fb102..36df1101a24 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -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 @@ void animviz_free_motionpath(bMotionPath *mpath)
* - 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 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel *
/* 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;
}
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index e89674e8a37..993c8420576 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -199,7 +199,7 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob)
/* 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 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
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;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 88182a31056..c39477cbf6c 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1461,7 +1461,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene)
/* 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 @@ static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
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;
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index e65b137e846..29133db8101 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -71,7 +71,7 @@ static void rna_AnimViz_path_start_frame_set(PointerRNA *ptr, int value)
{
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 @@ static void rna_AnimViz_path_end_frame_set(PointerRNA *ptr, int value)
{
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;
}