Commit b0c2b9dd authored by frankie's avatar frankie 💬

fix on weight export + invert Y uv option

parent de22a938
......@@ -40,6 +40,12 @@ class ExportSSM(bpy.types.Operator, ExportHelper):
filename_ext = ".%s" % constants.SSM_EXT
filter_glob = StringProperty(default="*.%s" % constants.SSM_EXT, options={"HIDDEN"})
invert_uv_y = BoolProperty(
name="Invert UV Y axis",
description="Inversion of Y axis in all UV layers",
default=True,
)
dump_data = BoolProperty(
name="Console dump",
description="Dumps an overview of the data in the terminal.",
......@@ -69,7 +75,7 @@ class ExportSSM(bpy.types.Operator, ExportHelper):
from . import export_ssm
exporter = export_ssm.SSMesh()
exporter.__init__()
if exporter.load(context.active_object, self.properties.dump_data ):
if exporter.load(context.active_object, self.properties.invert_uv_y, self.properties.dump_data ):
if exporter.save(self.filepath, self.properties.generate_json ):
return {'FINISHED'}
return {'CANCELLED'}
......
......@@ -231,9 +231,11 @@ class SSMesh():
if v.ss_type != constants.SSType.SSANCHOR:
continue
ssg.indices.append(v.ss_id)
wfound = False
for g in v.vertex.groups:
if g.group == gid:
ssg.weights.append(g.weight)
wfound = True
break
if not wfound:
ssg.weights.append(1)
......@@ -492,7 +494,7 @@ class SSMesh():
return [forward_arr, backward_arr]
def load(self, obj, do_dump):
def load(self, obj, invert_uvy, do_dump):
# just to be certain
bpy.ops.object.mode_set(mode='OBJECT')
......@@ -642,7 +644,10 @@ class SSMesh():
for i in range(p.loop_total-1, -1, -1):
uv = uvlayer.data[ p.loop_start + i ].uv
target.append(uv.x)
target.append(uv.y)
if invert_uvy:
target.append(1.0 - uv.y)
else:
target.append(uv.y)
# and now, the hardcore stuff: the groups
obj.select = True
......
......@@ -39,6 +39,12 @@ class ExportSSM(bpy.types.Operator, ExportHelper):
filename_ext = ".%s" % constants.SSM_EXT
filter_glob = StringProperty(default="*.%s" % constants.SSM_EXT, options={"HIDDEN"})
invert_uv_y = BoolProperty(
name="Invert UV Y axis",
description="Inversion of Y axis in all UV layers",
default=True,
)
dump_data = BoolProperty(
name="Console dump",
description="Dumps an overview of the data in the terminal.",
......@@ -68,7 +74,7 @@ class ExportSSM(bpy.types.Operator, ExportHelper):
from . import export_ssm
exporter = export_ssm.SSMesh()
exporter.__init__()
if exporter.load(context.active_object, self.properties.dump_data ):
if exporter.load(context.active_object, self.properties.invert_uv_y, self.properties.dump_data ):
if exporter.save(self.filepath, self.properties.generate_json ):
return {'FINISHED'}
return {'CANCELLED'}
......
......@@ -231,9 +231,11 @@ class SSMesh():
if v.ss_type != constants.SSType.SSANCHOR:
continue
ssg.indices.append(v.ss_id)
wfound = False
for g in v.vertex.groups:
if g.group == gid:
ssg.weights.append(g.weight)
wfound = True
break
if not wfound:
ssg.weights.append(1)
......@@ -492,7 +494,7 @@ class SSMesh():
return [forward_arr, backward_arr]
def load(self, obj, do_dump):
def load(self, obj, invert_uvy, do_dump):
# just to be certain
bpy.ops.object.mode_set(mode='OBJECT')
......@@ -642,7 +644,10 @@ class SSMesh():
for i in range(p.loop_total-1, -1, -1):
uv = uvlayer.data[ p.loop_start + i ].uv
target.append(uv.x)
target.append(uv.y)
if invert_uvy:
target.append(1.0 - uv.y)
else:
target.append(uv.y)
# and now, the hardcore stuff: the groups
gid = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment