diff options
author | Antonioya <blendergit@gmail.com> | 2019-01-21 20:29:02 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-01-21 20:29:02 +0300 |
commit | 48149459e46fb45b51680e937962b28045623932 (patch) | |
tree | 6aced7869c0111deea664ffdb3f1b2d827a60f87 /source/blender | |
parent | 0af8ad51c07f987d8cf449efd95a7068f7edeffa (diff) |
Fix T60714: Avoid creation of nested objects
In grease pencil is not logic add an object inside other object in edit mode. The object must be created only in Object mode.
Diffstat (limited to 'source/blender')
-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; |