|
@@ -295,19 +295,57 @@ def append_active_layers(newCollectionName, product_info, asset_data: AssetData)
|
|
|
# "transform"
|
|
|
# ]["rotation"]
|
|
|
|
|
|
- rotation_in_degrees = product_info["properties"]["transform"][
|
|
|
- "rotation"
|
|
|
- ]
|
|
|
+ # set object rotation
|
|
|
+
|
|
|
+ # rotation_in_degrees = product_info["properties"]["transform"][
|
|
|
+ # "rotation"
|
|
|
+ # ]
|
|
|
+
|
|
|
+ # rotation_in_degrees[0] = rotation_in_degrees[0] + 90
|
|
|
|
|
|
- rotation_in_degrees[0] = rotation_in_degrees[0] + 90
|
|
|
+ # # set object rotation in euler from radians
|
|
|
+ # collection.objects[0].rotation_euler = (
|
|
|
+ # math.radians(rotation_in_degrees[0]),
|
|
|
+ # math.radians(rotation_in_degrees[2]),
|
|
|
+ # math.radians(rotation_in_degrees[1]),
|
|
|
+ # )
|
|
|
+
|
|
|
+ rotation_data_euler = product_info["properties"]["transform"][
|
|
|
+ "rotationEuler"
|
|
|
+ ]
|
|
|
|
|
|
- # set object rotation in euler from radians
|
|
|
collection.objects[0].rotation_euler = (
|
|
|
- math.radians(rotation_in_degrees[0]),
|
|
|
- math.radians(rotation_in_degrees[2]),
|
|
|
- math.radians(rotation_in_degrees[1]),
|
|
|
+ math.radians(
|
|
|
+ rotation_data_euler[0]
|
|
|
+ ), # Add 90 degrees to the first element
|
|
|
+ math.radians(rotation_data_euler[2]),
|
|
|
+ math.radians(rotation_data_euler[1]),
|
|
|
)
|
|
|
|
|
|
+ # # set rotation using quaternion
|
|
|
+
|
|
|
+ # rotation_quat_data = product_info["properties"]["transform"]["rotation"]
|
|
|
+
|
|
|
+ # converted_quat = Quaternion(
|
|
|
+ # [
|
|
|
+ # rotation_quat_data[3],
|
|
|
+ # rotation_quat_data[0],
|
|
|
+ # rotation_quat_data[1],
|
|
|
+ # rotation_quat_data[2],
|
|
|
+ # ]
|
|
|
+ # )
|
|
|
+
|
|
|
+ # # Define the camera correction quaternion (from GLTF file)
|
|
|
+ # rotation_correction = Quaternion((2**0.5 / 2, 2**0.5 / 2, 0.0, 0.0))
|
|
|
+
|
|
|
+ # # Apply the camera correction to the converted quaternion
|
|
|
+ # corrected_quat = rotation_correction @ converted_quat
|
|
|
+
|
|
|
+ # # Apply the corrected quaternion to the camera's rotation
|
|
|
+ # collection.objects[0].rotation_mode = "QUATERNION"
|
|
|
+ # collection.objects[0].rotation_quaternion = rotation_correction
|
|
|
+
|
|
|
+ # set object scale
|
|
|
collection.objects[0].scale = product_info["properties"]["transform"][
|
|
|
"scale"
|
|
|
]
|