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>2018-08-20 07:12:37 +0300
committerJoshua Leung <aligorith@gmail.com>2018-08-20 07:12:37 +0300
commit6f2735b2bf6f2cd532a9a816c39cde17006afe49 (patch)
tree3aa6e9bbc7829ec616d1269cd0e905a0dca81ed8 /source/blender/editors/armature/pose_edit.c
parent76ea32d192693ac0d46270dd30c7e50a0bfcea62 (diff)
Motion Paths UI: "Update from Scene Range" operator
Make it easier to update the frame range for motion paths from the Scene's current frame range (render or preview range)
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r--source/blender/editors/armature/pose_edit.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index a2cd3c57101..571f766ee4c 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -436,6 +436,43 @@ void POSE_OT_paths_clear(wmOperatorType *ot)
RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
}
+/* --------- */
+
+static int pose_update_paths_range_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
+
+ if (ELEM(NULL, scene, ob, ob->pose)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* use Preview Range or Full Frame Range - whichever is in use */
+ ob->pose->avs.path_sf = PSFRA;
+ ob->pose->avs.path_ef = PEFRA;
+
+ /* tag for updates */
+ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void POSE_OT_paths_range_update(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Update Range from Scene";
+ ot->idname = "POSE_OT_paths_range_update";
+ ot->description = "Update frame range for motion paths from the Scene's current frame range";
+
+ /* callbacks */
+ ot->exec = pose_update_paths_range_exec;
+ ot->poll = ED_operator_posemode_exclusive;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/* ********************************************** */
#if 0 /* UNUSED 2.5 */
static void pose_copy_menu(Scene *scene)