From 80450331c7cc015f471dbafc3c783fafd1707cf5 Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Wed, 24 Mar 2021 16:17:59 +0100 Subject: Fix T86884: Don't remove the "line art object add" enum item We would not add the "object line art" enum to the operator enum list, if there were no active object in the scene. This would make it impossible to call this operator from python code as the enum would we hidden when we were not in a viewport context. Always make the operator available, having no active object is not a strict requirement for the operator to work, so expose it always. --- source/blender/editors/object/object_add.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'source/blender/editors/object') diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e4527740164..b3fb497aa9a 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1440,7 +1440,7 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static const EnumPropertyItem *object_gpencil_add_options(bContext *C, +static const EnumPropertyItem *object_gpencil_add_options(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) @@ -1453,18 +1453,9 @@ static const EnumPropertyItem *object_gpencil_add_options(bContext *C, /* Default types. */ for (i = 0; i < orig_count; i++) { - if (item_ref[i].value == GP_LRT_OBJECT || item_ref[i].value == GP_LRT_COLLECTION || - item_ref[i].value == GP_LRT_SCENE) { - if (item_ref[i].value == GP_LRT_SCENE) { - /* separator before line art types */ - RNA_enum_item_add_separator(&item, &totitem); - } - else if (item_ref[i].value == GP_LRT_OBJECT) { - Object *ob = CTX_data_active_object(C); - if (!ob || ob->type != OB_MESH) { - continue; - } - } + if (item_ref[i].value == GP_LRT_SCENE) { + /* separator before line art types */ + RNA_enum_item_add_separator(&item, &totitem); } RNA_enum_item_add(&item, &totitem, &item_ref[i]); } -- cgit v1.2.3