Access dialog that's visible in remote tree but not local tree

Godot Version

4.2

Question

I thought I had solved this, but apparently changes in the remote tree aren’t permanent (?).

I’m trying to access a ConfirmationDialog and set its wordwrap and font color. It’s visible in my remote tree, but not my local tree. It’s a child built into my FileDialog (“SaveDialog”). This ConfirmationDialog is pre-set to become visible when I try to overwrite a file. Since I didn’t add the dialog, I don’t have a node for it. So I’m trying to figure out how to access it.

Here it is in my remote tree:

It’s not in my local tree:

confirmation_dialog_not_visible_in_local_tree

I tried to get an array of everything I see in the remote tree like this:

func _on_choose_save_pressed():

$SaveDialog.set_visible(true)

$SaveDialog.initialize()

var save_dialog_children = $SaveDialog.get_children()

print("children of visible SaveDialog")

print(save_dialog_children)

Here’s the output, there’s nothing:

children of visible SaveDialog

[]

If I click on the ConfirmationDialog in the remote tree, I can access the Label under it and set the wordwrap and font color in the Inspector to what I want, but I don’t see a way to make those changes permanent. Is there a way?

Or some way with code to set them?

Thanks in advance for any suggestions.

Yes, the remote tree changes don’t get saved.

Node.get_children() returns an empty array because those nodes are internal. If you want to get them you’ll need to pass true to the include_internal parameter of that function.

It may be easier to filter them with Node.find_children() as you can pass an specific class to get.

Example:

extends Node


@onready var file_dialog: FileDialog = $FileDialog


func _ready() -> void:
	# Find all the ConfirmationDialogs
	var confirmation_dialogs = file_dialog.find_children("*", "ConfirmationDialog", false, false)
	for confirmation_dialog : ConfirmationDialog in confirmation_dialogs:
		# For each one find their labels
		var labels = confirmation_dialog.find_children("*", "Label", false, false)
		for label : Label in labels:
			# Change the label theme properties
			label.add_theme_font_size_override("font_size", 56)
			label.add_theme_color_override("font_color", Color.RED)
			
	# Popup the file dialog
	file_dialog.popup_centered(Vector2i(800,600))

Result: