mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-20 21:07:17 +01:00
The edit button now works from World to Continent.
This commit is contained in:
parent
23195d3006
commit
f6eb7b0720
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user