mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59:49 +00:00
Fix origin of 3D shapes exported from 0.x being scaled
Continuation of #927
This commit is contained in:
parent
c3a651f01d
commit
16a4ae6899
|
@ -237,12 +237,16 @@ func convert_0x_to_1x(dict: Dictionary) -> void:
|
||||||
# Convert a String to a Vector3
|
# Convert a String to a Vector3
|
||||||
object_info[object_property] = str_to_var("Vector3" + object_info[object_property])
|
object_info[object_property] = str_to_var("Vector3" + object_info[object_property])
|
||||||
# Special operations to adjust gizmo
|
# Special operations to adjust gizmo
|
||||||
|
# take note of origin
|
||||||
|
var origin = object_info["transform"].origin
|
||||||
match object_info["type"]:
|
match object_info["type"]:
|
||||||
0: # BOX
|
0: # BOX
|
||||||
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
||||||
|
object_info["transform"].origin = origin
|
||||||
object_info["mesh_size"] /= 2
|
object_info["mesh_size"] /= 2
|
||||||
1: # SPHERE
|
1: # SPHERE
|
||||||
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
||||||
|
object_info["transform"].origin = origin
|
||||||
object_info["mesh_radius"] /= 2
|
object_info["mesh_radius"] /= 2
|
||||||
object_info["mesh_height"] /= 2
|
object_info["mesh_height"] /= 2
|
||||||
2: # CAPSULE
|
2: # CAPSULE
|
||||||
|
@ -251,20 +255,24 @@ func convert_0x_to_1x(dict: Dictionary) -> void:
|
||||||
. scaled(Vector3.ONE * 2)
|
. scaled(Vector3.ONE * 2)
|
||||||
. rotated_local(Vector3.LEFT, deg_to_rad(-90))
|
. rotated_local(Vector3.LEFT, deg_to_rad(-90))
|
||||||
)
|
)
|
||||||
|
object_info["transform"].origin = origin
|
||||||
object_info["mesh_radius"] /= 2
|
object_info["mesh_radius"] /= 2
|
||||||
object_info["mesh_height"] = (
|
object_info["mesh_height"] = (
|
||||||
object_info["mesh_mid_height"] + object_info["mesh_radius"]
|
object_info["mesh_mid_height"] + object_info["mesh_radius"]
|
||||||
)
|
)
|
||||||
3: # CYLINDER
|
3: # CYLINDER
|
||||||
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
||||||
|
object_info["transform"].origin = origin
|
||||||
object_info["mesh_height"] /= 2
|
object_info["mesh_height"] /= 2
|
||||||
object_info["mesh_bottom_radius"] /= 2
|
object_info["mesh_bottom_radius"] /= 2
|
||||||
object_info["mesh_top_radius"] /= 2
|
object_info["mesh_top_radius"] /= 2
|
||||||
4: # PRISM
|
4: # PRISM
|
||||||
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
||||||
|
object_info["transform"].origin = origin
|
||||||
object_info["mesh_size"] /= 2
|
object_info["mesh_size"] /= 2
|
||||||
6: # PLANE
|
6: # PLANE
|
||||||
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE * 2)
|
||||||
|
object_info["transform"].origin = origin
|
||||||
object_info["mesh_sizev2"] /= 2
|
object_info["mesh_sizev2"] /= 2
|
||||||
7: # TEXT
|
7: # TEXT
|
||||||
object_info["mesh_vertical_alignment"] = VERTICAL_ALIGNMENT_BOTTOM
|
object_info["mesh_vertical_alignment"] = VERTICAL_ALIGNMENT_BOTTOM
|
||||||
|
|
Loading…
Reference in a new issue