From: Antonio Ospite Date: Sat, 3 Mar 2007 19:06:01 +0000 (+0100) Subject: Try to keep compatibility with python 2.3 X-Git-Tag: vrm-0.3~9 X-Git-Url: https://git.ao2.it/vrm.git/commitdiff_plain/d2402688723bb3a348e7991869e45145db77a959?ds=sidebyside Try to keep compatibility with python 2.3 Signed-off-by: Antonio Ospite --- diff --git a/vrm.py b/vrm.py index 7324efc..e6ac4d4 100755 --- a/vrm.py +++ b/vrm.py @@ -84,6 +84,7 @@ __bpydoc__ = """\ # * View frustum clipping # * Scene clipping done using bounding box instead of object center # * Fix camera type selection for blender>2.43 (Thanks to Thomas Lachmann) +# * Compatibility with python 2.3 # # --------------------------------------------------------------------- @@ -93,6 +94,13 @@ from Blender.Mathutils import * from math import * import sys, time +def uniq(alist): + tmpdict = dict() + return [tmpdict.setdefault(e,e) for e in alist if e not in tmpdict] + # in python > 2.4 we ca use the following + #return [ u for u in alist if u not in locals()['_[1]'] ] + + # Constants EPS = 10e-5 @@ -106,7 +114,7 @@ class config: polygons = dict() polygons['SHOW'] = True polygons['SHADING'] = 'FLAT' # FLAT or TOON - polygons['HSR'] = 'NEWELL' # PAINTER or NEWELL + polygons['HSR'] = 'PAINTER' # PAINTER or NEWELL # Hidden to the user for now polygons['EXPANSION_TRICK'] = True @@ -684,9 +692,13 @@ class HSR: negVertList.append(V1) - # uniq - posVertList = [ u for u in posVertList if u not in locals()['_[1]'] ] - negVertList = [ u for u in negVertList if u not in locals()['_[1]'] ] + # uniq for python > 2.4 + #posVertList = [ u for u in posVertList if u not in locals()['_[1]'] ] + #negVertList = [ u for u in negVertList if u not in locals()['_[1]'] ] + + # a more portable way + posVertList = uniq(posVertList) + negVertList = uniq(negVertList) # If vertex are all on the same half-space, return