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>2016-02-06 07:57:50 +0300
committerJoshua Leung <aligorith@gmail.com>2016-02-07 03:32:13 +0300
commit76eac1ae70001f5b2b0fe1d064f260db8509b246 (patch)
treef1d2e6e63c6602cef09126dbd5628d0e93b7a33e /source/blender/editors/object/object_edit.c
parent7320df2e61cbf7abd652a7a4790a5e595a8c2a1a (diff)
Motion Paths: Use custom poll functions for "Update" operator
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r--source/blender/editors/object/object_edit.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 9940ad896b1..176d75c39ff 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1281,6 +1281,16 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot)
/* --------- */
+static int object_update_paths_poll(bContext *C)
+{
+ if (ED_operator_object_active_editable(C)) {
+ Object *ob = CTX_data_active_object(C);
+ return (ob->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) != 0;
+ }
+
+ return false;
+}
+
static int object_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
@@ -1306,7 +1316,7 @@ void OBJECT_OT_paths_update(wmOperatorType *ot)
/* api callbakcs */
ot->exec = object_update_paths_exec;
- ot->poll = ED_operator_object_active_editable; /* TODO: this should probably check for existing paths */
+ ot->poll = object_update_paths_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;