Newer
Older
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
class OBJECT_OT_UTRebuildArmature(bpy.types.Operator):
bl_idname = "object.utrebuildarmature" # XXX, name???
bl_label = "Rebuild Armature"
__doc__ = "Roll bone rotation not working yet. It rebuild the select armature object scrape to raw setup build."
def invoke(self, context, event):
#print("Init Export Script:")
for obj in bpy.data.objects:
#print(dir(obj))
if obj.type == 'ARMATURE' and obj.select == True:
print("Armature Name:",obj.name)
#print(dir(obj.data))
objectname = "armaturedata"
meshname ="ArmatureObject"
armdata = bpy.data.armatures.new(objectname)
ob_new = bpy.data.objects.new(meshname, armdata)
bpy.context.scene.objects.link(ob_new)
for i in bpy.context.scene.objects: i.select = False #deselect all objects
ob_new.select = True
bpy.context.scene.objects.active = ob_new
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))
bpy.ops.object.mode_set(mode='EDIT')
for bone in obj.data.bones:
print("bone name:",bone.name)
bpy.ops.object.mode_set(mode='EDIT')
newbone = ob_new.data.edit_bones.new(bone.name)
#print("parent:",bone.parent.name)
newbone.head = bone.head
newbone.tail = bone.tail
#newbone.roll = bone.roll
print(dir(bone))
#print((bone.bbone_z))
#newbone.matrix = bone.matrix
newbone.roll = bone.bbone_z
if bone.parent != None:
print("Found!",bone.parent.name)
parentbone = ob_new.data.edit_bones[bone.parent.name]
newbone.parent = parentbone
else:
print("Not found!")
newbone.head = bone.head_local
newbone.tail = bone.tail_local
#newbone.matrix = bone.matrix_local
#print(dir(newbone))
#if bone.name != bone.parent:
#print("parent:",bone.parent.name)
#parentbone = ob_new.data.edit_bones[bone.parent]
#newbone.parent = parentbone
'''
bpy.ops.object.mode_set(mode='OBJECT')#it need to go into object mode to able to select the faces
#print("Mesh found!",obj.name)
#print(len(obj.data.faces))
for face in obj.data.faces:
#print(dir(face))
if face.use_smooth == True:
face.select = True
#print("selected:",face.select)
else:
face.select = False
#print("selected:",face.select)
#print(("smooth:",face.use_smooth))
#bpy.context.scene.update()
bpy.ops.object.mode_set(mode='EDIT')
'''
#bpy.context.scene.objects.link(ob_new)
bpy.context.scene.update()
break
#objects = bpy.data.objects
return{'FINISHED'}
def menu_func(self, context):
#bpy.context.scene.unrealexportpsk = True
#bpy.context.scene.unrealexportpsa = True
default_path = os.path.splitext(bpy.data.filepath)[0] + ".psk"
self.layout.operator(ExportUDKAnimData.bl_idname, text="Skeleton Mesh / Animation Data (.psk/.psa)").filepath = default_path
Brendon Murphy
committed
def register():
Campbell Barton
committed
bpy.utils.register_module(__name__)
Brendon Murphy
committed
def unregister():
Campbell Barton
committed
bpy.utils.unregister_module(__name__)
Brendon Murphy
committed
if __name__ == "__main__":