|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
from .geo import Geo
|
|
|
|
|
from .geomesh import *
|
|
|
|
|
from .bones import *
|
|
|
|
|
import bpy.path
|
|
|
|
|
import bpy
|
|
|
|
|
|
|
|
|
@ -110,7 +111,8 @@ def save(operator, context, scale = 1.0, filepath = "", global_matrix = None, us
|
|
|
|
|
body_name = bpy.path.display_name_from_filepath(filepath)
|
|
|
|
|
geo.setName(body_name)
|
|
|
|
|
|
|
|
|
|
axis_rotation = axis_conversion('Y', 'Z', '-Z', 'Y')
|
|
|
|
|
axis_rotation = axis_conversion('-Y', 'Z', 'Z', 'Y')
|
|
|
|
|
#axis_rotation = axis_conversion('Y', 'Z', '-Z', 'Y')
|
|
|
|
|
axis_rotation.resize_4x4()
|
|
|
|
|
|
|
|
|
|
print("scale: %s" % (scale, ))
|
|
|
|
@ -150,6 +152,17 @@ def save(operator, context, scale = 1.0, filepath = "", global_matrix = None, us
|
|
|
|
|
|
|
|
|
|
convert_mesh(geo_model, mesh, ob)
|
|
|
|
|
|
|
|
|
|
if True: #flip bones
|
|
|
|
|
for i in range(len(geo.models) - 1, -1, -1):
|
|
|
|
|
name = geo.models[i].name.decode("utf-8")
|
|
|
|
|
#if reg_exp.search(name) is not None:
|
|
|
|
|
if True:
|
|
|
|
|
print("Swapping left and right in: %s" % (name, ))
|
|
|
|
|
model = geo.models[i]
|
|
|
|
|
for j in range(len(model.weight_bones)):
|
|
|
|
|
for k in range(len(model.weight_bones[j])):
|
|
|
|
|
model.weight_bones[j][k] = BONES_SWAP[model.weight_bones[j][k]]
|
|
|
|
|
|
|
|
|
|
data = geo.saveToData()
|
|
|
|
|
fh = open(filepath, "wb")
|
|
|
|
|
fh.write(data)
|
|
|
|
|