Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 504 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| bool BKE_object_support_modifier_type_check(const Object *ob, int modifier_type) | bool BKE_object_support_modifier_type_check(const Object *ob, int modifier_type) | ||||
| { | { | ||||
| const ModifierTypeInfo *mti; | const ModifierTypeInfo *mti; | ||||
| mti = modifierType_getInfo(modifier_type); | mti = modifierType_getInfo(modifier_type); | ||||
| /* only geometry objects should be able to get modifiers [#25291] */ | /* Only geometry objects should be able to get modifiers [#25291] */ | ||||
| if (!ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { | if (ob->type == OB_HAIR) { | ||||
| return false; | return (mti->modifyHair != NULL) || (mti->flags & eModifierTypeFlag_AcceptsVertexCosOnly); | ||||
| } | |||||
| else if (ob->type == OB_POINTCLOUD) { | |||||
| return (mti->modifyPointCloud != NULL) || | |||||
| (mti->flags & eModifierTypeFlag_AcceptsVertexCosOnly); | |||||
| } | } | ||||
| else if (ob->type == OB_VOLUME) { | |||||
| if (ob->type == OB_LATTICE && (mti->flags & eModifierTypeFlag_AcceptsLattice) == 0) { | return (mti->modifyVolume != NULL); | ||||
| } | |||||
| else if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { | |||||
| if (ob->type == OB_LATTICE && (mti->flags & eModifierTypeFlag_AcceptsVertexCosOnly) == 0) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| if (!((mti->flags & eModifierTypeFlag_AcceptsCVs) || | if (!((mti->flags & eModifierTypeFlag_AcceptsCVs) || | ||||
| (ob->type == OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh)))) { | (ob->type == OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh)))) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | |||||
| } | |||||
| void BKE_object_link_modifiers(Scene *scene, struct Object *ob_dst, const struct Object *ob_src) | void BKE_object_link_modifiers(Scene *scene, struct Object *ob_dst, const struct Object *ob_src) | ||||
| { | { | ||||
| ModifierData *md; | ModifierData *md; | ||||
| BKE_object_free_modifiers(ob_dst, 0); | BKE_object_free_modifiers(ob_dst, 0); | ||||
| if (!ELEM(ob_dst->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { | if (!ELEM(ob_dst->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { | ||||
| /* only objects listed above can have modifiers and linking them to objects | /* only objects listed above can have modifiers and linking them to objects | ||||
| * which doesn't have modifiers stack is quite silly */ | * which doesn't have modifiers stack is quite silly */ | ||||
| ▲ Show 20 Lines • Show All 4,053 Lines • Show Last 20 Lines | |||||