1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Revert #928 as 1.0 pxos can no longer be imported in 0.x

This commit is contained in:
Emmanouil Papadeas 2024-01-24 17:51:39 +02:00
parent e84e08bf21
commit 41922c1261
3 changed files with 0 additions and 70 deletions

View file

@ -44,7 +44,6 @@ Built using Godot 3.5.2
### Fixed ### Fixed
- Fixed undo/redo history not working when the tool changes. [#916](https://github.com/Orama-Interactive/Pixelorama/pull/916) - Fixed undo/redo history not working when the tool changes. [#916](https://github.com/Orama-Interactive/Pixelorama/pull/916)
- Pixelorama no longer closes when the project fails to be saved if "Save & Exit" is selected. [#920](https://github.com/Orama-Interactive/Pixelorama/pull/920) - Pixelorama no longer closes when the project fails to be saved if "Save & Exit" is selected. [#920](https://github.com/Orama-Interactive/Pixelorama/pull/920)
- Projects with 3D cels saved in 1.x can now be opened in 0.11.3. [#928](https://github.com/Orama-Interactive/Pixelorama/pull/928)
## [v0.11.2] - 2023-08-31 ## [v0.11.2] - 2023-08-31
This update has been brought to you by the contributions of: This update has been brought to you by the contributions of:

View file

@ -177,9 +177,6 @@ func serialize() -> Dictionary:
func deserialize(dict: Dictionary) -> void: func deserialize(dict: Dictionary) -> void:
if dict.has("pxo_version"):
if dict["pxo_version"] == 3: # It's a 1.x project convert it to 0.x format
convert_1x_to_0x(dict)
.deserialize(dict) .deserialize(dict)
scene_properties = dict["scene_properties"] scene_properties = dict["scene_properties"]
var objects_copy = dict["object_properties"] var objects_copy = dict["object_properties"]
@ -198,70 +195,6 @@ func deserialize(dict: Dictionary) -> void:
_add_object_node(object) _add_object_node(object)
## Used to convert 3d cels found in projects exported from a 0.x version to 1.x
func convert_1x_to_0x(dict: Dictionary) -> void:
# Converting the scene dictionary
var scene_dict: Dictionary = dict["scene_properties"]
scene_dict["camera_transform"] = str2var(
scene_dict["camera_transform"].replace("Transform3D", "Transform")
)
scene_dict["camera_projection"] = str2var(scene_dict["camera_projection"])
scene_dict["camera_fov"] = str2var(scene_dict["camera_fov"])
scene_dict["camera_size"] = str2var(scene_dict["camera_size"])
scene_dict["ambient_light_color"] = str2var(scene_dict["ambient_light_color"])
scene_dict["ambient_light_energy"] = str2var(scene_dict["ambient_light_energy"])
# Converting the objects dictionary
var objects_copy: Dictionary = dict["object_properties"]
for object_id_as_str in objects_copy.keys():
objects_copy[object_id_as_str] = str2var(
objects_copy[object_id_as_str].replace("Transform3D", "Transform")
)
# we are using a separate variable to make it easy to write
var object_info: Dictionary = objects_copy[object_id_as_str]
# Special operations to adjust gizmo
# take note of origin
var origin = object_info["transform"].origin
match object_info["type"]:
0: # BOX
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE / 2)
object_info["transform"].origin = origin
object_info["mesh_size"] *= 2
1: # SPHERE
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE / 2)
object_info["transform"].origin = origin
object_info["mesh_radius"] *= 2
object_info["mesh_height"] *= 2
2: # CAPSULE
object_info["transform"] = object_info["transform"].scaled(-(Vector3.ONE / 2))
var basis = object_info["transform"].basis
var new_transform: Transform = Transform(basis.x, -basis.z, -basis.y, origin)
object_info["transform"] = new_transform
object_info["transform"].origin = origin
object_info["mesh_radius"] *= 2
object_info["mesh_mid_height"] = (
object_info["mesh_height"]
- (object_info["mesh_radius"] / 2)
)
3: # CYLINDER
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE / 2)
object_info["transform"].origin = origin
object_info["mesh_height"] *= 2
object_info["mesh_bottom_radius"] *= 2
object_info["mesh_top_radius"] *= 2
4: # PRISM
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE / 2)
object_info["transform"].origin = origin
object_info["mesh_size"] *= 2
6: # PLANE
object_info["transform"] = object_info["transform"].scaled(Vector3.ONE / 2)
object_info["transform"].origin = origin
object_info["mesh_sizev2"] *= 2
_:
if not "shadow_color" in object_info.keys():
object_info["shadow_color"] = Color.black
objects_copy[object_id_as_str] = objects_copy[object_id_as_str]
func on_remove() -> void: func on_remove() -> void:
if is_instance_valid(viewport): if is_instance_valid(viewport):
viewport.queue_free() viewport.queue_free()

View file

@ -380,8 +380,6 @@ func deserialize(dict: Dictionary) -> void:
cels.append(GroupCel.new()) cels.append(GroupCel.new())
Global.LayerTypes.THREE_D: Global.LayerTypes.THREE_D:
cels.append(Cel3D.new(size, true)) cels.append(Cel3D.new(size, true))
if dict.has("pxo_version"):
cel["pxo_version"] = dict["pxo_version"]
cels[cel_i].deserialize(cel) cels[cel_i].deserialize(cel)
_deserialize_metadata(cels[cel_i], cel) _deserialize_metadata(cels[cel_i], cel)
cel_i += 1 cel_i += 1