Godot Version
Question
How to enable editable_children on a new instance of a packed scene (Level Object). The level object has child nodes which I am able to select and change the global position of in the editor. This packed scene will be added to another packed scene (Level). I have set the owners to the level objects and thier children, but open saving the level before playtesting through a button click, The child node of the level object resets it’s position. I have anually enabled editable_children to that level object in the level editor and it works. I would like acess to this feature in script using godot 3.5. I have seen this function in 4.0 but not in 3.5 and I cant upgrade since my project is large. This is an urgent request, help is much appreciated.
EditorPauseMenu.gd → Script responsible for saving the PackedScene Level
var packed_scene = PackedScene.new()
for child in get_parent().get_parent().get_node("Level").get_children():
if child.owner == null:
# children of this child are not saving thier modifications
# like thier global_position
child.owner = get_parent().get_parent().get_node("Level")
packed_scene.pack(get_parent().get_parent().get_node("Level"))
var err = ResourceSaver.save(Globals.Editor_CurrentLocalLevelFileName, packed_scene)
Level Editor.gd
if MoveableObject != null:
if MoveableObject.PortalDestinationClicked:
MoveableObject.get_node("PortalExit").global_position = get_global_mouse_position()
if MoveableObject == null:
var results2 = space_state.intersect_point(get_global_mouse_position(), 32, [], Globals.ChildObjectSelectionWithMouseLayer, false, true)
if results2.size() > 0:
var object2 = get_topmost_object(results2)
MoveableObject = object2
MoveableObject.PortalDestinationClicked = not MoveableObject.PortalDestinationClicked
else:
MoveableObject.PortalDestinationClicked = not MoveableObject.PortalDestinationClicked
Portal.gd
extends Node2D
var selected = false
var PortalDestinationClicked = false
func select():
if get_parent().get_parent().EDIT_MODE == "SELECT":
get_parent().get_parent().Selected_Object = self
selected = true
func unselect():
if get_parent().get_parent().EDIT_MODE == "SELECT":
get_parent().get_parent().Selected_Object = null
selected = false