Video summary

Godot 3 - Tutorial - Tree Node and how to send signals to other GUI windows

Main summary

Key takeaways

Technology

Overview

This tutorial (by Karen T) demonstrates how to build and populate a Godot 3 Tree inside a GUI, organize it using sections/columns, and then use signals to communicate the selected item to other windows/controls.


1) Setup: separate GUI windows and basic Tree container

  • Creates a new scene: a “Quest List Window” (Control).
  • Adds a Tree node to it.
  • Resizes/contains the Tree within the window (e.g., using layout/anchors or container settings).
  • Mentions leveraging a prior “window” setup (importing/duplicating) instead of starting from scratch.

2) Tree population: hierarchical items (sections + children)

  • Notes that the Tree doesn’t provide much through the inspector (e.g., little obvious “text” configuration).
  • Most Tree setup happens in code.
  • Populates the Tree by creating items:
    • create_item() for root “sections”
    • create_item(parent, ...) for child items under each section
    • set_text(column, value) to place displayed content in a specific column
  • Explains hierarchy behavior:
    • Columns are indexed starting at 0
    • Items can be expanded/collapsed based on hierarchical structure
  • Example structure:
    • Sections such as “completed” and “ongoing”
    • Child quests under each section

3) Columns: how the Tree displays data

  • Demonstrates columns using set_columns(...) (initially conceptually using 3 columns, later simplifies).
  • Explains column-to-data mapping:
    • Column indices: 0, 1, 2, …
  • Then removes extra columns to focus on the core signal/selection workflow.
  • Emphasizes that understanding column handling is important (and that some tutorials omit key details).

4) More realistic data modeling (objects instead of plain text)

  • Moves from hardcoded strings to structured data:
    • Starts with a fake data dictionary like { "completed": [...], "ongoing": [...] }
    • Later replaces raw values with custom objects
  • Introduces a Quest class with properties such as:
    • title
    • time_limit
    • completed
  • Uses constructor-like initialization logic and getter/setter methods.
  • Loads a globally accessible class reference via Project Autoload (a Global script):
    • Uses preload so the quest class can be instantiated from anywhere.
  • Tree displayed text is set from object properties (e.g., quest title), not literals.

5) Selection handling with signals (core tutorial point)

  • Connects the Tree selection signal (e.g., cell_selected or equivalent).
  • In the selection callback, retrieves:
    • the selected Tree item
    • the displayed text via get_text(column)
    • and most importantly, metadata attached to the Tree item

6) Metadata: passing the actual selected object to other windows

  • Core technique:
    • Store a reference to the underlying Quest object in the Tree item’s metadata for a given column.
  • Example:
    • set_metadata(column, quest_object)
  • On selection:
    • Obtain the quest object via get_metadata(column)
  • Then the quest list control emits a custom signal:
    • quest_detail_requested(quest)
  • Includes an important caution:
    • Passing an object reference means other code could modify it (since it’s shared by reference), so this is something to be aware of.

7) Wiring the “Quest Details” window via Main (signal routing)

  • The Main script connects:
    • quest_list_control.quest_detail_requestedmain.on_quest_detail_requested
  • Main then updates another control:
    • quest_detail_control.set_quest_details(quest) (or equivalent)
  • The details control is treated as a view:
    • It displays data given to it and does not own the core data logic.

8) Architectural guidance / why this design

  • Emphasizes separation of concerns:
    • Tree/Quest List control: builds UI + emits selection intent
    • Main/game logic: decides what to do with the selected quest
    • Details window: displays details only
  • Notes future flexibility:
    • Add more columns (e.g., completion checkbox indicator, time remaining)
    • Use metadata to provide the needed object/data to UI logic elsewhere
  • Mentions a data-structure decision:
    • Uses arrays (instead of dictionaries) for quests when sorting and custom ordering is needed (e.g., sort by time, difficulty, completed status).

Main speakers / sources

  • Karen T — tutorial creator and presenter
  • Godot engine Tree node concepts:
    • selection signal
    • metadata usage
  • Autoload “Global” script:
    • used to preload/access the Quest class

Original video