Revision: 15025
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15025
Author:   bdiego
Date:     2008-05-28 04:36:27 +0200 (Wed, 28 May 2008)

Log Message:
-----------
branches/blender-2.47

Merge from trunk:
        Revision: 14994
        Revision: 14996
        Revision: 14999
        Revision: 15000
        Revision: 15005
        Revision: 15006
        Revision: 15011
        Revision: 15013
        Revision: 15023

Modified Paths:
--------------
    branches/blender-2.47/release/scripts/uv_seams_from_islands.py
    branches/blender-2.47/release/scripts/uvcalc_lightmap.py
    branches/blender-2.47/source/blender/blenkernel/intern/modifier.c
    branches/blender-2.47/source/blender/python/api2_2x/sceneRender.c
    branches/blender-2.47/source/blender/render/intern/source/envmap.c
    branches/blender-2.47/source/blender/render/intern/source/pipeline.c
    branches/blender-2.47/source/blender/src/drawobject.c
    branches/blender-2.47/source/blender/src/editnode.c
    branches/blender-2.47/source/blender/src/interface.c
    branches/blender-2.47/source/blender/src/toets.c

Modified: branches/blender-2.47/release/scripts/uv_seams_from_islands.py
===================================================================
--- branches/blender-2.47/release/scripts/uv_seams_from_islands.py      
2008-05-28 01:51:35 UTC (rev 15024)
+++ branches/blender-2.47/release/scripts/uv_seams_from_islands.py      
2008-05-28 02:36:27 UTC (rev 15025)
@@ -1,12 +1,31 @@
 #!BPY
 """
 Name: 'Seams from Islands'
-Blender: 243
+Blender: 246
 Group: 'UV'
 Tooltip: 'Add seams onto the mesh at the bounds of UV islands'
 """
 
-# Add a licence here if you wish to re-distribute, we recommend the GPL
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# Script copyright (C) Campbell Barton
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+# --------------------------------------------------------------------------
 
 from Blender import Scene, Mesh, Window, sys
 import BPyMessages
@@ -37,8 +56,11 @@
        # add seams
        SEAM = Mesh.EdgeFlags.SEAM
        for ed in me.edges:
-               if len(set(edge_uvs[ed.key])) > 1:
-                       ed.flag |= SEAM
+               try: # the edge might not be in a face
+                       if len(set(edge_uvs[ed.key])) > 1:
+                               ed.flag |= SEAM
+               except:
+                       pass
 
 def main():
        

Modified: branches/blender-2.47/release/scripts/uvcalc_lightmap.py
===================================================================
--- branches/blender-2.47/release/scripts/uvcalc_lightmap.py    2008-05-28 
01:51:35 UTC (rev 15024)
+++ branches/blender-2.47/release/scripts/uvcalc_lightmap.py    2008-05-28 
02:36:27 UTC (rev 15025)
@@ -41,6 +41,12 @@
 
 from math import sqrt
 
+def AngleBetweenVecs(a1,a2):
+       try:
+               return Mathutils.AngleBetweenVecs(a1,a2)
+       except:
+               return 180.0
+
 class prettyface(object):
        __slots__ = 'uv', 'width', 'height', 'children', 'xoff', 'yoff', 
'has_parent', 'rot'
        def __init__(self, data):
@@ -148,9 +154,9 @@
                if len(uv) == 2:
                        # match the order of angle sizes of the 3d verts with 
the UV angles and rotate.
                        def get_tri_angles(v1,v2,v3):
-                               a1= Mathutils.AngleBetweenVecs(v2-v1,v3-v1)
-                               a2= Mathutils.AngleBetweenVecs(v1-v2,v3-v2)
-                               a3 = 180 - (a1+a2) #a3= 
Mathutils.AngleBetweenVecs(v2-v3,v1-v3)
+                               a1= AngleBetweenVecs(v2-v1,v3-v1)
+                               a2= AngleBetweenVecs(v1-v2,v3-v2)
+                               a3 = 180 - (a1+a2) #a3= 
AngleBetweenVecs(v2-v3,v1-v3)
                                
                                
                                return [(a1,0),(a2,1),(a3,2)]
@@ -237,8 +243,17 @@
                        face_groups.append(faces)
                
                if PREF_NEW_UVLAYER:
-                       me.addUVLayer('lightmap')
-                       me.activeUVLayer = 'lightmap'
+                       uvname_org = uvname = 'lightmap'
+                       uvnames = me.getUVLayerNames()
+                       i = 1
+                       while uvname in uvnames:
+                               uvname = '%s.%03d' % (uvname_org, i)
+                               i+=1
+                       
+                       me.addUVLayer(uvname)
+                       me.activeUVLayer = uvname
+                       
+                       del uvnames, uvname_org, uvname
        
        for face_sel in face_groups:
                print "\nStarting unwrap"
