Adds missing data

This commit is contained in:
Michel 2025-02-03 19:17:20 +01:00
parent e6391d9fdd
commit 53cdcc3433
620 changed files with 47293 additions and 151 deletions

View file

@ -0,0 +1,18 @@
@tool
extends PanelContainer
class_name TreeTextComponent
@export var text:String
@export var edit_mode:bool = false
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
%Label.text = text
%Label.visible = !edit_mode
%LineEdit.visible = edit_mode
pass

View file

@ -0,0 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://7xg6fyk4dust"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/tree/TreeTextComponent.gd" id="1_eruho"]
[node name="TreeTextLine" type="PanelContainer"]
offset_right = 216.0
offset_bottom = 31.0
script = ExtResource("1_eruho")
[node name="Label" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 2
text = "text label"
[node name="LineEdit" type="LineEdit" parent="."]
unique_name_in_owner = true
layout_mode = 2
text = "line edit"

View file

@ -0,0 +1,32 @@
@tool
class_name AbstractCyclopsTreeModel
signal tree_nodes_inserted(parent_node:Object, child_nodes:Array[Object], child_node_indices:PackedInt32Array)
signal tree_nodes_removed(parent_node:Object, child_nodes:Array[Object], child_node_indices:PackedInt32Array)
#Display data of node has changed, but no the child structore
signal value_for_node_changed(old_node:Object, new_node:Object)
#Rebuild this ode and all children
signal tree_node_changed(node:Object)
#Entire tree needs to be rebuilt
signal tree_structure_changed()
class CyclopsTreePath:
var path:Array[Object]
func get_child(parent:Object, index:int)->Object:
return null
func get_child_count(parent:Object)->int:
return 0
func get_index_of_child(parent:Object, child:Object)->int:
return -1
func get_root()->Object:
return null
func is_leaf(node:Object)->bool:
return true

View file

@ -0,0 +1,65 @@
@tool
extends PanelContainer
class_name CyclopsTree
@export var node_display_component:PackedScene
var model:AbstractCyclopsTreeModel:
get:
return model
set(value):
if model == value:
return
if model:
model.tree_nodes_inserted.disconnect(on_tree_nodes_inserted)
model.tree_nodes_removed.disconnect(on_tree_nodes_removed)
model.refresh_node.disconnect(on_refresh_node)
model.tree_node_changed.disconnect(on_tree_node_changed)
model.tree_structure_changed.disconnect(on_tree_structure_changed)
model = value
if model:
model.tree_nodes_inserted.connect(on_tree_nodes_inserted)
model.tree_nodes_removed.connect(on_tree_nodes_removed)
model.refresh_node.connect(on_refresh_node)
model.tree_node_changed.connect(on_tree_node_changed)
model.tree_structure_changed.connect(on_tree_structure_changed)
rebuild_tree()
func on_tree_nodes_inserted(parent_node:Object, child_nodes:Array[Object], child_node_indices:PackedInt32Array):
pass
func on_tree_nodes_removed(parent_node:Object, child_nodes:Array[Object], child_node_indices:PackedInt32Array):
pass
func on_refresh_node(old_node:Object, new_node:Object):
pass
func on_tree_node_changed(node:Object):
pass
func on_tree_structure_changed():
rebuild_tree()
func rebuild_tree():
for child in get_children():
remove_child(child)
child.queue_free()
if !model:
return
model.get_root()
pass
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

View file

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://cq6olx6nychug"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/tree/cyclops_tree.gd" id="1_5sunq"]
[node name="CyclopsTree" type="PanelContainer"]
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("1_5sunq")

View file

@ -0,0 +1,37 @@
[gd_scene load_steps=3 format=3 uid="uid://bd6lfhom4yxls"]
[ext_resource type="Texture2D" uid="uid://c7c2vg6lbhmfn" path="res://addons/cyclops_level_builder/art/icons/arrow_right.svg" id="1_rpn77"]
[ext_resource type="Texture2D" uid="uid://bor2x3t7fiqc2" path="res://addons/cyclops_level_builder/art/icons/arrow_down.svg" id="2_58w4p"]
[node name="PanelContainer" type="PanelContainer"]
offset_right = 230.0
offset_bottom = 210.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="bn_expand" type="TextureButton" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
toggle_mode = true
texture_normal = ExtResource("1_rpn77")
texture_pressed = ExtResource("2_58w4p")
[node name="NodeDisplayArea" type="PanelContainer" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="DropdownArea" type="HBoxContainer" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/DropdownArea"]
layout_mode = 2
theme_override_constants/margin_left = 8
[node name="ChildArea" type="PanelContainer" parent="VBoxContainer/DropdownArea"]
unique_name_in_owner = true
layout_mode = 2