diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-05-07 03:54:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-05-07 03:54:52 +0300 |
commit | 78b2b5fc0e3063656ace8d37f18a8873f6ef06e6 (patch) | |
tree | bcebe026ba93b143d7cd352de14cccd1975344fd /source/blender | |
parent | 72cefdfd592148eebf99cb0259a6ce1912731434 (diff) | |
parent | 7b9c865afc6107e52696eebb22586a19ae54d554 (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 4 | ||||
-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 |
5 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index c0153dd8241..48b4540e3d9 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -446,8 +446,8 @@ bool BKE_modifier_is_preview(struct ModifierData *md); void BKE_modifiers_foreach_ID_link(struct Object *ob, IDWalkFunc walk, void *userData); void BKE_modifiers_foreach_tex_link(struct Object *ob, TexWalkFunc walk, void *userData); -struct ModifierData *BKE_modifiers_findby_type(struct Object *ob, ModifierType type); -struct ModifierData *BKE_modifiers_findby_name(struct Object *ob, const char *name); +struct ModifierData *BKE_modifiers_findby_type(const struct Object *ob, ModifierType type); +struct ModifierData *BKE_modifiers_findby_name(const struct Object *ob, const char *name); void BKE_modifiers_clear_errors(struct Object *ob); int BKE_modifiers_get_cage_index(const struct Scene *scene, struct Object *ob, diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 34b7c4234ec..3b67237f5eb 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -281,7 +281,7 @@ bool BKE_modifier_is_preview(ModifierData *md) return false; } -ModifierData *BKE_modifiers_findby_type(Object *ob, ModifierType type) +ModifierData *BKE_modifiers_findby_type(const Object *ob, ModifierType type) { LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { if (md->type == type) { @@ -291,7 +291,7 @@ ModifierData *BKE_modifiers_findby_type(Object *ob, ModifierType type) return NULL; } -ModifierData *BKE_modifiers_findby_name(Object *ob, const char *name) +ModifierData *BKE_modifiers_findby_name(const Object *ob, const char *name) { return BLI_findstring(&(ob->modifiers), name, offsetof(ModifierData, name)); } 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. */ |