Set up signal chain for the edit requests.

This commit is contained in:
Relintai 2022-08-05 22:12:03 +02:00
parent e675512362
commit 23195d3006
6 changed files with 43 additions and 4 deletions

View File

@ -11,7 +11,7 @@ var _ignore_changed_event : bool = false
var _plugin : EditorPlugin = null
var _undo_redo : UndoRedo = null
signal request_item_edit(world_gen_base_reosurce)
signal request_item_edit(world_gen_base_resource)
func _init():
if !is_connected("item_edited", self, "on_item_edited"):

View File

@ -3,6 +3,14 @@ extends HBoxContainer
var edited_world
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")
func set_plugin(plugin : EditorPlugin) -> void:
$HSplitContainer/ResourcePropertyList.set_plugin(plugin)
$HSplitContainer/RectEditor.set_plugin(plugin)
@ -17,3 +25,6 @@ func set_wgworld(wgw : WorldGenWorld) -> void:
edited_world = wgw
refresh()
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
emit_signal("request_item_edit", resource)

View File

@ -4,9 +4,16 @@ extends HBoxContainer
var edited_world : WorldGenWorld = null
var edited_continent : Continent = null
signal request_item_edit(world_gen_base_resource)
func _ready():
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
option_button.connect("item_selected", self, "on_item_selected")
var dl : Control = get_node("HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList")
if !dl.is_connected("request_item_edit", self, "on_request_item_edit"):
dl.connect("request_item_edit", self, "on_request_item_edit")
func set_plugin(plugin : EditorPlugin) -> void:
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
@ -54,3 +61,7 @@ func on_item_selected(idx : int) -> void:
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
set_continent(option_button.get_item_metadata(idx))
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
emit_signal("request_item_edit", resource)

View File

@ -6,6 +6,8 @@ var edited_continent : Continent = null
var edited_zone : Zone = null
var edited_sub_zone : SubZone = null
signal request_item_edit(world_gen_base_resource)
func _ready():
var coption_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
coption_button.connect("item_selected", self, "on_continent_item_selected")
@ -15,6 +17,10 @@ func _ready():
var szoption_button : OptionButton = $HSplitContainer/VBoxContainer/SubZoneOptionButton
szoption_button.connect("item_selected", self, "on_sub_zone_item_selected")
var dl : Control = get_node("HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList")
if !dl.is_connected("request_item_edit", self, "on_request_item_edit"):
dl.connect("request_item_edit", self, "on_request_item_edit")
func set_plugin(plugin : EditorPlugin) -> void:
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
@ -125,3 +131,7 @@ func on_sub_zone_item_selected(idx : int) -> void:
var option_button : OptionButton = $HSplitContainer/VBoxContainer/SubZoneOptionButton
set_sub_zone(option_button.get_item_metadata(idx))
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
emit_signal("request_item_edit", resource)

View File

@ -13,9 +13,6 @@ 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 = 839.0

View File

@ -5,12 +5,18 @@ var edited_world : WorldGenWorld = null
var edited_continent : Continent = null
var edited_zone : Zone = null
signal request_item_edit(world_gen_base_resource)
func _ready():
var coption_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
coption_button.connect("item_selected", self, "on_continent_item_selected")
var zoption_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
zoption_button.connect("item_selected", self, "on_zone_item_selected")
var dl : Control = get_node("HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList")
if !dl.is_connected("request_item_edit", self, "on_request_item_edit"):
dl.connect("request_item_edit", self, "on_request_item_edit")
func set_plugin(plugin : EditorPlugin) -> void:
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
@ -90,3 +96,7 @@ func on_zone_item_selected(idx : int) -> void:
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
set_zone(option_button.get_item_metadata(idx))
func on_request_item_edit(resource : WorldGenBaseResource) -> void:
emit_signal("request_item_edit", resource)