diff options
author | Joshua Leung <aligorith@gmail.com> | 2012-05-01 20:19:13 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2012-05-01 20:19:13 +0400 |
commit | ffc9fcb1a1d58bb03b5cb60dc40f0fd91c3e8f3c (patch) | |
tree | a306e8589a8bb4718f1830d24b6fef6889e24c5e /source/blender/editors/object/object_edit.c | |
parent | fcb84663cd42dfdbb15204a6d65cec82d5ef110d (diff) |
Motion Paths GUI Cleanup
This commit refactors the way that the Motion Paths GUI works. The key problems
this tries to address are:
1) Mode error - Confusion about whether we're dealing with the Object or Pose
level Motion Paths panel
2) Display settings vs Baking Settings
In line with the original design intentions for the 2.5/6 Properties Editor,
I've now split out the actual baking-related settings away from the Properties
Editor:
* Now, when clicking "Calculate Paths" from the toolbar, you'll be prompted with
a dialog to select the start/end frames (and for bones, whether to bake from
heads or tails). This is less confusing than relying on firstly setting the
range via the display range settings (and baking using that), since many people
apparently only used the "around current" mode, and were confused why things
weren't working
* Added a display of the frame ranges of the current baked Motion Path on the
active Object/Bone. This makes it clearer/easier to debug if the path suddenly
starts disappearing after a certain frame.
* Replaced Calculate/Clear Paths in the panels with a single "Update" button if
there's already a baked Motion Path.
Hopefully these changes (in combination with some of the other bugfixes) will
make it more obvious how everything works.
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 8ab1d1372b7..9561a5972ff 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1125,14 +1125,43 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) BLI_freelistN(&targets); } +/* show popup to determine settings */ +static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *evt) +{ + Object *ob = CTX_data_active_object(C); + + if (ob == NULL) + return OPERATOR_CANCELLED; + + /* set default settings from existing/stored settings */ + { + bAnimVizSettings *avs = &ob->avs; + + RNA_int_set(op->ptr, "start_frame", avs->path_sf); + RNA_int_set(op->ptr, "end_frame", avs->path_ef); + } + + /* show popup dialog to allow editing of range... */ + // FIXME: hardcoded dimensions here are just arbitrary + return WM_operator_props_dialog_popup(C, op, 200, 200); +} + /* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */ static int object_calculate_paths_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + int start = RNA_int_get(op->ptr, "start_frame"); + int end = RNA_int_get(op->ptr, "end_frame"); /* set up path data for bones being calculated */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + bAnimVizSettings *avs = &ob->avs; + + /* grab baking settings from operator settings */ + avs->path_sf = start; + avs->path_ef = end; + /* verify that the selected object has the appropriate settings */ animviz_verify_motionpaths(op->reports, scene, ob, NULL); } @@ -1155,11 +1184,18 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot) ot->description = "Calculate motion paths for the selected objects"; /* api callbacks */ + ot->invoke = object_calculate_paths_invoke; ot->exec = object_calculate_paths_exec; ot->poll = ED_operator_object_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + RNA_def_int(ot->srna, "start_frame", 1, MINAFRAME, MAXFRAME, "Start", + "First frame to calculate object paths on", MINFRAME, MAXFRAME/2.0); + RNA_def_int(ot->srna, "end_frame", 250, MINAFRAME, MAXFRAME, "End", + "Last frame to calculate object paths on", MINFRAME, MAXFRAME/2.0); } /* --------- */ |