Move World's setup to the World class.

This commit is contained in:
Relintai 2021-12-25 02:32:00 +01:00
parent ba1c85b729
commit c34b629b26
4 changed files with 41 additions and 38 deletions

View File

@ -4,9 +4,7 @@ extends PanelContainer
var edited_world
func refresh() -> void:
$TabContainer/World/HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
$TabContainer/World/VBoxContainer/DataList.set_edited_resource(edited_world)
$TabContainer/World/HSplitContainer/RectEditor.set_edited_resource(edited_world)
$TabContainer/World.set_wgworld(edited_world)
func set_wgworld(wgw : WorldGenWorld) -> void:
edited_world = wgw

View File

@ -24,6 +24,11 @@ tab_align = 0
[node name="World" parent="TabContainer" instance=ExtResource( 2 )]
[node name="Continent" parent="TabContainer" instance=ExtResource( 3 )]
visible = false
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
[node name="Zone" type="VBoxContainer" parent="TabContainer"]
visible = false

View File

@ -1,3 +1,14 @@
tool
extends HBoxContainer
var edited_world
func refresh() -> void:
$HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
$VBoxContainer/DataList.set_edited_resource(edited_world)
$HSplitContainer/RectEditor.set_edited_resource(edited_world)
func set_wgworld(wgw : WorldGenWorld) -> void:
edited_world = wgw
refresh()

View File

@ -1,9 +1,6 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/world_generator/ui/DataList.gd" type="Script" id=1]
[ext_resource path="res://addons/world_generator/ui/ResourcePropertyList.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/world_generator/ui/ResourcePropertyList.gd" type="Script" id=3]
[ext_resource path="res://addons/world_generator/ui/RectEditor.gd" type="Script" id=4]
[ext_resource path="res://addons/world_generator/ui/WorldTab.gd" type="Script" id=5]
[ext_resource path="res://addons/world_generator/ui/DataList.tscn" type="PackedScene" id=6]
[ext_resource path="res://addons/world_generator/ui/RectEditor.tscn" type="PackedScene" id=7]
@ -16,36 +13,33 @@ margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HSplitContainer" type="HSplitContainer" parent="."]
margin_right = 825.0
margin_bottom = 550.0
margin_right = 839.0
margin_bottom = 564.0
size_flags_horizontal = 3
[node name="RectEditor" type="PanelContainer" parent="HSplitContainer" instance=ExtResource( 7 )]
margin_right = 713.0
margin_bottom = 550.0
[node name="RectEditor" parent="HSplitContainer" instance=ExtResource( 7 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 727.0
margin_bottom = 564.0
size_flags_horizontal = 3
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ResourcePropertyList" type="ScrollContainer" parent="HSplitContainer" instance=ExtResource( 2 )]
margin_left = 725.0
margin_right = 825.0
margin_bottom = 550.0
rect_min_size = Vector2( 100, 0 )
scroll_horizontal_enabled = false
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ResourcePropertyList" parent="HSplitContainer" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 739.0
margin_right = 839.0
margin_bottom = 564.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 829.0
margin_right = 1002.0
margin_bottom = 550.0
margin_left = 843.0
margin_right = 1016.0
margin_bottom = 564.0
[node name="Label" type="Label" parent="VBoxContainer"]
margin_right = 173.0
@ -76,16 +70,11 @@ margin_right = 173.0
margin_bottom = 20.0
text = "Duplicate"
[node name="DataList" type="Tree" parent="VBoxContainer" instance=ExtResource( 6 )]
[node name="DataList" parent="VBoxContainer" instance=ExtResource( 6 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 42.0
margin_right = 173.0
margin_bottom = 550.0
size_flags_horizontal = 3
size_flags_vertical = 3
hide_root = true
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
margin_bottom = 564.0
[connection signal="pressed" from="VBoxContainer/HBoxContainer/AddButton" to="VBoxContainer/DataList" method="add_button_pressed"]