From e8d9c99b8d920c81c15b5a36e777adbd1589e34d Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 2 Aug 2024 19:57:45 +0800 Subject: [PATCH] add rotation data as being part of the json_element --- .../plugins/publish/extract_layout.py | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/client/ayon_maya/plugins/publish/extract_layout.py b/client/ayon_maya/plugins/publish/extract_layout.py index fb9f4ddb..10e43495 100644 --- a/client/ayon_maya/plugins/publish/extract_layout.py +++ b/client/ayon_maya/plugins/publish/extract_layout.py @@ -45,21 +45,9 @@ def convert_transformation_matrix(transform_mm: om.MMatrix, rotation: list) -> o convert_translation = om.MVector(convert_translation.x, convert_translation.z, -convert_translation.y) convert_scale = convert_transform.scale(om.MSpace.kObject) convert_transform.setTranslation(convert_translation, om.MSpace.kWorld) - # If rotation x are less than 0, the z rotation would be flipped - # If rotation x are at 0 and rotation x are at 0, the z rotation would be flipped. - # If rotation x, y, z equals to zero, the rotations remains same value. - # if rotation y has values, the z rotation would be same. - # If the rotation x ,y ,z have values, the rotations remains same value. - if rotation[0] <= 0 or rotation[1] == 0 or (rotation[0] == 0 and rotation[1] == 0) or not ( - rotation[0] == 0 and rotation[1] == 0 and rotation[2] == 0) or not (rotation[1] == 0): - converted_rotation = om.MEulerRotation( - math.radians(rotation[0]), math.radians(rotation[2]), - math.radians(-180) + math.radians(rotation[1]) - ) - else: - converted_rotation = om.MEulerRotation( - math.radians(rotation[0]), math.radians(rotation[2]), math.radians(rotation[1]) - ) + converted_rotation = om.MEulerRotation( + math.radians(rotation[0]), math.radians(rotation[2]), math.radians(rotation[1]) + ) convert_transform.setRotation(converted_rotation) convert_transform.setScale([convert_scale[0], convert_scale[2], convert_scale[1]], om.MSpace.kObject) @@ -167,6 +155,11 @@ def process(self, instance): for row in b_matrix: json_element["basis"].append(list(row)) + json_element["rotation"] = { + "x": local_rotation[0], + "y": local_rotation[1], + "z": local_rotation[2] + } json_data.append(json_element) json_filename = "{}.json".format(instance.name)