Skip to content
Snippets Groups Projects
Commit cf8e2d20 authored by John Phan's avatar John Phan
Browse files

update mesh not render scene once added in.

parent 3a2eaa64
No related branches found
No related tags found
No related merge requests found
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment