diff options
author | Jacques Lucke <jacques@blender.org> | 2022-05-06 16:17:44 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-05-06 16:17:44 +0300 |
commit | 2ba081f59bc62f1fc7f59a6391c001c5a9281c53 (patch) | |
tree | 5c068d7b8e08ba7c4cc61e87953caab6f4a2e054 /source | |
parent | cdd2c8bd07d1a37f7a8382a1d216f6660dcbc441 (diff) |
Curves: disable Empty Hair operator when there is no active mesh
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/object/object_add.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 4b838297b7b..820f500d172 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -2116,6 +2116,21 @@ static int object_curves_empty_hair_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static bool object_curves_empty_hair_add_poll(bContext *C) +{ + if (!U.experimental.use_new_curves_type) { + return false; + } + if (!ED_operator_objectmode(C)) { + return false; + } + Object *ob = CTX_data_active_object(C); + if (ob == nullptr || ob->type != OB_MESH) { + return false; + } + return true; +} + void OBJECT_OT_curves_empty_hair_add(wmOperatorType *ot) { ot->name = "Add Empty Curves"; @@ -2123,7 +2138,7 @@ void OBJECT_OT_curves_empty_hair_add(wmOperatorType *ot) ot->idname = "OBJECT_OT_curves_empty_hair_add"; ot->exec = object_curves_empty_hair_add_exec; - ot->poll = object_curves_add_poll; + ot->poll = object_curves_empty_hair_add_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |