diff options
-rw-r--r-- | source/blender/editors/object/object_add.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 918b3500a08..56697f41ec0 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -967,6 +967,23 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot) } /********************* Add Gpencil Operator ********************/ +bool object_gpencil_add_poll(bContext *C) +{ + Scene *scene = CTX_data_scene(C); + Object *obact = CTX_data_active_object(C); + + if ((scene == NULL) || (ID_IS_LINKED(scene))) { + return false; + } + + if (obact && obact->type == OB_GPENCIL) { + if (obact->mode != OB_MODE_OBJECT) { + return false; + } + } + + return true; +} static int object_gpencil_add_exec(bContext *C, wmOperator *op) { @@ -1073,7 +1090,7 @@ void OBJECT_OT_gpencil_add(wmOperatorType *ot) /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = object_gpencil_add_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = object_gpencil_add_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |