From 454c190f8739aedf84b9a954fa7c56c7379c995e Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Fri, 16 Apr 2021 19:51:55 +0200 Subject: [PATCH 1/2] Convert layer offsets to Plasma's space --- korman/exporter/animation.py | 5 ++++- korman/exporter/material.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/korman/exporter/animation.py b/korman/exporter/animation.py index e37b653..a704454 100644 --- a/korman/exporter/animation.py +++ b/korman/exporter/animation.py @@ -419,8 +419,11 @@ class AnimationConverter: pos = kwargs[pos_path] scale = kwargs[scale_path] + translation = hsVector3(pos[0] - (scale[0] - 1.0) / 2.0, + 1.0 - pos[1] - (scale[1] - 1.0) / 2.0, + pos[2] - (scale[2] - 1.0) / 2.0) matrix = hsMatrix44() - matrix.setTranslate(hsVector3(*pos)) + matrix.setTranslate(translation) matrix.setScale(hsVector3(*scale)) return matrix diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 5a2ca11..e0075d7 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -425,7 +425,10 @@ class MaterialConverter: # Transform xform = hsMatrix44() - xform.setTranslate(hsVector3(*slot.offset)) + translation = hsVector3(slot.offset.x - (slot.scale.x - 1.0) / 2.0, + 1.0 - slot.offset.y - (slot.scale.y - 1.0) / 2.0, + slot.offset.z - (slot.scale.z - 1.0) / 2.0) + xform.setTranslate(translation) xform.setScale(hsVector3(*slot.scale)) layer.transform = xform From 9443b62e9952271169de5f96d13539ac62ca0acf Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Fri, 16 Apr 2021 21:27:36 +0200 Subject: [PATCH 2/2] (Remove unnecessary addition of 1.0 to UV Y) --- korman/exporter/animation.py | 2 +- korman/exporter/material.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/korman/exporter/animation.py b/korman/exporter/animation.py index a704454..2ad96a3 100644 --- a/korman/exporter/animation.py +++ b/korman/exporter/animation.py @@ -420,7 +420,7 @@ class AnimationConverter: scale = kwargs[scale_path] translation = hsVector3(pos[0] - (scale[0] - 1.0) / 2.0, - 1.0 - pos[1] - (scale[1] - 1.0) / 2.0, + -pos[1] - (scale[1] - 1.0) / 2.0, pos[2] - (scale[2] - 1.0) / 2.0) matrix = hsMatrix44() matrix.setTranslate(translation) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index e0075d7..9ddadc9 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -426,7 +426,7 @@ class MaterialConverter: # Transform xform = hsMatrix44() translation = hsVector3(slot.offset.x - (slot.scale.x - 1.0) / 2.0, - 1.0 - slot.offset.y - (slot.scale.y - 1.0) / 2.0, + -slot.offset.y - (slot.scale.y - 1.0) / 2.0, slot.offset.z - (slot.scale.z - 1.0) / 2.0) xform.setTranslate(translation) xform.setScale(hsVector3(*slot.scale))