fixed nieve use of type()..
authorCampbell Barton <ideasman42@gmail.com>
Thu, 1 Feb 2007 05:27:49 +0000 (05:27 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 1 Feb 2007 05:27:49 +0000 (05:27 +0000)
type(foo) == type(list()) can be done as
type(foo) == list:

release/scripts/bpymodules/BPyMesh.py
release/scripts/lightwave_import.py

index 7eee04ecb350c918a69fdebe30302a820f7f727f..91f0348549d7da0a57089e30be67fe66540edf5f 100644 (file)
@@ -392,10 +392,10 @@ def getMeshFromObject(ob, container_mesh=None, apply_modifiers=True, vgroups=Tru
                mesh.verts= None
        
        
-       type = ob.type
+       ob_type = ob.type
        dataname = ob.getData(1)
        tempob= None
-       if apply_modifiers or type != 'Mesh':
+       if apply_modifiers or ob_type != 'Mesh':
                try:
                        mesh.getFromObject(ob)
                except:
@@ -410,10 +410,11 @@ def getMeshFromObject(ob, container_mesh=None, apply_modifiers=True, vgroups=Tru
                mesh.getFromObject(tempob)
                scn.objects.unlink(tempob)
        
-       if type == 'Mesh':
+       if ob_type == 'Mesh':
                if vgroups:
                        if tempob==None:
                                tempob= Blender.Object.New('Mesh')
+                       
                        tempob.link(mesh)
                        try:
                                # Copy the influences if possible.
@@ -784,10 +785,6 @@ def getUvPixelLoc(face, pxLoc, img_size = None, uvArea = None):
        return None
 
 
-type_tuple= type( (0,) )
-type_list= type( [] )
-
-
 # Used for debugging ngon
 """
 def draw_loops(loops):
@@ -867,7 +864,7 @@ def ngon(from_data, indices, PREF_FIX_LOOPS= True):
                '''
                Normal single concave loop filling
                '''
-               if type(from_data) in (type_tuple, type_list):
+               if type(from_data) in (tuple, list):
                        verts= [Vector(from_data[i]) for ii, i in enumerate(indices)]
                else:
                        verts= [from_data.verts[i].co for ii, i in enumerate(indices)]
@@ -884,7 +881,7 @@ def ngon(from_data, indices, PREF_FIX_LOOPS= True):
                This is used by lightwave LWO files a lot
                '''
                
-               if type(from_data) in (type_tuple, type_list):
+               if type(from_data) in (tuple, list):
                        verts= [vert_treplet(Vector(from_data[i]), ii) for ii, i in enumerate(indices)]
                else:
                        verts= [vert_treplet(from_data.verts[i].co, ii) for ii, i in enumerate(indices)]
index 0cf544e174405868a492009520acbfe80abf7eea..b86ee2f732cb768986b2b94e316754cb6c4df0db 100644 (file)
@@ -106,8 +106,6 @@ except:
 # ===========================================================
 
 textname = None
-type_list = type(list())
-type_dict = type(dict())
 #uncomment the following line to enable logging facility to the named text object
 #textname = "lwo_log"
 
@@ -187,9 +185,9 @@ class dotext:
        def pprint(self, parg, where = _NO):
                if parg == None:
                        self.pstring("_None_", where)
-               elif type(parg) == type_list:
+               elif type(parg) == list:
                        self.plist(parg, where)
-               elif type(parg) == type_dict:
+               elif type(parg) == dict:
                        self.pdict(parg, where)
                else:
                        self.pstring(safestring(str(parg)), where)