diff options
author | Colin Marmond <Kdaf> | 2022-04-26 13:29:22 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2022-04-26 13:33:35 +0300 |
commit | 4e57b6ce77b15709d7a76382c2d185f9c845532c (patch) | |
tree | 2ba2d7c1ef368799779fbd3fd484f72077101e36 /source/blender/editors/armature | |
parent | 6cf148227b220dd5087241ad01b6d2d6fe9afb80 (diff) |
Animation: Sensible frame range for motion paths
Motion paths can now be initialised to more sensible frame ranges,
rather than simply 1-250:
- Scene Frame Range
- Selected Keyframes
- All Keyframes
Reviewed By: sybren, looch, dfelinto, pablico
Maniphest Tasks: T93047
Differential Revision: https://developer.blender.org/D13687
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 2ad7a373012..cec83ffa0f0 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -222,16 +222,15 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEven bAnimVizSettings *avs = &ob->pose->avs; PointerRNA avs_ptr; - RNA_int_set(op->ptr, "start_frame", avs->path_sf); - RNA_int_set(op->ptr, "end_frame", avs->path_ef); - RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr); + RNA_enum_set(op->ptr, "display_type", RNA_enum_get(&avs_ptr, "type")); + RNA_enum_set(op->ptr, "range", RNA_enum_get(&avs_ptr, "range")); RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location")); } /* show popup dialog to allow editing of range... */ /* FIXME: hard-coded dimensions here are just arbitrary. */ - return WM_operator_props_dialog_popup(C, op, 200); + return WM_operator_props_dialog_popup(C, op, 270); } /* For the object with pose/action: create path curves for selected bones @@ -251,8 +250,9 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op) bAnimVizSettings *avs = &ob->pose->avs; PointerRNA avs_ptr; - avs->path_sf = RNA_int_get(op->ptr, "start_frame"); - avs->path_ef = RNA_int_get(op->ptr, "end_frame"); + avs->path_type = RNA_enum_get(op->ptr, "display_type"); + avs->path_range = RNA_enum_get(op->ptr, "range"); + animviz_motionpath_compute_range(ob, scene); RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr); RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location")); @@ -299,24 +299,18 @@ void POSE_OT_paths_calculate(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, - "start_frame", - 1, - MINAFRAME, - MAXFRAME, - "Start", - "First frame to calculate bone paths on", - MINFRAME, - MAXFRAME / 2.0); - RNA_def_int(ot->srna, - "end_frame", - 250, - MINAFRAME, - MAXFRAME, - "End", - "Last frame to calculate bone paths on", - MINFRAME, - MAXFRAME / 2.0); + RNA_def_enum(ot->srna, + "display_type", + rna_enum_motionpath_display_type_items, + MOTIONPATH_TYPE_RANGE, + "Display type", + ""); + RNA_def_enum(ot->srna, + "range", + rna_enum_motionpath_range_items, + MOTIONPATH_RANGE_SCENE, + "Computation Range", + ""); RNA_def_enum(ot->srna, "bake_location", @@ -338,7 +332,7 @@ static bool pose_update_paths_poll(bContext *C) return false; } -static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op)) +static int pose_update_paths_exec(bContext *C, wmOperator *op) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); Scene *scene = CTX_data_scene(C); @@ -346,6 +340,13 @@ static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op)) if (ELEM(NULL, ob, scene)) { return OPERATOR_CANCELLED; } + animviz_motionpath_compute_range(ob, scene); + + /* set up path data for bones being calculated */ + CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones_from_active_object) { + animviz_verify_motionpaths(op->reports, scene, ob, pchan); + } + CTX_DATA_END; /* Calculate the bones that now have motion-paths. */ /* TODO: only make for the selected bones? */ |