py 2.3 compat for lightwave_import and wizard_curve2tree
authorCampbell Barton <ideasman42@gmail.com>
Tue, 21 Oct 2008 00:21:02 +0000 (00:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 21 Oct 2008 00:21:02 +0000 (00:21 +0000)
release/scripts/export_obj.py
release/scripts/lightwave_import.py
release/scripts/wizard_curve2tree.py

index f99a949fbae3c32910806a8ea13f15dc5b1df8bc..79a224d63c39b7e5b75f85d32226b6d167679883 100644 (file)
@@ -678,7 +678,7 @@ def write_ui(filename):
                        
                        Draw.Label('Blender Objects as OBJ:', ui_x+9, ui_y+59, 220, 20)
                        Draw.BeginAlign()
-                       EXPORT_BLEN_OBS = Draw.Toggle('Objects', EVENT_REDRAW, ui_x+9, ui_y+40, 60, 20, EXPORT_BLEN_OBS.val, 'Export blender objects as "OBJ objects".', do_split)
+                       EXPORT_BLEN_OBS = Draw.Toggle('Objects', EVENT_REDRAW, ui_x+9, ui_y+39, 60, 20, EXPORT_BLEN_OBS.val, 'Export blender objects as "OBJ objects".', do_split)
                        EXPORT_GROUP_BY_OB = Draw.Toggle('Groups', EVENT_REDRAW, ui_x+69, ui_y+39, 60, 20, EXPORT_GROUP_BY_OB.val, 'Export blender objects as "OBJ Groups".', do_split)
                        EXPORT_GROUP_BY_MAT = Draw.Toggle('Material Groups', EVENT_REDRAW, ui_x+129, ui_y+39, 100, 20, EXPORT_GROUP_BY_MAT.val, 'Group by materials.', do_split)
                        Draw.EndAlign()
index 2049fbd23802425b4ba0746236c440406dfd6395..6d02467cef8cb68afaabeb59dcfe010ce09184c9 100644 (file)
@@ -106,6 +106,12 @@ try:
 except:
        struct= chunk= cStringIO= None
 
+# python 2.3 has no reversed() iterator. this will only work on lists and tuples
+try:
+       reversed
+except:
+       def reversed(l): return l[::-1]
+
 ### # Debuggin disabled in release.
 ### # do a search replace to enabe debug prints
 ### DEBUG = False
index eb27f1ca0f566fd704918116a9346f513e2908bd..84b2cc76132d762794e0b16cb6c5aadb6c5a6d21 100644 (file)
@@ -266,7 +266,9 @@ class tree:
                                brch.calcData()
                        
                # Sort from big to small, so big branches get priority
-               self.branches_all.sort( key = lambda brch: -brch.bpoints[0].radius )
+               # Py 2.3 dosnt have keywords in sort
+               try:    self.branches_all.sort( key = lambda brch: -brch.bpoints[0].radius )
+               except: self.branches_all.sort( lambda brch_a, brch_b: cmp(brch_b.bpoints[0].radius, brch_a.bpoints[0].radius) )
        
        
        def closestBranchPt(self, co):