@@ -402,11 +417,14 @@
                # ...limiting this is needed or you end up with bug unused 
texture spaces
                # ...however if its too high, boxpacking is way too slow for 
high poly meshes.
                float_to_int_factor = lengths_to_ints[0][0]
-               max_int_dimension = int(((side_len / float_to_int_factor)) / 
PREF_BOX_DIV)
+               if float_to_int_factor > 0:
+                       max_int_dimension = int(((side_len / 
float_to_int_factor)) / PREF_BOX_DIV)
+                       ok = True
+               else:
+                       max_int_dimension = 0.0 # wont be used
+                       ok = False
                
-               
                # RECURSIVE prettyface grouping
-               ok = True
                while ok:
                        ok = False
                        

Modified: branches/blender-2.47/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/blender-2.47/source/blender/blenkernel/intern/modifier.c   
2008-05-28 01:51:35 UTC (rev 15024)
+++ branches/blender-2.47/source/blender/blenkernel/intern/modifier.c   
2008-05-28 02:36:27 UTC (rev 15025)
@@ -6485,12 +6485,14 @@
        MFace *mf=0;
        MVert *dupvert=0;
        ParticleSettings *part=psmd->psys->part;
-       ParticleData *pa, *pars=psmd->psys->particles;
+       ParticleData *pa=NULL, *pars=psmd->psys->particles;
        ParticleKey state;
+       EdgeHash *vertpahash;
+       EdgeHashIterator *ehi;
        float *vertco=0, imat[4][4];
        float loc0[3], nor[3];
        float timestep, cfra;
-       int *facepa=emd->facepa, *vertpa=0;
+       int *facepa=emd->facepa;
        int totdup=0,totvert=0,totface=0,totpart=0;
        int i, j, v, mindex=0;
 
@@ -6505,34 +6507,36 @@
        else
                cfra=bsystem_time(ob,(float)G.scene->r.cfra,0.0);
 
-       /* table for vertice <-> particle relations (row totpart+1 is for yet 
unexploded verts) */
-       vertpa = MEM_callocN(sizeof(int)*(totpart+1)*totvert, 
"explode_vertpatab");
-       for(i=0; i<(totpart+1)*totvert; i++)
-               vertpa[i] = -1;
+       /* hash table for vertice <-> particle relations */
+       vertpahash= BLI_edgehash_new();
 
        for (i=0; i<totface; i++) {
+               /* do mindex + totvert to ensure the vertex index to be the 
first
+                * with BLI_edgehashIterator_getKey */
                if(facepa[i]==totpart || cfra <= (pars+facepa[i])->time)
-                       mindex = totpart*totvert;
+                       mindex = totvert+totpart;
                else 
-                       mindex = facepa[i]*totvert;
+                       mindex = totvert+facepa[i];
 
                mf=CDDM_get_face(dm,i);
 
-               /*set face vertices to exist in particle group*/
-               vertpa[mindex+mf->v1] = 1;
-               vertpa[mindex+mf->v2] = 1;
-               vertpa[mindex+mf->v3] = 1;
+               /* set face vertices to exist in particle group */
+               BLI_edgehash_insert(vertpahash, mf->v1, mindex, NULL);
+               BLI_edgehash_insert(vertpahash, mf->v2, mindex, NULL);
+               BLI_edgehash_insert(vertpahash, mf->v3, mindex, NULL);
                if(mf->v4)
-                       vertpa[mindex+mf->v4] = 1;
+                       BLI_edgehash_insert(vertpahash, mf->v4, mindex, NULL);
        }
 
-       /*make new vertice indexes & count total vertices after duplication*/
-       for(i=0; i<(totpart+1)*totvert; i++){
-               if(vertpa[i] != -1)
-                       vertpa[i] = totdup++;
+       /* make new vertice indexes & count total vertices after duplication */
+       ehi= BLI_edgehashIterator_new(vertpahash);
+       for(; !BLI_edgehashIterator_isDone(ehi); 
BLI_edgehashIterator_step(ehi)) {
+               BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totdup));
+               totdup++;
        }
+       BLI_edgehashIterator_free(ehi);
 
-       /*the final duplicated vertices*/
+       /* the final duplicated vertices */
        explode= CDDM_from_template(dm, totdup, 0,totface);
        dupvert= CDDM_get_verts(explode);
 
@@ -6541,45 +6545,49 @@
 
        psmd->psys->lattice = psys_get_lattice(ob, psmd->psys);
 
