mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
3D object optimizations
This commit is contained in:
parent
4943ab5eab
commit
8ce68700dd
|
@ -118,19 +118,22 @@ func _scene_property_changed() -> void: # Called by undo/redo
|
||||||
|
|
||||||
|
|
||||||
func _add_object_node(id: int) -> void:
|
func _add_object_node(id: int) -> void:
|
||||||
|
if not object_properties.has(id):
|
||||||
|
print("Object id not found.")
|
||||||
|
return
|
||||||
var node3d := Cel3DObject.new()
|
var node3d := Cel3DObject.new()
|
||||||
node3d.id = id
|
node3d.id = id
|
||||||
node3d.cel = self
|
node3d.cel = self
|
||||||
parent_node.add_child(node3d)
|
parent_node.add_child(node3d)
|
||||||
node3d.type = object_properties[id]["type"]
|
if object_properties[id].has("id"):
|
||||||
if object_properties.has(id):
|
node3d.deserialize(object_properties[id])
|
||||||
if object_properties[id].has("id"):
|
else:
|
||||||
node3d.deserialize(object_properties[id])
|
if object_properties[id].has("transform"):
|
||||||
else:
|
node3d.transform = object_properties[id]["transform"]
|
||||||
if object_properties[id].has("transform"):
|
if object_properties[id].has("file_path"):
|
||||||
node3d.transform = object_properties[id]["transform"]
|
node3d.file_path = object_properties[id]["file_path"]
|
||||||
if object_properties[id].has("file_path"):
|
if object_properties[id].has("type"):
|
||||||
node3d.file_path = object_properties[id]["file_path"]
|
node3d.type = object_properties[id]["type"]
|
||||||
object_properties[id] = node3d.serialize()
|
object_properties[id] = node3d.serialize()
|
||||||
emit_signal("objects_changed")
|
emit_signal("objects_changed")
|
||||||
|
|
||||||
|
|
|
@ -107,10 +107,10 @@ func serialize() -> Dictionary:
|
||||||
|
|
||||||
func deserialize(dict: Dictionary) -> void:
|
func deserialize(dict: Dictionary) -> void:
|
||||||
id = dict["id"]
|
id = dict["id"]
|
||||||
|
file_path = dict["file_path"]
|
||||||
self.type = dict["type"]
|
self.type = dict["type"]
|
||||||
transform = dict["transform"]
|
transform = dict["transform"]
|
||||||
visible = dict["visible"]
|
visible = dict["visible"]
|
||||||
self.file_path = dict["file_path"]
|
|
||||||
if _is_mesh():
|
if _is_mesh():
|
||||||
var mesh: Mesh = node3d_type.mesh
|
var mesh: Mesh = node3d_type.mesh
|
||||||
match type:
|
match type:
|
||||||
|
@ -164,6 +164,8 @@ func _is_mesh() -> bool:
|
||||||
|
|
||||||
|
|
||||||
func _set_type(value: int) -> void:
|
func _set_type(value: int) -> void:
|
||||||
|
if type == value and is_instance_valid(node3d_type): # No reason to set the same type twice
|
||||||
|
return
|
||||||
type = value
|
type = value
|
||||||
if is_instance_valid(node3d_type):
|
if is_instance_valid(node3d_type):
|
||||||
node3d_type.queue_free()
|
node3d_type.queue_free()
|
||||||
|
|
Loading…
Reference in a new issue