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)
This commit is contained in:
2018-08-20 16:12:37 +12:00
parent 76ea32d192
commit 6f2735b2bf
7 changed files with 84 additions and 0 deletions

View File

@@ -1449,6 +1449,43 @@ void OBJECT_OT_paths_clear(wmOperatorType *ot)
RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
}
/* --------- */
static int object_update_paths_range_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
/* loop over all edtiable objects in scene */
CTX_DATA_BEGIN(C, Object *, ob, editable_objects)
{
/* use Preview Range or Full Frame Range - whichever is in use */
ob->avs.path_sf = PSFRA;
ob->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_TRANSFORM, NULL);
}
CTX_DATA_END;
return OPERATOR_FINISHED;
}
void OBJECT_OT_paths_range_update(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Update Range from Scene";
ot->idname = "OBJECT_OT_paths_range_update";
ot->description = "Update frame range for motion paths from the Scene's current frame range";
/* callbacks */
ot->exec = object_update_paths_range_exec;
ot->poll = ED_operator_object_active_editable;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** Smooth/Flat *********************/

View File

@@ -89,6 +89,7 @@ void OBJECT_OT_shade_flat(struct wmOperatorType *ot);
void OBJECT_OT_paths_calculate(struct wmOperatorType *ot);
void OBJECT_OT_paths_update(struct wmOperatorType *ot);
void OBJECT_OT_paths_clear(struct wmOperatorType *ot);
void OBJECT_OT_paths_range_update(struct wmOperatorType *ot);
void OBJECT_OT_forcefield_toggle(struct wmOperatorType *ot);
void OBJECT_OT_move_to_collection(struct wmOperatorType *ot);

View File

@@ -78,6 +78,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_paths_calculate);
WM_operatortype_append(OBJECT_OT_paths_update);
WM_operatortype_append(OBJECT_OT_paths_clear);
WM_operatortype_append(OBJECT_OT_paths_range_update);
WM_operatortype_append(OBJECT_OT_forcefield_toggle);
WM_operatortype_append(OBJECT_OT_parent_set);