The edit button now works from World to Continent.

This commit is contained in:
Relintai 2022-08-05 22:20:29 +02:00
parent 23195d3006
commit f6eb7b0720
4 changed files with 24 additions and 4 deletions

View File

@ -3,6 +3,11 @@ extends PanelContainer
var edited_world
func _ready():
var world : Control = get_node("TabContainer/World")
if !world.is_connected("request_item_edit", self, "on_world_request_item_edit"):
world.connect("request_item_edit", self, "on_world_request_item_edit")
func set_plugin(plugin : EditorPlugin) -> void:
$TabContainer/World.set_plugin(plugin)
$TabContainer/Continent.set_plugin(plugin)
@ -21,3 +26,11 @@ func set_wgworld(wgw : WorldGenWorld) -> void:
edited_world = wgw
refresh()
func on_world_request_item_edit(resource : WorldGenBaseResource) -> void:
var cont : Control = get_node("TabContainer/Continent")
var tc : TabContainer = get_node("TabContainer")
tc.current_tab = cont.get_position_in_parent()
cont.switch_to(resource)

View File

@ -13,9 +13,6 @@ anchor_bottom = 1.0
rect_min_size = Vector2( 0, 200 )
size_flags_vertical = 3
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TabContainer" type="TabContainer" parent="."]
margin_left = 7.0

View File

@ -7,7 +7,6 @@ signal request_item_edit(world_gen_base_resource)
func _ready():
var dl : Control = get_node("VBoxContainer/DataList")
if !dl.is_connected("request_item_edit", self, "on_request_item_edit"):
dl.connect("request_item_edit", self, "on_request_item_edit")

View File

@ -52,6 +52,17 @@ func set_wgworld(wgw : WorldGenWorld) -> void:
refresh()
func switch_to(resource : WorldGenBaseResource) -> void:
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
for i in range(option_button.get_item_count()):
var continent : Continent = option_button.get_item_metadata(i)
if (continent == resource):
option_button.select(i)
on_item_selected(i)
return
func set_continent(continent : Continent) -> void:
edited_continent = continent