From cf8e2d201c86bfd6e8dc5817c8b6748787fd2182 Mon Sep 17 00:00:00 2001
From: John Phan <darkneter@gmail.com>
Date: Tue, 8 Feb 2011 18:29:04 +0000
Subject: [PATCH] update mesh not render scene once added in.

---
 io_import_scene_unreal_psk.py | 34 ++++++----------------------------
 1 file changed, 6 insertions(+), 28 deletions(-)

diff --git a/io_import_scene_unreal_psk.py b/io_import_scene_unreal_psk.py
index 6ef9e6403..63013ea4e 100644
--- a/io_import_scene_unreal_psk.py
+++ b/io_import_scene_unreal_psk.py
@@ -361,30 +361,6 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK):
                 break
 				
         if bfound == False:
-            '''
-            armdata = bpy.data.armatures.new(objectname)
-            ob_new = bpy.data.objects.new(meshname, armdata)
-            #ob_new = bpy.data.objects.new(meshname, 'ARMATURE')
-            #ob_new.data = armdata
-            bpy.context.scene.objects.link(ob_new)
-            #bpy.ops.object.mode_set(mode='OBJECT')
-            for i in bpy.context.scene.objects: i.select = False #deselect all objects
-            ob_new.select = True
-            #set current armature to edit the bone
-            bpy.context.scene.objects.active = ob_new
-            #set mode to able to edit the bone
-            bpy.ops.object.mode_set(mode='EDIT')
-			
-            #newbone = ob_new.data.edit_bones.new('test')
-            #newbone.tail.y = 1
-            print("creating bone(s)")
-            for bone in md5_bones:
-                #print(dir(bone))
-                bpy.ops.object.mode_set(mode='EDIT')
-                newbone = ob_new.data.edit_bones.new(bone.name)
-            '''		
-		
-            
             armdata = bpy.data.armatures.new(objectname)
             ob_new = bpy.data.objects.new(meshname, armdata)
             #ob_new = bpy.data.objects.new(meshname, 'ARMATURE')
@@ -438,10 +414,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK):
                     newbone.tail.y = parentbone.head.y + (pos_y + bonesize * rotmatrix[1][1])
                     newbone.tail.z = parentbone.head.z + (pos_z + bonesize * rotmatrix[1][2])
                 else:
-                    print("rotmatrix:",dir(bone.bindmat.to_matrix().resize_4x4()))
+                    #print("rotmatrix:",dir(bone.bindmat.to_matrix().resize_4x4()))
                     #rotmatrix = bone.bindmat.to_matrix().resize_4x4().to_3x3()  # XXX, redundant matrix conversion?
-                    rotmatrix = bone.bindmat.to_matrix().to_3x3()  # XXX, redundant matrix conversion?
-					
+                    rotmatrix = bone.bindmat.to_matrix().to_3x3()
                     
                     newbone.head.x = bone.bindpos[0]
                     newbone.head.y = bone.bindpos[1]
@@ -577,13 +552,16 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK):
     #===================================================================================================
     #
     #===================================================================================================
+    #print("me_ob",dir(me_ob))
+    #this update the render in the 3d scene.
+    me_ob.update();
     obmesh = bpy.data.objects.new(objName,me_ob)
     #check if there is a material to set to
     if len(materials) > 0:
         obmesh.active_material = materials[0] #material setup tmp
     
     bpy.context.scene.objects.link(obmesh)
-    
+    #print("obmesh",dir(obmesh))
     bpy.context.scene.update()
     
     print ("PSK2Blender completed")
-- 
GitLab