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:
authorAntonioya <blendergit@gmail.com>2019-01-21 20:29:02 +0300
committerAntonioya <blendergit@gmail.com>2019-01-21 20:29:02 +0300
commit48149459e46fb45b51680e937962b28045623932 (patch)
tree6aced7869c0111deea664ffdb3f1b2d827a60f87
parent0af8ad51c07f987d8cf449efd95a7068f7edeffa (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.
-rw-r--r--source/blender/editors/object/object_add.c19
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;