mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-22 02:17:18 +01:00
Now the world generator's editor plugin distributes the plugin itself to every class that will need it.
This commit is contained in:
parent
23344760e7
commit
181189f515
@ -26,6 +26,7 @@ func _enter_tree():
|
|||||||
add_custom_type("SubZone", "Resource", SSubZone, null)
|
add_custom_type("SubZone", "Resource", SSubZone, null)
|
||||||
|
|
||||||
editor_scene = editor_packed_scene.instance()
|
editor_scene = editor_packed_scene.instance()
|
||||||
|
editor_scene.set_plugin(self)
|
||||||
|
|
||||||
tool_button = add_control_to_bottom_panel(editor_scene, "World Editor")
|
tool_button = add_control_to_bottom_panel(editor_scene, "World Editor")
|
||||||
tool_button.hide()
|
tool_button.hide()
|
||||||
|
@ -6,9 +6,16 @@ export(int, "Continent,Zone,Sub Zone") var class_types : int = 0
|
|||||||
var edited_resource : WorldGenBaseResource = null
|
var edited_resource : WorldGenBaseResource = null
|
||||||
var name_edited_resource : WorldGenBaseResource = null
|
var name_edited_resource : WorldGenBaseResource = null
|
||||||
|
|
||||||
|
var _plugin : EditorPlugin = null
|
||||||
|
var _undo_redo : UndoRedo = null
|
||||||
|
|
||||||
func _init():
|
func _init():
|
||||||
connect("item_activated", self, "on_item_activated")
|
connect("item_activated", self, "on_item_activated")
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
_plugin = plugin
|
||||||
|
_undo_redo = _plugin.get_undo_redo()
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
var dir : Directory = Directory.new()
|
var dir : Directory = Directory.new()
|
||||||
|
|
||||||
|
@ -3,6 +3,12 @@ extends PanelContainer
|
|||||||
|
|
||||||
var edited_world
|
var edited_world
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
$TabContainer/World.set_wgworld(edited_world)
|
$TabContainer/World.set_wgworld(edited_world)
|
||||||
$TabContainer/Continent.set_wgworld(edited_world)
|
$TabContainer/Continent.set_wgworld(edited_world)
|
||||||
|
@ -5,5 +5,8 @@ func _init():
|
|||||||
# Control/EditorZoomWidget
|
# Control/EditorZoomWidget
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
$ScrollContainer/MarginContainer/RectView.set_plugin(plugin)
|
||||||
|
|
||||||
func set_edited_resource(res : WorldGenBaseResource):
|
func set_edited_resource(res : WorldGenBaseResource):
|
||||||
$ScrollContainer/MarginContainer/RectView.set_edited_resource(res)
|
$ScrollContainer/MarginContainer/RectView.set_edited_resource(res)
|
||||||
|
@ -10,6 +10,9 @@ var _rect_scale : float = 1
|
|||||||
var edited_resource : WorldGenBaseResource = null
|
var edited_resource : WorldGenBaseResource = null
|
||||||
var edited_resource_current_size : Vector2 = Vector2()
|
var edited_resource_current_size : Vector2 = Vector2()
|
||||||
|
|
||||||
|
var _plugin : EditorPlugin = null
|
||||||
|
var _undo_redo : UndoRedo = null
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
var zoom_widget : Node = get_node_or_null(zoom_widget_path)
|
var zoom_widget : Node = get_node_or_null(zoom_widget_path)
|
||||||
|
|
||||||
@ -22,6 +25,10 @@ func _enter_tree():
|
|||||||
if !is_connected("visibility_changed", self, "on_visibility_changed"):
|
if !is_connected("visibility_changed", self, "on_visibility_changed"):
|
||||||
connect("visibility_changed", self, "on_visibility_changed")
|
connect("visibility_changed", self, "on_visibility_changed")
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
_plugin = plugin
|
||||||
|
_undo_redo = _plugin.get_undo_redo()
|
||||||
|
|
||||||
func on_visibility_changed() -> void:
|
func on_visibility_changed() -> void:
|
||||||
call_deferred("apply_zoom")
|
call_deferred("apply_zoom")
|
||||||
|
|
||||||
|
@ -6,6 +6,13 @@ var EditorResourceWidget : PackedScene = preload("res://addons/world_generator/w
|
|||||||
var _edited_resource : WorldGenBaseResource = null
|
var _edited_resource : WorldGenBaseResource = null
|
||||||
var properties : Array = Array()
|
var properties : Array = Array()
|
||||||
|
|
||||||
|
var _plugin : EditorPlugin = null
|
||||||
|
var _undo_redo : UndoRedo = null
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
_plugin = plugin
|
||||||
|
_undo_redo = _plugin.get_undo_redo()
|
||||||
|
|
||||||
func add_h_separator() -> int:
|
func add_h_separator() -> int:
|
||||||
var hsep : HSeparator = HSeparator.new()
|
var hsep : HSeparator = HSeparator.new()
|
||||||
|
|
||||||
|
@ -3,6 +3,11 @@ extends HBoxContainer
|
|||||||
|
|
||||||
var edited_world
|
var edited_world
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
$HSplitContainer/ResourcePropertyList.set_plugin(plugin)
|
||||||
|
$HSplitContainer/RectEditor.set_plugin(plugin)
|
||||||
|
$VBoxContainer/DataList.set_plugin(plugin)
|
||||||
|
|
||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
$HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
|
$HSplitContainer/ResourcePropertyList.edit_resource(edited_world)
|
||||||
$VBoxContainer/DataList.set_edited_resource(edited_world)
|
$VBoxContainer/DataList.set_edited_resource(edited_world)
|
||||||
|
@ -8,6 +8,11 @@ func _ready():
|
|||||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
|
var option_button : OptionButton = $HSplitContainer/VBoxContainer/OptionButton
|
||||||
option_button.connect("item_selected", self, "on_item_selected")
|
option_button.connect("item_selected", self, "on_item_selected")
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
|
||||||
|
$HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList.set_plugin(plugin)
|
||||||
|
$HSplitContainer/RectEditor.set_plugin(plugin)
|
||||||
|
|
||||||
func refresh_continent() -> void:
|
func refresh_continent() -> void:
|
||||||
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.edit_resource(edited_continent)
|
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.edit_resource(edited_continent)
|
||||||
$HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList.set_edited_resource(edited_continent)
|
$HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList.set_edited_resource(edited_continent)
|
||||||
|
@ -16,6 +16,9 @@ func _ready():
|
|||||||
var szoption_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
var szoption_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||||
szoption_button.connect("item_selected", self, "on_sub_zone_item_selected")
|
szoption_button.connect("item_selected", self, "on_sub_zone_item_selected")
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
$VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
|
||||||
|
|
||||||
func continent_changed() -> void:
|
func continent_changed() -> void:
|
||||||
var option_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
var option_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||||
option_button.clear()
|
option_button.clear()
|
||||||
|
@ -12,6 +12,11 @@ func _ready():
|
|||||||
var zoption_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
var zoption_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||||
zoption_button.connect("item_selected", self, "on_zone_item_selected")
|
zoption_button.connect("item_selected", self, "on_zone_item_selected")
|
||||||
|
|
||||||
|
func set_plugin(plugin : EditorPlugin) -> void:
|
||||||
|
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
|
||||||
|
$HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList.set_plugin(plugin)
|
||||||
|
$HSplitContainer/RectEditor.set_plugin(plugin)
|
||||||
|
|
||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||||
option_button.clear()
|
option_button.clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user