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,59 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends OptionButton
class_name EnumLineEdit
signal option_selected(index:int)
@export var item_list:PackedStringArray:
get:
return item_list
set(value):
item_list = value
dirty = true
var dirty:bool = true
# 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):
if dirty:
clear()
for name in item_list:
add_item(name)
dirty = false
func _on_item_selected(index):
option_selected.emit(index)

View file

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://7ur3lovebuua"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/enum_line_edit.gd" id="1_ltl6a"]
[node name="EnumLineEdit" type="OptionButton"]
script = ExtResource("1_ltl6a")
[connection signal="item_selected" from="." to="." method="_on_item_selected"]

View file

@ -0,0 +1,51 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends PanelContainer
class_name FoldOutPanel
@export var open:bool = true
@export var text:String = ""
func get_content_area():
return %ContentArea
# 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):
%HeaderButton.text = text
if open:
%HeaderButton.icon = preload("res://addons/cyclops_level_builder/art/icons/arrow_down.svg")
%ContentArea.visible = true
else:
%HeaderButton.icon = preload("res://addons/cyclops_level_builder/art/icons/arrow_right.svg")
%ContentArea.visible = false
func _on_button_pressed():
open = !open

View file

@ -0,0 +1,37 @@
[gd_scene load_steps=3 format=3 uid="uid://bk0eelj64x4fk"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/fold_out_panel.gd" id="1_n3mr0"]
[ext_resource type="Texture2D" uid="uid://c7c2vg6lbhmfn" path="res://addons/cyclops_level_builder/art/icons/arrow_right.svg" id="2_dwm1s"]
[node name="FoldOutPanel" type="PanelContainer"]
offset_right = 245.0
offset_bottom = 219.0
script = ExtResource("1_n3mr0")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="HeaderButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Fold Name"
icon = ExtResource("2_dwm1s")
alignment = 0
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/PanelContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 8
[node name="ContentArea" type="PanelContainer" parent="VBoxContainer/PanelContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[connection signal="pressed" from="VBoxContainer/HeaderButton" to="." method="_on_button_pressed"]

View file

@ -0,0 +1,139 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends PanelContainer
class_name NumbericLineEdit
signal value_changed(value:float)
@export var value:float:
get:
return value
set(v):
if value == v:
return
value = v
dirty = true
@export var snap_size:float = 1
@export var disabled:bool = false
var dirty:bool = true
enum NumEditState{ IDLE, READY, DRAGGING, TEXT_EDIT }
var state:NumEditState = NumEditState.IDLE
var mouse_down_pos:Vector2
var drag_start_radius:float = 4
var value_start_drag:float
var line_input:LineEdit
var line_display:Label
# Called when the node enters the scene tree for the first time.
func _ready():
var foo = $HBoxContainer/line_display
var uuu = get_node("HBoxContainer/line_display")
line_input = %line_input
line_display = %line_display
if line_input:
line_input.visible = false
pass
func _process(delta):
if dirty:
# print("---value " + str(value))
if line_input:
line_input.text = format_number(value)
line_display.text = format_number(value)
dirty = false
func format_number(val:float)->String:
var text:String = "%.5f" % val
var idx:int = text.findn(".")
if idx != -1:
text = text.rstrip("0")
if text.right(1) == ".":
text = text.left(-1)
return text
func _gui_input(event):
if event is InputEventMouseButton:
var e:InputEventMouseButton = event
if e.is_pressed():
if state == NumEditState.IDLE:
mouse_down_pos = e.position
state = NumEditState.READY
else:
if state == NumEditState.READY:
if line_input:
line_input.visible = true
line_display.visible = false
state = NumEditState.TEXT_EDIT
elif state == NumEditState.DRAGGING:
state = NumEditState.IDLE
accept_event()
elif event is InputEventMouseMotion:
var e:InputEventMouseMotion = event
if state == NumEditState.READY:
if e.position.distance_to(mouse_down_pos) >= drag_start_radius:
state = NumEditState.DRAGGING
value_start_drag = value
elif state == NumEditState.DRAGGING:
var offset = e.position.x - mouse_down_pos.x
var new_value = value_start_drag + (offset * snap_size / 20.0)
#print("-new_value %s" % new_value)
new_value = ceil(new_value / snap_size) * snap_size
#print("new_value %s" % new_value)
if value != new_value:
value = new_value
value_changed.emit(value)
dirty = true
func _on_line_edit_text_submitted(new_text):
var regex = RegEx.new()
regex.compile("^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)$")
var result:RegExMatch = regex.search(new_text)
if result:
# print("found match")
value = float(new_text)
value_changed.emit(value)
dirty = true
state = NumEditState.IDLE
if line_input:
line_input.visible = false
line_display.visible = true

View file

@ -0,0 +1,44 @@
[gd_scene load_steps=5 format=3 uid="uid://diibmlqy1mpqb"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/numeric_line_edit.gd" id="1_u8bpo"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_o7f15"]
bg_color = Color(0.0627451, 0.0627451, 0.0627451, 1)
[sub_resource type="Theme" id="Theme_cw2vs"]
Label/styles/normal = SubResource("StyleBoxFlat_o7f15")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8gfnv"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
[node name="numeric_line_edit" type="PanelContainer"]
offset_right = 476.0
offset_bottom = 23.0
script = ExtResource("1_u8bpo")
snap_size = 0.125
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="line_input" type="LineEdit" parent="HBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 3
text = "0"
alignment = 2
select_all_on_focus = true
[node name="line_display" type="Label" parent="HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = SubResource("Theme_cw2vs")
theme_override_styles/normal = SubResource("StyleBoxEmpty_8gfnv")
text = "0"
horizontal_alignment = 2
[connection signal="text_submitted" from="HBoxContainer/line_input" to="." method="_on_line_edit_text_submitted"]

View file

@ -0,0 +1,66 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends CheckBox
class_name LineEditorBool
var resource:Resource:
get:
return resource
set(value):
resource = value
dirty = true
var prop_name:String:
get:
return prop_name
set(value):
prop_name = value
dirty = true
var dirty = true
func update_from_resource():
if resource:
var result = resource.get(prop_name)
if result != null:
button_pressed = result
# 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):
if dirty:
update_from_resource()
dirty = false
func _on_toggled(button_pressed):
if resource:
# print("prop_name %s" % prop_name)
# print("button_pressed %s" % button_pressed)
resource.set(prop_name, button_pressed)

View file

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://dpncabeqiv1xo"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/resource_inspector/line_editor_bool.gd" id="1_sn3qq"]
[node name="CheckBox" type="CheckBox"]
offset_right = 24.0
offset_bottom = 24.0
script = ExtResource("1_sn3qq")
[connection signal="toggled" from="." to="." method="_on_toggled"]

View file

@ -0,0 +1,65 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends SpinBox
class_name LineEditorFloat
var resource:Resource:
get:
return resource
set(value):
resource = value
dirty = true
var prop_name:String:
get:
return prop_name
set(value):
prop_name = value
dirty = true
var dirty = true
func update_from_resource():
if resource:
var result = resource.get(prop_name)
if result != null:
value = result
# 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):
if dirty:
update_from_resource()
dirty = false
func _on_value_changed(value):
if resource:
resource.set(prop_name, value)

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=3 uid="uid://dg45e7tw7ttu3"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/resource_inspector/line_editor_float.gd" id="1_o1hmb"]
[node name="SpinBox" type="SpinBox"]
offset_right = 83.0625
offset_bottom = 31.0
step = 0.001
script = ExtResource("1_o1hmb")
[connection signal="value_changed" from="." to="." method="_on_value_changed"]

View file

@ -0,0 +1,71 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends SpinBox
class_name LineEditorInt
var resource:Resource:
get:
return resource
set(value):
resource = value
dirty = true
var prop_name:String:
get:
return prop_name
set(value):
prop_name = value
dirty = true
var dirty = true
func update_from_resource():
#print("update_from_resource()")
if resource:
#print("resource %s" % resource)
#print("prop_name %s" % prop_name)
var result = resource.get(prop_name)
#print("result %s" % result)
if result != null:
value = result
# 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):
if dirty:
update_from_resource()
dirty = false
func _on_value_changed(value):
# print("_on_value_changed(value)")
if resource:
# print("prop_name %s" % prop_name)
# print("value %s" % value)
resource.set(prop_name, value)

View file

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://dh6frljlp7oqe"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/resource_inspector/line_editor_int.gd" id="1_ryygx"]
[node name="SpinBox" type="SpinBox"]
offset_right = 83.0625
offset_bottom = 40.0
script = ExtResource("1_ryygx")
[connection signal="value_changed" from="." to="." method="_on_value_changed"]

View file

@ -0,0 +1,86 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends Control
class_name ResourceInspector
@export var target:Resource:
get:
return target
set(value):
target = value
build()
func add_label(name:String):
var label:Label = Label.new()
label.text = name
$GridContainer.add_child(label)
func build():
for child in $GridContainer.get_children():
$GridContainer.remove_child(child)
if !target:
return
for prop_dict in target.get_property_list():
var prop_name:String = prop_dict["name"]
# prop_dict["class_name"]
var type:Variant.Type = prop_dict["type"]
match type:
TYPE_BOOL:
add_label(prop_name)
var editor:LineEditorBool = preload("res://addons/cyclops_level_builder/controls/resource_inspector/line_editor_bool.tscn").instantiate()
editor.resource = target
editor.prop_name = prop_name
$GridContainer.add_child(editor)
TYPE_INT:
add_label(prop_name)
var editor:LineEditorInt = preload("res://addons/cyclops_level_builder/controls/resource_inspector/line_editor_int.tscn").instantiate()
editor.resource = target
editor.prop_name = prop_name
$GridContainer.add_child(editor)
TYPE_FLOAT:
add_label(prop_name)
var editor:LineEditorFloat = preload("res://addons/cyclops_level_builder/controls/resource_inspector/line_editor_float.tscn").instantiate()
editor.resource = target
editor.prop_name = prop_name
$GridContainer.add_child(editor)
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,18 @@
[gd_scene load_steps=2 format=3 uid="uid://c2484sv0ymy2e"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/resource_inspector/resource_inspector.gd" id="1_m3yhx"]
[node name="object_inspector" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_m3yhx")
[node name="GridContainer" type="GridContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
columns = 2

View file

@ -0,0 +1,16 @@
@tool
extends Control
class_name TestLineEdit
# 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 = "Bar"
var lab:Label = get_node("Label")
print(lab.text)
pass

View file

@ -0,0 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://boco8mwkm8bc3"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/test_line_edit.gd" id="1_i4c5n"]
[node name="test_line_edit" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_i4c5n")
[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
text = "Foo"

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

View file

@ -0,0 +1,44 @@
@tool
extends HBoxContainer
class_name Vector3Edit
signal value_changed(value:Vector3)
@export var value:Vector3:
get:
return value
set(v):
if value == v:
return
value = v
value_changed.emit(v)
dirty = true
var dirty:bool = true
# 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):
if dirty:
%edit_x.value = value.x
%edit_y.value = value.y
%edit_z.value = value.z
dirty = false
func _on_edit_x_value_changed(v:float):
value = Vector3(v, value.y, value.z)
func _on_edit_y_value_changed(v:float):
value = Vector3(value.x, v, value.z)
func _on_edit_z_value_changed(v:float):
value = Vector3(value.x, value.y, v)

View file

@ -0,0 +1,40 @@
[gd_scene load_steps=3 format=3 uid="uid://cphtpklx81l3w"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/vector3_edit.gd" id="1_lnptu"]
[ext_resource type="PackedScene" uid="uid://diibmlqy1mpqb" path="res://addons/cyclops_level_builder/controls/numeric_line_edit.tscn" id="2_wjq53"]
[node name="vector3_edit" type="HBoxContainer"]
offset_right = 237.0
offset_bottom = 26.0
script = ExtResource("1_lnptu")
[node name="Label" type="Label" parent="."]
layout_mode = 2
text = "X:"
[node name="edit_x" parent="." instance=ExtResource("2_wjq53")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="Label" parent="."]
layout_mode = 2
text = "Y:"
[node name="edit_y" parent="." instance=ExtResource("2_wjq53")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="Label3" type="Label" parent="."]
layout_mode = 2
text = "Z:"
[node name="edit_z" parent="." instance=ExtResource("2_wjq53")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[connection signal="value_changed" from="edit_x" to="." method="_on_edit_x_value_changed"]
[connection signal="value_changed" from="edit_y" to="." method="_on_edit_y_value_changed"]
[connection signal="value_changed" from="edit_z" to="." method="_on_edit_z_value_changed"]

View file

@ -0,0 +1,56 @@
# MIT License
#
# Copyright (c) 2023 Mark McKay
# https://github.com/blackears/cyclopsLevelBuilder
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends Node3D
class_name VertexBillboard
@export var radius:float = 4:
get:
return radius
set(value):
radius = value
dirty = true
@export var color:Color = Color.WHITE:
get:
return color
set(value):
color = value
dirty = true
var dirty:bool = true
# 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):
if dirty:
var mat:ShaderMaterial = $MeshInstance3D.get_active_material(0)
#print("active mat %s" % mat)
mat.set_shader_parameter("radius", radius)
mat.set_shader_parameter("emission", color)
dirty = false

View file

@ -0,0 +1,14 @@
[gd_scene load_steps=4 format=3 uid="uid://cuykufmlg2unb"]
[ext_resource type="Script" path="res://addons/cyclops_level_builder/controls/vertex_billboard.gd" id="1_cman8"]
[ext_resource type="Material" uid="uid://rtk56g3h03nt" path="res://addons/cyclops_level_builder/materials/vertex_active_material.tres" id="2_ov23w"]
[sub_resource type="QuadMesh" id="QuadMesh_5jfb0"]
[node name="vertex_billboard" type="Node3D"]
script = ExtResource("1_cman8")
color = Color(0, 1, 0, 1)
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
material_override = ExtResource("2_ov23w")
mesh = SubResource("QuadMesh_5jfb0")