From 41922c12618a04df2a220b424df238d09da208e3 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Wed, 24 Jan 2024 17:51:39 +0200 Subject: [PATCH] Revert #928 as 1.0 pxos can no longer be imported in 0.x --- CHANGELOG.md | 1 - src/Classes/Cel3D.gd | 67 ------------------------------------------ src/Classes/Project.gd | 2 -- 3 files changed, 70 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faaa311d5..800af01e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,6 @@ Built using Godot 3.5.2 ### Fixed - 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) -- 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 This update has been brought to you by the contributions of: diff --git a/src/Classes/Cel3D.gd b/src/Classes/Cel3D.gd index 69dde243f..9f242c18d 100644 --- a/src/Classes/Cel3D.gd +++ b/src/Classes/Cel3D.gd @@ -177,9 +177,6 @@ func serialize() -> Dictionary: 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) scene_properties = dict["scene_properties"] var objects_copy = dict["object_properties"] @@ -198,70 +195,6 @@ func deserialize(dict: Dictionary) -> void: _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: if is_instance_valid(viewport): viewport.queue_free() diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 724c84d30..eb25c63a7 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -380,8 +380,6 @@ func deserialize(dict: Dictionary) -> void: cels.append(GroupCel.new()) Global.LayerTypes.THREE_D: cels.append(Cel3D.new(size, true)) - if dict.has("pxo_version"): - cel["pxo_version"] = dict["pxo_version"] cels[cel_i].deserialize(cel) _deserialize_metadata(cels[cel_i], cel) cel_i += 1