__doc__="Roll bone rotation not working yet. It rebuild the select armature object scrape to raw setup build."
__doc__="If mesh is deform when importing to unreal engine try this. It rebuild the bones one at the time by select one armature object scrape to raw setup build."
definvoke(self,context,event):
#print("Init Export Script:")
currentbone=[]#select armature for roll copy
forobjinbpy.data.objects:
#print(dir(obj))
ifobj.type=='ARMATURE'andobj.select==True:
print("Armature Name:",obj.name)
#print(dir(obj.data))
objectname="armaturedata"
meshname="ArmatureObject"
objectname="ArmatureDataPSK"
meshname="ArmatureObjectPSK"
armdata=bpy.data.armatures.new(objectname)
ob_new=bpy.data.objects.new(meshname,armdata)
bpy.context.scene.objects.link(ob_new)
bpy.ops.object.mode_set(mode='OBJECT')
foriinbpy.context.scene.objects:i.select=False#deselect all objects
ob_new.select=True
bpy.context.scene.objects.active=ob_new
bpy.context.scene.objects.active=obj
bpy.ops.object.mode_set(mode='EDIT')
#print("number of bones:",len(obj.data.edit_bones))
forboneinobj.data.edit_bones:
#print(dir(bone))
#print("roll",(bone.roll))
ifbone.parent!=None:
#print([bone.name,bone.roll,bone.roll,None])
currentbone.append([bone.name,bone.roll])
else:
currentbone.append([bone.name,bone.roll])
bpy.ops.object.mode_set(mode='OBJECT')
#bpy.ops.object.mode_set(mode='EDIT')
print("number of bones:",len(obj.data.edit_bones))
#for ib in range(len( obj.data.bones)):
#print("bone name:",obj.data.edit_bones[ib].name)
#print("bone name:",dir(bone))
#editbone = obj.data.edit_bones[ib]
#print("bone dir",dir(editbone))
#bpy.ops.object.mode_set(mode='EDIT')
print("=====================")
#for bone in obj.data.edit_bones:
#print("bone name:",bone.name)
#print("edit bone name:",dir(bone))
print("=====================")
print("data object:",dir(obj.data))
foriinbpy.context.scene.objects:i.select=False#deselect all objects