Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_boolean.cc
| Show First 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | # endif | ||||
| if ((bmd->flag & eBooleanModifierFlag_Object) && bmd->object == nullptr) { | if ((bmd->flag & eBooleanModifierFlag_Object) && bmd->object == nullptr) { | ||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| meshes.append(mesh); | meshes.append(mesh); | ||||
| obmats.append((float4x4 *)&ctx->object->obmat); | obmats.append((float4x4 *)&ctx->object->obmat); | ||||
| material_remaps.append({}); | material_remaps.append({}); | ||||
| if (bmd->flag & eBooleanModifierFlag_Object) { | if (bmd->flag & eBooleanModifierFlag_Object) { | ||||
| Mesh *mesh_operand = BKE_modifier_get_evaluated_mesh_from_evaluated_object(bmd->object, false); | Mesh *mesh_operand = BKE_modifier_get_evaluated_mesh_from_evaluated_object(bmd->object); | ||||
| if (!mesh_operand) { | if (!mesh_operand) { | ||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| BKE_mesh_wrapper_ensure_mdata(mesh_operand); | BKE_mesh_wrapper_ensure_mdata(mesh_operand); | ||||
| meshes.append(mesh_operand); | meshes.append(mesh_operand); | ||||
| obmats.append((float4x4 *)&bmd->object->obmat); | obmats.append((float4x4 *)&bmd->object->obmat); | ||||
| material_remaps.append(get_material_remap(ctx->object, bmd->object)); | material_remaps.append(get_material_remap(ctx->object, bmd->object)); | ||||
| } | } | ||||
| else if (bmd->flag & eBooleanModifierFlag_Collection) { | else if (bmd->flag & eBooleanModifierFlag_Collection) { | ||||
| Collection *collection = bmd->collection; | Collection *collection = bmd->collection; | ||||
| /* Allow collection to be empty; then target mesh will just removed self-intersections. */ | /* Allow collection to be empty; then target mesh will just removed self-intersections. */ | ||||
| if (collection) { | if (collection) { | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) { | FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) { | ||||
| if (ob->type == OB_MESH && ob != ctx->object) { | if (ob->type == OB_MESH && ob != ctx->object) { | ||||
| Mesh *collection_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob, false); | Mesh *collection_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob); | ||||
| if (!collection_mesh) { | if (!collection_mesh) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| BKE_mesh_wrapper_ensure_mdata(collection_mesh); | BKE_mesh_wrapper_ensure_mdata(collection_mesh); | ||||
| meshes.append(collection_mesh); | meshes.append(collection_mesh); | ||||
| obmats.append((float4x4 *)&ob->obmat); | obmats.append((float4x4 *)&ob->obmat); | ||||
| material_remaps.append(get_material_remap(ctx->object, ob)); | material_remaps.append(get_material_remap(ctx->object, ob)); | ||||
| } | } | ||||
| Show All 39 Lines | #endif | ||||
| if (bmd->flag & eBooleanModifierFlag_Object) { | if (bmd->flag & eBooleanModifierFlag_Object) { | ||||
| if (bmd->object == nullptr) { | if (bmd->object == nullptr) { | ||||
| return result; | return result; | ||||
| } | } | ||||
| Object *operand_ob = bmd->object; | Object *operand_ob = bmd->object; | ||||
| Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob, | Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob); | ||||
| false); | |||||
| if (mesh_operand_ob) { | if (mesh_operand_ob) { | ||||
| /* XXX This is utterly non-optimal, we may go from a bmesh to a mesh back to a bmesh! | /* XXX This is utterly non-optimal, we may go from a bmesh to a mesh back to a bmesh! | ||||
| * But for 2.90 better not try to be smart here. */ | * But for 2.90 better not try to be smart here. */ | ||||
| BKE_mesh_wrapper_ensure_mdata(mesh_operand_ob); | BKE_mesh_wrapper_ensure_mdata(mesh_operand_ob); | ||||
| /* when one of objects is empty (has got no faces) we could speed up | /* when one of objects is empty (has got no faces) we could speed up | ||||
| * calculation a bit returning one of objects' derived meshes (or empty one) | * calculation a bit returning one of objects' derived meshes (or empty one) | ||||
| * Returning mesh is depended on modifiers operation (sergey) */ | * Returning mesh is depended on modifiers operation (sergey) */ | ||||
| Show All 17 Lines | #endif | ||||
| } | } | ||||
| else { | else { | ||||
| if (collection == nullptr) { | if (collection == nullptr) { | ||||
| return result; | return result; | ||||
| } | } | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, operand_ob) { | FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, operand_ob) { | ||||
| if (operand_ob->type == OB_MESH && operand_ob != ctx->object) { | if (operand_ob->type == OB_MESH && operand_ob != ctx->object) { | ||||
| Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob, | Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob); | ||||
| false); | |||||
| if (mesh_operand_ob == nullptr) { | if (mesh_operand_ob == nullptr) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* XXX This is utterly non-optimal, we may go from a bmesh to a mesh back to a bmesh! | /* XXX This is utterly non-optimal, we may go from a bmesh to a mesh back to a bmesh! | ||||
| * But for 2.90 better not try to be smart here. */ | * But for 2.90 better not try to be smart here. */ | ||||
| BKE_mesh_wrapper_ensure_mdata(mesh_operand_ob); | BKE_mesh_wrapper_ensure_mdata(mesh_operand_ob); | ||||
| ▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines | |||||