diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-05-07 03:44:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-05-07 03:52:14 +0300 |
commit | 7b9c865afc6107e52696eebb22586a19ae54d554 (patch) | |
tree | 2fb0a5765a9e76bbf5eed7d81d9050f8fd304b61 /source/blender/editors | |
parent | ee0ec0f2af4f03340c4fc91495f702bb67a96c33 (diff) |
Fix inconsistency setting particle edit-mode
The check to include particle edit mode in the object-mode drop-down
didn't match the poll function to edit particle edit mode.
Share the check between both functions.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_object.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 9 |
3 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 8279268bfd0..6f88ab4253a 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -247,6 +247,7 @@ void ED_object_texture_paint_mode_enter(struct bContext *C); void ED_object_texture_paint_mode_exit_ex(struct Main *bmain, struct Scene *scene, Object *ob); void ED_object_texture_paint_mode_exit(struct bContext *C); +bool ED_object_particle_edit_mode_supported(const Object *ob); void ED_object_particle_edit_mode_enter_ex(struct Depsgraph *depsgraph, struct Scene *scene, Object *ob); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 07c8e7725e3..d3b4b91881c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1590,12 +1590,9 @@ static const EnumPropertyItem *object_mode_set_itemsf(bContext *C, return rna_enum_object_mode_items; } - Object *ob = CTX_data_active_object(C); + const Object *ob = CTX_data_active_object(C); if (ob) { - const bool use_mode_particle_edit = (BLI_listbase_is_empty(&ob->particlesystem) == false) || - (ob->soft != NULL) || - (BKE_modifiers_findby_type(ob, eModifierType_Cloth) != - NULL); + const bool use_mode_particle_edit = ED_object_particle_edit_mode_supported(ob); while (input->identifier) { if ((input->value == OB_MODE_EDIT && OB_TYPE_SUPPORT_EDITMODE(ob->type)) || (input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) || diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index de4ad913d6d..5b545784e5b 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -5375,8 +5375,7 @@ static bool particle_edit_toggle_poll(bContext *C) return 0; } - return (ob->particlesystem.first || BKE_modifiers_findby_type(ob, eModifierType_Cloth) || - BKE_modifiers_findby_type(ob, eModifierType_Softbody)); + return ED_object_particle_edit_mode_supported(ob); } static void free_all_psys_edit(Object *object) @@ -5391,6 +5390,12 @@ static void free_all_psys_edit(Object *object) } } +bool ED_object_particle_edit_mode_supported(const Object *ob) +{ + return (ob->particlesystem.first || BKE_modifiers_findby_type(ob, eModifierType_Cloth) || + BKE_modifiers_findby_type(ob, eModifierType_Softbody)); +} + void ED_object_particle_edit_mode_enter_ex(Depsgraph *depsgraph, Scene *scene, Object *ob) { /* Needed so #ParticleSystemModifierData.mesh_final is set. */ |