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.
This commit is contained in:
parent
ee0ec0f2af
commit
7b9c865afc
|
@ -450,8 +450,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,
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) ||
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Reference in New Issue