diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-30 01:49:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-30 01:49:49 +0400 |
commit | 870aa901120fc8db499f9bea3a9a86006ef4cc3a (patch) | |
tree | b39a0a390179ba117310532545ff146dd3bb8dc5 /source/blender/modifiers | |
parent | de4eeb96946943289ac898525f09fc9c7afd4157 (diff) | |
parent | b820ec4ae4a62a05fc9ac6ca9c93a17128675407 (diff) |
svn merge ^/trunk/blender -r43733:43751
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean_util.c | 32 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_cloth.c | 7 |
2 files changed, 34 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 1f2c65e4cca..510179c01d7 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -374,10 +374,10 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( } // a hash table to remap materials to indices - if (mat) { - material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "CSG_mat gh"); + material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "CSG_mat gh"); + + if (mat) *totmat = 0; - } origindex_layer = result->getTessFaceDataArray(result, CD_ORIGINDEX); @@ -422,6 +422,32 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( else mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat)); } + else if(orig_mat) { + if(orig_ob == ob1) { + // No need to change materian index for faces from left operand + } + else { + // for faces from right operand checn if there's needed material in left operand and if it is, + // use index of that material, otherwise fallback to first material (material with index=0) + if (!BLI_ghash_haskey(material_hash, orig_mat)) { + int a; + + mat_nr = 0; + for(a = 0; a < ob1->totcol; a++) { + if(give_current_material(ob1, a+1) == orig_mat) { + mat_nr = a; + break; + } + } + + BLI_ghash_insert(material_hash, orig_mat, SET_INT_IN_POINTER(mat_nr)); + + mface->mat_nr = mat_nr; + } + else + mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat)); + } + } else mface->mat_nr = 0; diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 7e46d3f0fe3..f626a2f86fe 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -84,6 +84,10 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, } dm = get_dm(ob, NULL, derivedData, NULL, 0); + if(dm == derivedData) + dm = CDDM_copy(dm, 0); + + CDDM_apply_vert_coords(dm, vertexCos); clothModifier_do(clmd, md->scene, ob, dm, vertexCos); @@ -92,8 +96,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, result->release(result); } - if(dm != derivedData) - dm->release(dm); + dm->release(dm); } static void updateDepgraph( |