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

Make cloned 3D cel have the same selected object as the orignal (#855)

* Update 3DShapeEdit.gd

do not set selected to null

* clone cel recieves selected cel from it's parent

* Add one more yield
This commit is contained in:
Variable 2023-05-10 15:45:38 +05:00 committed by GitHub
parent a2e184c05d
commit e65e69f14d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -205,6 +205,7 @@ func _cel_changed() -> void:
return
get_child(0).visible = true
_cel = Global.current_project.get_current_cel()
var selected = _cel.selected
_cel.selected = null
if not _cel.is_connected("scene_property_changed", self, "_set_cel_node_values"):
_cel.connect("scene_property_changed", self, "_set_cel_node_values")
@ -215,6 +216,11 @@ func _cel_changed() -> void:
_set_cel_node_values()
_fill_object_option_button()
# two yields are required
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
_cel.selected = selected
func _new_object_popup_id_pressed(id: int) -> void:
if id == Cel3DObject.Type.IMPORTED:

View file

@ -276,10 +276,14 @@ func copy_frames(indices := []) -> void:
for l in range(project.layers.size()):
var src_cel: BaseCel = project.frames[f].cels[l] # Cel we're copying from, the source
var new_cel: BaseCel
var selected_id := 0
if src_cel is Cel3D:
new_cel = src_cel.get_script().new(
src_cel.size, false, src_cel.object_properties, src_cel.scene_properties
)
if src_cel.selected != null:
selected_id = src_cel.selected.id
else:
new_cel = src_cel.get_script().new()
if project.layers[l].new_cels_linked:
@ -294,6 +298,9 @@ func copy_frames(indices := []) -> void:
else:
new_cel.set_content(src_cel.copy_content())
new_cel.opacity = src_cel.opacity
if new_cel is Cel3D:
if selected_id in new_cel.object_properties.keys():
new_cel.selected = new_cel.get_object_from_id(selected_id)
new_frame.cels.append(new_cel)
# Loop through the tags to see if the frame is in one