fix [#35335] Crash when rendering a text object with a remesh modifier and a material texture

This commit is contained in:
Campbell Barton 2013-05-13 07:13:28 +00:00
parent 2e478ca76d
commit 6bd58ac967
4 changed files with 13 additions and 4 deletions

@ -83,7 +83,7 @@ void BKE_curve_editNurb_keyIndex_free(struct EditNurb *editnurb);
void BKE_curve_editNurb_free(struct Curve *cu);
struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu);
float *BKE_curve_make_orco(struct Scene *scene, struct Object *ob);
float *BKE_curve_make_orco(struct Scene *scene, struct Object *ob, int *r_numVerts);
float *BKE_curve_surf_make_orco(struct Object *ob);
void BKE_curve_bevelList_make(struct Object *ob);

@ -1328,7 +1328,7 @@ float *BKE_curve_surf_make_orco(Object *ob)
/* NOTE: This routine is tied to the order of vertex
* built by displist and as passed to the renderer.
*/
float *BKE_curve_make_orco(Scene *scene, Object *ob)
float *BKE_curve_make_orco(Scene *scene, Object *ob, int *r_numVerts)
{
Curve *cu = ob->data;
DispList *dl;
@ -1358,6 +1358,9 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob)
}
}
if (r_numVerts)
*r_numVerts = numVerts;
fp = coord_array = MEM_mallocN(3 * sizeof(float) * numVerts, "cu_orco");
for (dl = disp.first; dl; dl = dl->next) {
if (dl->type == DL_INDEX3) {

@ -1102,7 +1102,13 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *
dm->getVertCos(dm, orco);
}
else {
orco = (float(*)[3])BKE_curve_make_orco(scene, ob);
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);
}
}
for (a = 0; a < totvert; a++) {

@ -871,7 +871,7 @@ static float *get_object_orco(Render *re, Object *ob)
if (!orco) {
if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
orco = BKE_curve_make_orco(re->scene, ob);
orco = BKE_curve_make_orco(re->scene, ob, NULL);
}
else if (ob->type==OB_SURF) {
orco = BKE_curve_surf_make_orco(ob);