The edit buttons now work in Continent aswell.

This commit is contained in:
Relintai 2022-08-05 22:32:04 +02:00
parent f6eb7b0720
commit 8a3ac51e86
3 changed files with 35 additions and 2 deletions

View File

@ -8,6 +8,10 @@ func _ready():
if !world.is_connected("request_item_edit", self, "on_world_request_item_edit"):
world.connect("request_item_edit", self, "on_world_request_item_edit")
var continent : Control = get_node("TabContainer/Continent")
if !continent.is_connected("request_item_edit", self, "on_continent_request_item_edit"):
continent.connect("request_item_edit", self, "on_continent_request_item_edit")
func set_plugin(plugin : EditorPlugin) -> void:
$TabContainer/World.set_plugin(plugin)
$TabContainer/Continent.set_plugin(plugin)
@ -34,3 +38,11 @@ func on_world_request_item_edit(resource : WorldGenBaseResource) -> void:
tc.current_tab = cont.get_position_in_parent()
cont.switch_to(resource)
func on_continent_request_item_edit(continent : WorldGenBaseResource, resource : WorldGenBaseResource) -> void:
var zone : Control = get_node("TabContainer/Zone")
var tc : TabContainer = get_node("TabContainer")
tc.current_tab = zone.get_position_in_parent()
zone.switch_to(continent, resource)

View File

@ -4,7 +4,7 @@ extends HBoxContainer
var edited_world : WorldGenWorld = null
var edited_continent : Continent = null
signal request_item_edit(world_gen_base_resource)
signal request_item_edit(continent, world_gen_base_resource)
func _ready():
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
@ -74,5 +74,5 @@ func on_item_selected(idx : int) -> void:
set_continent(option_button.get_item_metadata(idx))
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
emit_signal("request_item_edit", resource)
emit_signal("request_item_edit", edited_continent, resource)

View File

@ -87,6 +87,27 @@ func set_wgworld(wgw : WorldGenWorld) -> void:
refresh()
func switch_to(continent : WorldGenBaseResource, resource : WorldGenBaseResource) -> void:
var contob : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
for i in range(contob.get_item_count()):
var ccont : Continent = contob.get_item_metadata(i)
if (ccont == continent):
contob.select(i)
on_continent_item_selected(i)
break
var zoneob : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
for i in range(zoneob.get_item_count()):
var czone : Zone = zoneob.get_item_metadata(i)
if (czone == resource):
zoneob.select(i)
on_zone_item_selected(i)
return
func on_continent_item_selected(idx : int) -> void:
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton