mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-20 03:13:47 +00:00
Enable selection and context menu for log output; add filter settings for 2D/3D weapon display
This commit is contained in:
parent
402893ec17
commit
4787cd6691
2 changed files with 29 additions and 0 deletions
|
|
@ -14,8 +14,18 @@ var _items_database_path := "res://Resources/ItemsDatabase.tres"
|
|||
var _show_2d_checkbox: CheckBox
|
||||
var _show_3d_checkbox: CheckBox
|
||||
|
||||
const SETTING_SHOW_2D = "weapon_creator/filter_show_2d"
|
||||
const SETTING_SHOW_3D = "weapon_creator/filter_show_3d"
|
||||
|
||||
func setup(editor_interface: EditorInterface) -> void:
|
||||
_editor_interface = editor_interface
|
||||
# Load saved filter settings after editor interface is available
|
||||
if _show_2d_checkbox:
|
||||
_show_2d_checkbox.button_pressed = _load_filter_setting(SETTING_SHOW_2D, true)
|
||||
if _show_3d_checkbox:
|
||||
_show_3d_checkbox.button_pressed = _load_filter_setting(SETTING_SHOW_3D, true)
|
||||
# Refresh to apply loaded filter settings
|
||||
refresh_weapons()
|
||||
|
||||
func _ready() -> void:
|
||||
_build_ui()
|
||||
|
|
@ -120,8 +130,25 @@ func refresh_weapons() -> void:
|
|||
_add_error_label("No weapons found in database")
|
||||
|
||||
func _on_filter_changed(_toggled: bool) -> void:
|
||||
_save_filter_settings()
|
||||
refresh_weapons()
|
||||
|
||||
func _load_filter_setting(key: String, default_value: bool) -> bool:
|
||||
if not _editor_interface:
|
||||
return default_value
|
||||
var editor_settings = _editor_interface.get_editor_settings()
|
||||
if editor_settings and editor_settings.has_setting(key):
|
||||
return editor_settings.get_setting(key)
|
||||
return default_value
|
||||
|
||||
func _save_filter_settings() -> void:
|
||||
if not _editor_interface:
|
||||
return
|
||||
var editor_settings = _editor_interface.get_editor_settings()
|
||||
if editor_settings:
|
||||
editor_settings.set_setting(SETTING_SHOW_2D, _show_2d_checkbox.button_pressed)
|
||||
editor_settings.set_setting(SETTING_SHOW_3D, _show_3d_checkbox.button_pressed)
|
||||
|
||||
func _create_weapon_tile(loot_item: Resource, weapon_data: Resource, is_3d: bool) -> void:
|
||||
var panel = PanelContainer.new()
|
||||
panel.custom_minimum_size = Vector2(100, 145)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue