diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
commit | bdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch) | |
tree | d00eb50b749cb001e2b08272c91791e66740b05d /source/blender/blenkernel/intern/mesh.c | |
parent | 78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff) | |
parent | 7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff) |
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 1632f57c66e..07a1a5c5f44 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -78,45 +78,6 @@ #include "BLI_editVert.h" #include "BLI_arithb.h" -int update_realtime_texture(MTFace *tface, double time) -{ - Image *ima; - int inc = 0; - float diff; - int newframe; - - ima = tface->tpage; - - if (!ima) - return 0; - - if (ima->lastupdate<0) - ima->lastupdate = 0; - - if (ima->lastupdate>time) - ima->lastupdate=(float)time; - - if(ima->tpageflag & IMA_TWINANIM) { - if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1; - - /* check: is the bindcode not in the array? Then free. (still to do) */ - - diff = (float)(time-ima->lastupdate); - - inc = (int)(diff*(float)ima->animspeed); - - ima->lastupdate+=((float)inc/(float)ima->animspeed); - - newframe = ima->lastframe+inc; - - if (newframe > (int)ima->twend) - newframe = (int)ima->twsta-1 + (newframe-ima->twend)%(ima->twend-ima->twsta); - - ima->lastframe = newframe; - } - return inc; -} - void mesh_update_customdata_pointers(Mesh *me) { me->mvert = CustomData_get_layer(&me->vdata, CD_MVERT); @@ -526,7 +487,7 @@ void transform_mesh_orco_verts(Mesh *me, float (*orco)[3], int totvert, int inve /* rotates the vertices of a face in case v[2] or v[3] (vertex index) is = 0. this is necessary to make the if(mface->v4) check for quads work */ -void test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) +int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) { /* first test if the face is legal */ if(mface->v3 && mface->v3==mface->v4) { @@ -568,6 +529,8 @@ void test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) CustomData_swap(fdata, mfindex, corner_indices); } } + + return nr; } Mesh *get_mesh(Object *ob) @@ -764,8 +727,7 @@ void mball_to_mesh(ListBase *lb, Mesh *me) mface->v4= index[3]; mface->flag= ME_SMOOTH; - if(mface->v3==mface->v4) - mface->v4= 0; + test_index_face(mface, NULL, 0, (mface->v3==mface->v4)? 3: 4); mface++; index+= 4; @@ -1104,9 +1066,13 @@ float (*mesh_getRefKeyCos(Mesh *me, int *numVerts_r))[3] if(me->key && me->key->refkey) { if(numVerts_r) *numVerts_r= me->totvert; - cos= MEM_mallocN(sizeof(*cos)*me->totvert, "vertexcos1"); - + kb= me->key->refkey; + + /* prevent accessing invalid memory */ + if (me->totvert > kb->totelem) cos= MEM_callocN(sizeof(*cos)*me->totvert, "vertexcos1"); + else cos= MEM_mallocN(sizeof(*cos)*me->totvert, "vertexcos1"); + totvert= MIN2(kb->totelem, me->totvert); memcpy(cos, kb->data, sizeof(*cos)*totvert); @@ -1136,12 +1102,12 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned if(totuv==0) return NULL; - vmap= (UvVertMap*)MEM_mallocN(sizeof(*vmap), "UvVertMap"); + vmap= (UvVertMap*)MEM_callocN(sizeof(*vmap), "UvVertMap"); if (!vmap) return NULL; vmap->vert= (UvMapVert**)MEM_callocN(sizeof(*vmap->vert)*totvert, "UvMapVert*"); - buf= vmap->buf= (UvMapVert*)MEM_mallocN(sizeof(*vmap->buf)*totuv, "UvMapVert"); + buf= vmap->buf= (UvMapVert*)MEM_callocN(sizeof(*vmap->buf)*totuv, "UvMapVert"); if (!vmap->vert || !vmap->buf) { free_uv_vert_map(vmap); |