Fix Python API to correctly create Text3D objects. This is just a
temporary fix (duplicating code again), the *real* fix would be to once make one central function to create and init a text object for all places... I also tried to introduce compatibility code to be able to load old files with broken text objects (cu->tb == NULL due to missing init code). Hope it works :)
This commit is contained in:
@@ -658,6 +658,9 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
||||
if (cu->strinfo==NULL) { /* old file */
|
||||
cu->strinfo = MEM_callocN((slen+1) * sizeof(CharInfo), "strinfo compat");
|
||||
}
|
||||
if (cu->tb==NULL) {
|
||||
cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "TextBox compat");
|
||||
}
|
||||
|
||||
vfd= vfont_get_data(vfont);
|
||||
if(!vfd) goto errcse;
|
||||
|
||||
@@ -265,6 +265,11 @@ PyObject *M_Text3d_New( PyObject * self, PyObject * args )
|
||||
bltext3d->str= MEM_mallocN(12, "str");
|
||||
strcpy(bltext3d->str, "Text");
|
||||
bltext3d->pos= 4;
|
||||
|
||||
bltext3d->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo");
|
||||
bltext3d->totbox= bltext3d->actbox= 1;
|
||||
bltext3d->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
|
||||
bltext3d->tb[0].w = bltext3d->tb[0].h = 0.0;
|
||||
|
||||
if( bltext3d == NULL ) /* bail out if add_curve() failed */
|
||||
return ( EXPP_ReturnPyObjError
|
||||
|
||||
Reference in New Issue
Block a user