using Godot; using Newlon; using Newlon.Components.GUI.Seedpackets; using Newlon.Components.Plants; public partial class Previewport : SubViewport { private RuntimePlantData current_display; [Export] private Label title; [Export] private Label description; public override void _Ready() { GetParent().GetViewport().GuiFocusChanged += OnFocusChanged; } public void OnFocusChanged(Control node) { if (node is Seedpacket packet) { ChangeDisplay(packet.GetPlantResource()); } } private void ChangeDisplay(PlantResource resource) { // Expand with updates if (current_display != null) { current_display.QueueFree(); } current_display = resource.Scene.Instantiate(); title.Text = resource.display_name; description.Text = resource.display_description; AddChild(current_display); current_display.DisableBrain(); } }