diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-25 23:17:24 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-26 01:02:13 +0400 |
commit | cc55913798aecbdeb3fc6e49c16a26ccbddebd9b (patch) | |
tree | 588bffc09b32253a2a5a12b513dc3b5180cfe40c /source/blender/blenkernel/intern/displist.c | |
parent | a5c7b9202b8451097ba6acf6e3f19bc5cdf091fd (diff) |
Fix T37225: UV map for closed curves incorrectly generated
Summary:
Curve ORCO was not calculating properly for cyclic 2D curves.
- Needed to split vertices for blender internal renderer.
Otherwise it's not possible to map last face to a proper
texture location.
- Needed to tweak curve->mesh conversion to respect cyclic
flag along U direction.
- Removed check for orcodm in curve.c:add_orco_dm since
this code is only called if there're enabled constructive
modifiers on the curve.
Reviewers: brecht
Maniphest Tasks: T37225
Differential Revision: http://developer.blender.org/D45
Diffstat (limited to 'source/blender/blenkernel/intern/displist.c')
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 6a89ca2cb84..3f35ced3550 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1086,7 +1086,7 @@ static DerivedMesh *create_orco_dm(Scene *scene, Object *ob) return dm; } -static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *orcodm) +static void add_orco_dm(Object *ob, DerivedMesh *dm, DerivedMesh *orcodm) { float (*orco)[3], (*layerorco)[3]; int totvert, a; @@ -1094,23 +1094,12 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh * totvert = dm->getNumVerts(dm); - if (orcodm) { - orco = MEM_callocN(sizeof(float) * 3 * totvert, "dm orco"); + orco = MEM_callocN(sizeof(float) * 3 * totvert, "dm orco"); - if (orcodm->getNumVerts(orcodm) == totvert) - orcodm->getVertCos(orcodm, orco); - else - dm->getVertCos(dm, orco); - } - else { - int totvert_curve; - orco = (float(*)[3])BKE_curve_make_orco(scene, ob, &totvert_curve); - if (totvert != totvert_curve) { - MEM_freeN(orco); - orco = MEM_callocN(sizeof(float) * 3 * totvert, "dm orco"); - dm->getVertCos(dm, orco); - } - } + if (orcodm->getNumVerts(orcodm) == totvert) + orcodm->getVertCos(orcodm, orco); + else + dm->getVertCos(dm, orco); for (a = 0; a < totvert; a++) { float *co = orco[a]; @@ -1157,6 +1146,15 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina md = pretessellatePoint->next; } + /* If modifiers are disabled, we wouldn't be here because + * this function is only called if there're enabled constructive + * modifiers applied on the curve. + * + * This means we can create ORCO DM in advance and assume it's + * never NULL. + */ + orcodm = create_orco_dm(scene, ob); + for (; md; md = md->next) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -1167,9 +1165,6 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina if (mti->type != eModifierTypeType_Constructive) continue; - if (!orcodm) - orcodm = create_orco_dm(scene, ob); - ndm = modwrap_applyModifier(md, ob, orcodm, app_flag); if (ndm) { @@ -1182,7 +1177,7 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina } /* add an orco layer if needed */ - add_orco_dm(scene, ob, derivedFinal, orcodm); + add_orco_dm(ob, derivedFinal, orcodm); if (orcodm) orcodm->release(orcodm); |