Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-08-15 20:25:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-15 20:25:05 +0400
commit65ca89180ac7e97c44b880f4056a956b55a671f5 (patch)
tree9768defb3397243d7a167e9046a70d50dfd19941 /release/scripts/startup/bl_operators/uvcalc_smart_project.py
parentae884d2e54210a8a1038c23cb7bdeaac16fdf2fb (diff)
fix [#28227] join_uv and bake work wrong
added back ability to unwrap all selected mesh objects.
Diffstat (limited to 'release/scripts/startup/bl_operators/uvcalc_smart_project.py')
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_smart_project.py49
1 files changed, 18 insertions, 31 deletions
diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
index 67c2f5d001b..8afd6c104e0 100644
--- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py
+++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
@@ -813,39 +813,26 @@ def main(context,
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 @@ def main(context,
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 @@ def main(context,
# 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: