mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Now when a module is toggled on in the data manager, it will add entries to to folder tab, based on what folders are available in it.
This commit is contained in:
parent
33ea23e3c3
commit
d8f93baeba
@ -5,71 +5,71 @@
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
folder_count = 24
|
||||
folders/0/folder = "res://data/entity_resources/"
|
||||
folders/0/folder = "entity_resources"
|
||||
folders/0/header = "Entities"
|
||||
folders/0/name = "Entity Resources"
|
||||
folders/0/type = "EntityResourceData"
|
||||
folders/1/folder = "res://data/entity_skills/"
|
||||
folders/1/folder = "entity_skills"
|
||||
folders/1/header = ""
|
||||
folders/1/name = "Skills"
|
||||
folders/1/type = "EntitySkillData"
|
||||
folders/2/folder = "res://data/entities/"
|
||||
folders/2/folder = "entities"
|
||||
folders/2/header = ""
|
||||
folders/2/name = "Entities"
|
||||
folders/2/type = "EntityData"
|
||||
folders/3/folder = "res://data/player_character_data/"
|
||||
folders/3/folder = "player_character_data"
|
||||
folders/3/header = ""
|
||||
folders/3/name = "Player Characters"
|
||||
folders/3/type = "EntityData"
|
||||
folders/4/folder = "res://data/entity_classes/"
|
||||
folders/4/folder = "entity_classes"
|
||||
folders/4/header = ""
|
||||
folders/4/name = "Classes"
|
||||
folders/4/type = "EntityClassData"
|
||||
folders/5/folder = "res://data/ai/"
|
||||
folders/5/folder = "ai"
|
||||
folders/5/header = ""
|
||||
folders/5/name = "AI"
|
||||
folders/5/type = "AIAction"
|
||||
folders/6/folder = "res://data/character_models/"
|
||||
folders/6/folder = "character_models"
|
||||
folders/6/header = "Models"
|
||||
folders/6/name = "Models"
|
||||
folders/6/type = "MeshDataResource"
|
||||
folders/7/folder = "res://data/character_textures/"
|
||||
folders/7/folder = "character_textures"
|
||||
folders/7/header = ""
|
||||
folders/7/name = "Textures"
|
||||
folders/7/type = "Texture"
|
||||
folders/8/folder = "res://data/spells/"
|
||||
folders/8/folder = "spells"
|
||||
folders/8/header = "Spells"
|
||||
folders/8/name = "Spells"
|
||||
folders/8/type = "Spell"
|
||||
folders/9/folder = "res://data/aura_groups/"
|
||||
folders/9/folder = "aura_groups"
|
||||
folders/9/header = ""
|
||||
folders/9/name = "Aura Groups"
|
||||
folders/9/type = "AuraGroup"
|
||||
folders/10/folder = "res://data/character_specs/"
|
||||
folders/10/folder = "character_specs"
|
||||
folders/10/header = ""
|
||||
folders/10/name = "Specs"
|
||||
folders/10/type = "CharacterSpec"
|
||||
folders/11/folder = "res://data/effect_data/"
|
||||
folders/11/folder = "effect_data"
|
||||
folders/11/header = ""
|
||||
folders/11/name = "Effect Datas"
|
||||
folders/11/type = "SpellEffectVisual"
|
||||
folders/12/folder = "res://data/world_spells/"
|
||||
folders/12/folder = "world_spells"
|
||||
folders/12/header = ""
|
||||
folders/12/name = "World Spells"
|
||||
folders/12/type = "WorldSpellData"
|
||||
folders/13/folder = "res://data/item_templates/"
|
||||
folders/13/folder = "item_templates"
|
||||
folders/13/header = "Items"
|
||||
folders/13/name = "Items"
|
||||
folders/13/type = "ItemTemplate"
|
||||
folders/14/folder = "res://data/crafting/"
|
||||
folders/14/folder = "crafting"
|
||||
folders/14/header = ""
|
||||
folders/14/name = "Craft Recipes"
|
||||
folders/14/type = "CraftRecipe"
|
||||
folders/15/folder = "\"res://data/item_visuals/"
|
||||
folders/15/folder = "item_visuals"
|
||||
folders/15/header = ""
|
||||
folders/15/name = "Item Visuals"
|
||||
folders/15/type = "ItemVisual"
|
||||
folders/16/folder = "res://data/planets/"
|
||||
folders/16/folder = "planets"
|
||||
folders/16/header = "World"
|
||||
folders/16/name = "World"
|
||||
folders/16/type = "World"
|
||||
@ -85,19 +85,19 @@ folders/19/folder = "sub_zones"
|
||||
folders/19/header = ""
|
||||
folders/19/name = "SubZones"
|
||||
folders/19/type = "SubZone"
|
||||
folders/20/folder = "res://data/dungeons/"
|
||||
folders/20/folder = "dungeons"
|
||||
folders/20/header = ""
|
||||
folders/20/name = "Dungeons"
|
||||
folders/20/type = "DungeonData"
|
||||
folders/21/folder = "res://data/dungeon_rooms/"
|
||||
folders/21/folder = "dungeon_rooms"
|
||||
folders/21/header = ""
|
||||
folders/21/name = "Dungeon Rooms"
|
||||
folders/21/type = "DungeonRoomData"
|
||||
folders/22/folder = "res://data/basic_models/"
|
||||
folders/22/folder = "basic_models"
|
||||
folders/22/header = ""
|
||||
folders/22/name = "Basic Models"
|
||||
folders/22/type = "MeshDataResource"
|
||||
folders/23/folder = "res://data/prop_models/"
|
||||
folders/23/folder = "prop_models"
|
||||
folders/23/header = ""
|
||||
folders/23/name = "Prop Models"
|
||||
folders/23/type = "PackedScene"
|
||||
|
@ -18,6 +18,7 @@ var _module_entry_container : Node
|
||||
var _folder_entry_container : Node
|
||||
|
||||
var _modules : Array = Array()
|
||||
var _active_modules : Array = Array()
|
||||
var _settings : DataManagerAddonSettings = null
|
||||
|
||||
var _initialized : bool = false
|
||||
@ -45,16 +46,18 @@ func load_data():
|
||||
_resource_scene.connect("inspect_data", self, "inspect_data")
|
||||
|
||||
_module_entry_container = get_node(module_entry_container_path)
|
||||
_folder_entry_container = get_node(folder_entry_container_path)
|
||||
|
||||
generate_module_entry_list()
|
||||
|
||||
func generate_module_entry_list() -> void:
|
||||
for ch in _folder_entry_container.get_children():
|
||||
ch.queue_free()
|
||||
|
||||
load_modules()
|
||||
|
||||
for m in _modules:
|
||||
var label_str : String = m.resource_name
|
||||
|
||||
if label_str == "":
|
||||
label_str = m.resource_path
|
||||
label_str = label_str.replace("res://", "")
|
||||
label_str = label_str.replace("/game_module.tres", "")
|
||||
label_str = label_str.replace("game_module.tres", "")
|
||||
var label_str : String = get_module_label_text(m)
|
||||
|
||||
var b : Button = Button.new()
|
||||
b.toggle_mode = true
|
||||
@ -63,25 +66,35 @@ func load_data():
|
||||
b.connect("toggled", self, "on_module_entry_button_toggled", [ m ])
|
||||
_module_entry_container.add_child(b)
|
||||
|
||||
_folder_entry_container = get_node(folder_entry_container_path)
|
||||
|
||||
func generate_folder_entry_list() -> void:
|
||||
for ch in _folder_entry_container.get_children():
|
||||
ch.queue_free()
|
||||
|
||||
var dir : Directory = Directory.new()
|
||||
|
||||
for module in _active_modules:
|
||||
var label_str : String = "= " + get_module_label_text(module) + " ="
|
||||
var mlabel : Label = Label.new()
|
||||
mlabel.text = label_str
|
||||
mlabel.align = HALIGN_CENTER
|
||||
mlabel.valign = VALIGN_CENTER
|
||||
_folder_entry_container.add_child(mlabel)
|
||||
var module_dir_base : String = module.resource_path.get_base_dir()
|
||||
|
||||
var index = 0
|
||||
for f in _settings.folders:
|
||||
if !dir.dir_exists(module_dir_base + "/" + f.folder):
|
||||
continue
|
||||
|
||||
if f.header != "":
|
||||
var h : Label = Label.new()
|
||||
|
||||
_folder_entry_container.add_child(h)
|
||||
h.owner = _folder_entry_container
|
||||
|
||||
h.text = f.header
|
||||
|
||||
var fe : Node = folder_entry_button_scene.instance()
|
||||
|
||||
_folder_entry_container.add_child(fe)
|
||||
fe.owner = _folder_entry_container
|
||||
|
||||
fe.text = f.name
|
||||
fe.tab = index
|
||||
@ -93,7 +106,19 @@ func load_data():
|
||||
set_tab(0)
|
||||
|
||||
func on_module_entry_button_toggled(on : bool, module) -> void:
|
||||
pass
|
||||
if on:
|
||||
for m in _active_modules:
|
||||
if m == module:
|
||||
return
|
||||
|
||||
_active_modules.push_back(module)
|
||||
generate_folder_entry_list()
|
||||
else:
|
||||
for i in range(_active_modules.size()):
|
||||
if _active_modules[i] == module:
|
||||
_active_modules.remove(i)
|
||||
generate_folder_entry_list()
|
||||
return
|
||||
|
||||
func load_modules() -> void:
|
||||
_modules.clear()
|
||||
@ -152,3 +177,14 @@ func inspect_data(var data : Resource) -> void:
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
_plugin = plugin
|
||||
|
||||
func get_module_label_text(module) -> String:
|
||||
var label_str : String = module.resource_name
|
||||
|
||||
if label_str == "":
|
||||
label_str = module.resource_path
|
||||
label_str = label_str.replace("res://", "")
|
||||
label_str = label_str.replace("/game_module.tres", "")
|
||||
label_str = label_str.replace("game_module.tres", "")
|
||||
|
||||
return label_str
|
||||
|
Loading…
Reference in New Issue
Block a user