-       /*duplicate & displace vertices*/
-       for(i=0, pa=pars; i<=totpart; i++, pa++){
-               if(i!=totpart){
+       /* duplicate & displace vertices */
+       ehi= BLI_edgehashIterator_new(vertpahash);
+       for(; !BLI_edgehashIterator_isDone(ehi); 
BLI_edgehashIterator_step(ehi)) {
+               MVert source;
+               MVert *dest;
+
+               /* get particle + vertex from hash */
+               BLI_edgehashIterator_getKey(ehi, &j, &i);
+               i -= totvert;
+               v= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
+
+               dm->getVert(dm, j, &source);
+               dest = CDDM_get_vert(explode,v);
+
+               DM_copy_vert_data(dm,explode,j,v,1);
+               *dest = source;
+
+               if(i!=totpart) {
+                       /* get particle */
+                       pa= pars+i;
+
+                       /* get particle state */
                        psys_particle_on_emitter(ob, 
psmd,part->from,pa->num,-1,pa->fuv,pa->foffset,loc0,nor,0,0,0,0);
                        Mat4MulVecfl(ob->obmat,loc0);
 
                        state.time=cfra;
                        psys_get_particle_state(ob,psmd->psys,i,&state,1);
-               }
 
-               for(j=0; j<totvert; j++){
-                       v=vertpa[i*totvert+j];
-                       if(v != -1) {
-                               MVert source;
-                               MVert *dest;
+                       vertco=CDDM_get_vert(explode,v)->co;
+                       
+                       Mat4MulVecfl(ob->obmat,vertco);
 
-                               dm->getVert(dm, j, &source);
-                               dest = CDDM_get_vert(explode,v);
+                       VECSUB(vertco,vertco,loc0);
 
-                               DM_copy_vert_data(dm,explode,j,v,1);
-                               *dest = source;
+                       /* apply rotation, size & location */
+                       QuatMulVecf(state.rot,vertco);
+                       VecMulf(vertco,pa->size);
+                       VECADD(vertco,vertco,state.co);
 
-                               if(i!=totpart){
-                                       vertco=CDDM_get_vert(explode,v)->co;
-                                       
-                                       Mat4MulVecfl(ob->obmat,vertco);
-
-                                       VECSUB(vertco,vertco,loc0);
-
-                                       /* apply rotation, size & location */
-                                       QuatMulVecf(state.rot,vertco);
-                                       VecMulf(vertco,pa->size);
-                                       VECADD(vertco,vertco,state.co);
-
-                                       Mat4MulVecfl(imat,vertco);
-                               }
-                       }
+                       Mat4MulVecfl(imat,vertco);
                }
        }
+       BLI_edgehashIterator_free(ehi);
 
        /*map new vertices to faces*/
        for (i=0; i<totface; i++) {
@@ -6601,15 +6609,15 @@
                orig_v4 = source.v4;
 
                if(facepa[i]!=totpart && cfra <= pa->time)
-                       mindex = totpart*totvert;
+                       mindex = totvert+totpart;
                else 
-                       mindex = facepa[i]*totvert;
+                       mindex = totvert+facepa[i];
 
-               source.v1 = vertpa[mindex+source.v1];
-               source.v2 = vertpa[mindex+source.v2];
-               source.v3 = vertpa[mindex+source.v3];
+               source.v1 = edgesplit_get(vertpahash, source.v1, mindex);
+               source.v2 = edgesplit_get(vertpahash, source.v2, mindex);
+               source.v3 = edgesplit_get(vertpahash, source.v3, mindex);
                if(source.v4)
-                       source.v4 = vertpa[mindex+source.v4];
+                       source.v4 = edgesplit_get(vertpahash, source.v4, 
mindex);
 
                DM_copy_face_data(dm,explode,i,i,1);
 
@@ -6618,9 +6626,10 @@
                test_index_face(mf, &explode->faceData, i, (mf->v4 ? 4 : 3));
        }
 
+       MEM_printmemlist_stats();
 
        /* cleanup */
-       if(vertpa) MEM_freeN(vertpa);
+       BLI_edgehash_free(vertpahash, NULL);
 
        /* finalization */
        CDDM_calc_edges(explode);

Modified: branches/blender-2.47/source/blender/python/api2_2x/sceneRender.c
===================================================================
--- branches/blender-2.47/source/blender/python/api2_2x/sceneRender.c   
2008-05-28 01:51:35 UTC (rev 15024)
+++ branches/blender-2.47/source/blender/python/api2_2x/sceneRender.c   
2008-05-28 02:36:27 UTC (rev 15025)
@@ -478,10 +478,12 @@
        }
 
        else { /* background mode (blender -b file.blend -P script) */
-               Render *re= RE_NewRender("Render");
+               Render *re= RE_NewRender(G.scene->id.name);
 
-               int end_frame = G.scene->r.efra; /* is of type short currently 
*/
 
+
+               int end_frame = G.scene->r.efra;
+
                if (G.scene != self->scene)
                        return EXPP_ReturnPyObjError (PyExc_RuntimeError,
                                "scene to render in bg mode must be the active 
scene");
@@ -490,7 +492,7 @@
 

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to