diff options
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_dynamicpaint.c | 12 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_explode.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvproject.c | 128 |
3 files changed, 57 insertions, 85 deletions
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index 4335d488656..97e2bf42d66 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -68,9 +68,6 @@ static void copyData(ModifierData *md, ModifierData *target) id_us_plus((ID *)surface->init_texture); } } - if (tpmd->brush) { - id_us_plus((ID *)tpmd->brush->mat); - } } static void freeData(ModifierData *md) @@ -105,12 +102,6 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) } } } - - if (pmd->brush) { - if (pmd->brush->flags & MOD_DPAINT_USE_MATERIAL) { - dataMask |= CD_MASK_MLOOPUV; - } - } return dataMask; } @@ -169,9 +160,6 @@ static void foreachIDLink(ModifierData *md, Object *ob, } } } - if (pmd->brush) { - walk(userData, ob, (ID **)&pmd->brush->mat, IDWALK_CB_USER); - } } static void foreachTexLink(ModifierData *UNUSED(md), Object *UNUSED(ob), diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 041289bf70a..4c04eadb265 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -147,7 +147,7 @@ static void createFacepa(ExplodeModifierData *emd, /* make tree of emitter locations */ tree = BLI_kdtree_new(totpart); for (p = 0, pa = psys->particles; p < totpart; p++, pa++) { - psys_particle_on_emitter(psmd, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, NULL, NULL, NULL, NULL, NULL); + psys_particle_on_emitter(psmd, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, NULL, NULL, NULL, NULL); BLI_kdtree_insert(tree, p, co); } BLI_kdtree_balance(tree); diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 386417e092a..cdad0a46dde 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -75,8 +75,6 @@ static void copyData(ModifierData *md, ModifierData *target) UVProjectModifierData *tumd = (UVProjectModifierData *) target; modifier_copyData_generic(md, target); - - id_us_plus((ID *)tumd->image); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) @@ -104,8 +102,6 @@ static void foreachIDLink(ModifierData *md, Object *ob, { UVProjectModifierData *umd = (UVProjectModifierData *) md; - walk(userData, ob, (ID **)&umd->image, IDWALK_CB_USER); - foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } @@ -133,7 +129,6 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, float (*coords)[3], (*co)[3]; MLoopUV *mloop_uv; int i, numVerts, numPolys, numLoops; - Image *image = umd->image; MPoly *mpoly, *mp; MLoop *mloop; Projector projectors[MOD_UVPROJECT_MAXPROJECTORS]; @@ -238,84 +233,73 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, mpoly = dm->getPolyArray(dm); mloop = dm->getLoopArray(dm); - Image **ob_image_array = NULL; - if (image) { - ob_image_array = BKE_object_material_edit_image_get_array(ob); - } - - /* apply coords as UVs, and apply image if tfaces are new */ + /* apply coords as UVs */ for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp) { - if (!image || (mp->mat_nr < ob->totcol ? ob_image_array[mp->mat_nr] : NULL) == image) { - if (num_projectors == 1) { - if (projectors[0].uci) { - unsigned int fidx = mp->totloop - 1; - do { - unsigned int lidx = mp->loopstart + fidx; - unsigned int vidx = mloop[lidx].v; - BLI_uvproject_from_camera(mloop_uv[lidx].uv, coords[vidx], projectors[0].uci); - } while (fidx--); - } - else { - /* apply transformed coords as UVs */ - unsigned int fidx = mp->totloop - 1; - do { - unsigned int lidx = mp->loopstart + fidx; - unsigned int vidx = mloop[lidx].v; - copy_v2_v2(mloop_uv[lidx].uv, coords[vidx]); - } while (fidx--); - } + if (num_projectors == 1) { + if (projectors[0].uci) { + unsigned int fidx = mp->totloop - 1; + do { + unsigned int lidx = mp->loopstart + fidx; + unsigned int vidx = mloop[lidx].v; + BLI_uvproject_from_camera(mloop_uv[lidx].uv, coords[vidx], projectors[0].uci); + } while (fidx--); } else { - /* multiple projectors, select the closest to face normal direction */ - float face_no[3]; - int j; - Projector *best_projector; - float best_dot; - - /* get the untransformed face normal */ - BKE_mesh_calc_poly_normal_coords(mp, mloop + mp->loopstart, (const float (*)[3])coords, face_no); - - /* find the projector which the face points at most directly - * (projector normal with largest dot product is best) - */ - best_dot = dot_v3v3(projectors[0].normal, face_no); - best_projector = &projectors[0]; - - for (j = 1; j < num_projectors; ++j) { - float tmp_dot = dot_v3v3(projectors[j].normal, - face_no); - if (tmp_dot > best_dot) { - best_dot = tmp_dot; - best_projector = &projectors[j]; - } + /* apply transformed coords as UVs */ + unsigned int fidx = mp->totloop - 1; + do { + unsigned int lidx = mp->loopstart + fidx; + unsigned int vidx = mloop[lidx].v; + copy_v2_v2(mloop_uv[lidx].uv, coords[vidx]); + } while (fidx--); + } + } + else { + /* multiple projectors, select the closest to face normal direction */ + float face_no[3]; + int j; + Projector *best_projector; + float best_dot; + + /* get the untransformed face normal */ + BKE_mesh_calc_poly_normal_coords(mp, mloop + mp->loopstart, (const float (*)[3])coords, face_no); + + /* find the projector which the face points at most directly + * (projector normal with largest dot product is best) + */ + best_dot = dot_v3v3(projectors[0].normal, face_no); + best_projector = &projectors[0]; + + for (j = 1; j < num_projectors; ++j) { + float tmp_dot = dot_v3v3(projectors[j].normal, + face_no); + if (tmp_dot > best_dot) { + best_dot = tmp_dot; + best_projector = &projectors[j]; } + } - if (best_projector->uci) { - unsigned int fidx = mp->totloop - 1; - do { - unsigned int lidx = mp->loopstart + fidx; - unsigned int vidx = mloop[lidx].v; - BLI_uvproject_from_camera(mloop_uv[lidx].uv, coords[vidx], best_projector->uci); - } while (fidx--); - } - else { - unsigned int fidx = mp->totloop - 1; - do { - unsigned int lidx = mp->loopstart + fidx; - unsigned int vidx = mloop[lidx].v; - mul_v2_project_m4_v3(mloop_uv[lidx].uv, best_projector->projmat, coords[vidx]); - } while (fidx--); - } + if (best_projector->uci) { + unsigned int fidx = mp->totloop - 1; + do { + unsigned int lidx = mp->loopstart + fidx; + unsigned int vidx = mloop[lidx].v; + BLI_uvproject_from_camera(mloop_uv[lidx].uv, coords[vidx], best_projector->uci); + } while (fidx--); + } + else { + unsigned int fidx = mp->totloop - 1; + do { + unsigned int lidx = mp->loopstart + fidx; + unsigned int vidx = mloop[lidx].v; + mul_v2_project_m4_v3(mloop_uv[lidx].uv, best_projector->projmat, coords[vidx]); + } while (fidx--); } } } MEM_freeN(coords); - if (ob_image_array) { - MEM_freeN(ob_image_array); - } - if (free_uci) { int j; for (j = 0; j < num_projectors; ++j) { |