2021-12-21 21:57:15 +01:00
|
|
|
tool
|
|
|
|
extends PanelContainer
|
|
|
|
|
|
|
|
var edited_world
|
|
|
|
|
2022-08-05 22:20:29 +02:00
|
|
|
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")
|
2022-08-05 22:32:04 +02:00
|
|
|
|
|
|
|
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")
|
2022-08-05 22:41:18 +02:00
|
|
|
|
|
|
|
var zone : Control = get_node("TabContainer/Zone")
|
|
|
|
if !zone.is_connected("request_item_edit", self, "on_zone_request_item_edit"):
|
|
|
|
zone.connect("request_item_edit", self, "on_zone_request_item_edit")
|
2022-08-05 22:20:29 +02:00
|
|
|
|
2022-01-21 22:58:14 +01:00
|
|
|
func set_plugin(plugin : EditorPlugin) -> void:
|
|
|
|
$TabContainer/World.set_plugin(plugin)
|
|
|
|
$TabContainer/Continent.set_plugin(plugin)
|
|
|
|
$TabContainer/Zone.set_plugin(plugin)
|
|
|
|
$TabContainer/SubZone.set_plugin(plugin)
|
2022-08-05 00:27:03 +02:00
|
|
|
$TabContainer/SubZoneProp.set_plugin(plugin)
|
2022-01-21 22:58:14 +01:00
|
|
|
|
2021-12-21 21:57:15 +01:00
|
|
|
func refresh() -> void:
|
2021-12-25 02:32:00 +01:00
|
|
|
$TabContainer/World.set_wgworld(edited_world)
|
2021-12-25 02:33:43 +01:00
|
|
|
$TabContainer/Continent.set_wgworld(edited_world)
|
2021-12-25 12:18:59 +01:00
|
|
|
$TabContainer/Zone.set_wgworld(edited_world)
|
2021-12-25 12:31:36 +01:00
|
|
|
$TabContainer/SubZone.set_wgworld(edited_world)
|
2022-08-05 00:27:03 +02:00
|
|
|
$TabContainer/SubZoneProp.set_wgworld(edited_world)
|
2021-12-21 21:57:15 +01:00
|
|
|
|
|
|
|
func set_wgworld(wgw : WorldGenWorld) -> void:
|
|
|
|
edited_world = wgw
|
|
|
|
|
|
|
|
refresh()
|
2022-08-05 22:20:29 +02:00
|
|
|
|
|
|
|
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)
|
2022-08-05 22:32:04 +02:00
|
|
|
|
|
|
|
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)
|
2022-08-05 22:41:18 +02:00
|
|
|
|
|
|
|
func on_zone_request_item_edit(continent : WorldGenBaseResource, zone : WorldGenBaseResource, subzone : WorldGenBaseResource) -> void:
|
|
|
|
var sz : Control = get_node("TabContainer/SubZone")
|
|
|
|
|
|
|
|
var tc : TabContainer = get_node("TabContainer")
|
|
|
|
tc.current_tab = sz.get_position_in_parent()
|
|
|
|
|
|
|
|
sz.switch_to(continent, zone, subzone)
|
|
|
|
|