mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-20 10:33:54 +00:00
Add sprite selection and weapon viewer to weapon creation plugin
This commit is contained in:
parent
b4c38b159e
commit
04cb3da0cd
8 changed files with 327 additions and 10 deletions
|
|
@ -10,8 +10,13 @@ signal create_weapon_requested(weapon_data: Dictionary)
|
|||
var open_dialog_button: Button
|
||||
var clear_button: Button
|
||||
var log_output: RichTextLabel
|
||||
var weapon_viewer: PanelContainer
|
||||
|
||||
var _is_creating: bool = false
|
||||
var _editor_interface: EditorInterface
|
||||
|
||||
func setup(editor_interface: EditorInterface) -> void:
|
||||
_editor_interface = editor_interface
|
||||
|
||||
func _ready() -> void:
|
||||
_build_ui()
|
||||
|
|
@ -57,14 +62,34 @@ func _build_ui() -> void:
|
|||
|
||||
vbox.add_child(HSeparator.new())
|
||||
|
||||
# Log section
|
||||
# Horizontal split container for weapon viewer and log
|
||||
var hsplit = HSplitContainer.new()
|
||||
hsplit.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
vbox.add_child(hsplit)
|
||||
|
||||
# Log section (left side)
|
||||
var log_vbox = VBoxContainer.new()
|
||||
log_vbox.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
log_vbox.add_theme_constant_override("separation", 4)
|
||||
hsplit.add_child(log_vbox)
|
||||
|
||||
# Weapon Viewer (right side)
|
||||
var weapon_viewer_script = load("res://addons/weapon_creator/WeaponViewer.gd")
|
||||
weapon_viewer = PanelContainer.new()
|
||||
weapon_viewer.set_script(weapon_viewer_script)
|
||||
weapon_viewer.custom_minimum_size = Vector2(300, 0)
|
||||
weapon_viewer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
if _editor_interface:
|
||||
weapon_viewer.call("setup", _editor_interface)
|
||||
hsplit.add_child(weapon_viewer)
|
||||
|
||||
var log_label = Label.new()
|
||||
log_label.text = "Output Log:"
|
||||
vbox.add_child(log_label)
|
||||
log_vbox.add_child(log_label)
|
||||
|
||||
var log_scroll = ScrollContainer.new()
|
||||
log_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
vbox.add_child(log_scroll)
|
||||
log_vbox.add_child(log_scroll)
|
||||
|
||||
log_output = RichTextLabel.new()
|
||||
log_output.bbcode_enabled = true
|
||||
|
|
@ -79,6 +104,10 @@ func _on_open_dialog_pressed() -> void:
|
|||
var dialog = Window.new()
|
||||
dialog.set_script(dialog_script)
|
||||
|
||||
# Setup editor interface
|
||||
if _editor_interface:
|
||||
dialog.call("setup", _editor_interface)
|
||||
|
||||
# Connect to the confirmation signal
|
||||
dialog.weapon_data_confirmed.connect(_on_weapon_data_confirmed)
|
||||
|
||||
|
|
@ -109,3 +138,7 @@ func set_creation_complete() -> void:
|
|||
# Re-enable the create button after creation is complete
|
||||
_is_creating = false
|
||||
open_dialog_button.disabled = false
|
||||
|
||||
# Refresh weapon viewer to show newly created weapon
|
||||
if weapon_viewer:
|
||||
weapon_viewer.call("refresh_weapons")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue