[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39422] trunk/blender/release/scripts/ startup/bl_operators/uvcalc_smart_project.py: fix [#28227] join_uv and bake work wrong

Campbell Barton ideasman42 at gmail.com
Mon Aug 15 18:25:05 CEST 2011


Revision: 39422
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39422
Author:   campbellbarton
Date:     2011-08-15 16:25:05 +0000 (Mon, 15 Aug 2011)
Log Message:
-----------
fix [#28227] join_uv and bake work wrong
added back ability to unwrap all selected mesh objects.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/uvcalc_smart_project.py

Modified: trunk/blender/release/scripts/startup/bl_operators/uvcalc_smart_project.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/uvcalc_smart_project.py	2011-08-15 16:18:04 UTC (rev 39421)
+++ trunk/blender/release/scripts/startup/bl_operators/uvcalc_smart_project.py	2011-08-15 16:25:05 UTC (rev 39422)
@@ -813,39 +813,26 @@
     global RotMatStepRotation
     main_consts()
 
-    # TODO, all selected meshes
-    '''
-    # objects = context.selected_editable_objects
-    objects = []
-
-    # we can will tag them later.
-    obList =  [ob for ob in objects if ob.type == 'MESH']
-
-    # Face select object may not be selected.
-    ob = context.active_object
-
-    if ob and (not ob.select) and ob.type == 'MESH':
-        # Add to the list
-        obList =[ob]
-    del objects
-    '''
+    # Create the variables.
+    USER_PROJECTION_LIMIT = projection_limit
+    USER_ONLY_SELECTED_FACES = True
+    USER_SHARE_SPACE = 1 # Only for hole filling.
+    USER_STRETCH_ASPECT = 1 # Only for hole filling.
+    USER_ISLAND_MARGIN = island_margin # Only for hole filling.
+    USER_FILL_HOLES = 0
+    USER_FILL_HOLES_QUALITY = 50 # Only for hole filling.
+    USER_VIEW_INIT = 0 # Only for hole filling.
     
-    # quick workaround
-    obList =  [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
+    is_editmode = (context.active_object.mode == 'EDIT')
+    if is_editmode:
+        obList =  [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
+    else:
+        obList =  [ob for ob in context.selected_editable_objects if ob and ob.type == 'MESH']
+        USER_ONLY_SELECTED_FACES = False
 
     if not obList:
         raise('error, no selected mesh objects')
 
-    # Create the variables.
-    USER_PROJECTION_LIMIT = projection_limit
-    USER_ONLY_SELECTED_FACES = (1)
-    USER_SHARE_SPACE = (1) # Only for hole filling.
-    USER_STRETCH_ASPECT = (1) # Only for hole filling.
-    USER_ISLAND_MARGIN = island_margin # Only for hole filling.
-    USER_FILL_HOLES = (0)
-    USER_FILL_HOLES_QUALITY = (50) # Only for hole filling.
-    USER_VIEW_INIT = (0) # Only for hole filling.
-
     # Reuse variable
     if len(obList) == 1:
         ob = "Unwrap %i Selected Mesh"
@@ -906,8 +893,8 @@
 
         if USER_ONLY_SELECTED_FACES:
             meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select]
-        #else:
-        #	meshFaces = map(thickface, me.faces)
+        else:
+        	meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces)]
 
         if not meshFaces:
             continue
@@ -922,7 +909,7 @@
         # meshFaces = []
 
         # meshFaces.sort( lambda a, b: cmp(b.area , a.area) ) # Biggest first.
-        meshFaces.sort( key = lambda a: -a.area )
+        meshFaces.sort(key=lambda a: -a.area)
 
         # remove all zero area faces
         while meshFaces and meshFaces[-1].area <= SMALL_NUM:




More information about the Bf-blender-cvs mailing list