Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choice disabled view #1636

Merged
merged 54 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6445448
implement dynamic cache for event parts
ii4y-studios Oct 27, 2022
bedc434
template functions for converting the layout
ii4y-studios Oct 27, 2022
e4fd9f5
changing their function names, and copied the actual recursive flatte…
ii4y-studios Oct 31, 2022
bf9e541
starting with the flat structure in game loop before moving it to editor
ii4y-studios Dec 4, 2022
46817f3
ok id better commit the recursion functions before they vanish
ii4y-studios Dec 24, 2022
180dc91
files as well in the recursive, committing before i change it to merg…
ii4y-studios Dec 24, 2022
c287fa9
full recursive function for all the parts i think?
ii4y-studios Dec 24, 2022
5cc42fb
completed recursive algorithm to turn the flat structure back into fo…
ii4y-studios Dec 28, 2022
ac793a2
Revert "Merge branch 'dialogic-1' into dialogic-1x-speedups"
ii4y-studios Jan 11, 2023
86681c6
move the actual conversion steps out of DialogicClass and into Dialog…
ii4y-studios Jan 11, 2023
830f1cf
Revert "Revert "Merge branch 'dialogic-1' into dialogic-1x-speedups""
ii4y-studios Jan 11, 2023
684cd58
the boolean is redundant
ii4y-studios Jan 11, 2023
7434c06
Delete flat.json
ii4y-studios Jan 11, 2023
2c9a91b
Delete nested.json
ii4y-studios Jan 11, 2023
29d3f72
replace _get_timeline_file_from_name() and _get_variable_file_from_na…
ii4y-studios Jan 11, 2023
6d58701
adding flat structure to Editor, and begin by building the new folder…
ii4y-studios Jan 12, 2023
0584135
oh this line actually makes everything work on click
ii4y-studios Jan 12, 2023
33d3f76
current progress, editor needs an array for rebuilding sorting
ii4y-studios Jan 22, 2023
6183d1d
adding folder into array, so it inserts in the right spot in the tree
ii4y-studios Jan 25, 2023
82c10f7
actually add to both , so the Dictionary can verify existing folders
ii4y-studios Jan 25, 2023
5e0a4de
wip on remove folder, have to go now
ii4y-studios Jan 25, 2023
f5c5c2f
converting more folder functions, all WIP none tested
ii4y-studios Feb 9, 2023
0a06de4
just fixes for errors initializing editor, doesnt actually do anythin…
ii4y-studios Feb 21, 2023
e1f00cc
move the editor helper functions into DialogicUtil + more data
ii4y-studios Feb 26, 2023
60e2019
further structure readjustments for editor, now the functions can fin…
ii4y-studios Feb 26, 2023
c8d38af
update rename_folder(), slight name changes on move folder, but I don…
ii4y-studios Feb 26, 2023
29c1f3a
starting to create files in the new flat structure
ii4y-studios Feb 26, 2023
4031a42
converting the file functions. nothings tested yet
ii4y-studios Feb 26, 2023
8bf4779
too many save operations
ii4y-studios Feb 26, 2023
80feb39
rearrange tree to match previous order (folders first files after), m…
ii4y-studios Feb 27, 2023
f58acfe
fix on add folder path error, make renames on files work in editor tr…
ii4y-studios Feb 27, 2023
405663a
fix from @zaknafean for Discord bug #1
ii4y-studios Feb 27, 2023
00a573c
fix part 2 for Discord bug #1, add type of file or folder to list items
ii4y-studios Feb 27, 2023
343ba08
several Discord bug fixes, plus coloring the characters
ii4y-studios Feb 28, 2023
dd5b657
temporarily reverting timeline node cache
ii4y-studios Feb 28, 2023
c97b59b
add path and step to the roots so things can be created off of root
ii4y-studios Mar 2, 2023
3e8ce04
fix creating on roots, plus trying to get the new timelines not a mess
ii4y-studios Mar 2, 2023
79c8951
fixed folder rename fucnction
ii4y-studios Mar 2, 2023
e272321
cascade folder rename changes to children, also rebuild tree to updat…
ii4y-studios Mar 2, 2023
3ed981c
make search functional, make the state of root's collapse saved, plus…
ii4y-studios Mar 5, 2023
0b7e9c6
fix crash on loading with blank or incorrect timeline names
ii4y-studios Mar 6, 2023
4a37996
clear the selection on renames
ii4y-studios Mar 6, 2023
0a1f4ac
fix Dialogic.start() so it will check the right variable
ii4y-studios Mar 7, 2023
2f754f8
fix for crash when adding definitions and glossaries
ii4y-studios Mar 10, 2023
d2936a4
readjust timeline picker menu to use deconstructed flat file tree for…
ii4y-studios Mar 10, 2023
cd8c738
fix renaming in current session
ii4y-studios Mar 31, 2023
90f67c5
fix definition folder build wrong on load, rest of fix for rename
ii4y-studios Mar 31, 2023
1e2f670
cleaning up some prints
ii4y-studios Mar 31, 2023
7c1fa6c
correct move of folder to folder, also remove some prints
ii4y-studios Apr 1, 2023
a395fe0
move files, some loosening of restrictions for moving things
ii4y-studios Apr 1, 2023
379853e
expand the movement code to use drop zones, incomplete
ii4y-studios Apr 21, 2023
29a6c64
move folder to folder
ii4y-studios Apr 23, 2023
9441a92
Show disabled choices
zaknafean Jul 16, 2023
093bd59
comment clean up for theme scripts
zaknafean Jul 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ func _input(event):

func _on_color_changed(color):
var item = master_tree.get_selected()
item.set_icon_modulate(0, color)
if !item == null:
self.set_meta('current_color', color)
item.set_icon_modulate(0, color)



Expand Down
130 changes: 65 additions & 65 deletions addons/dialogic/Editor/DocumentationViewer/DocumentationViewer.gd
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
tool
extends Control

onready var master_tree = get_node('../MasterTreeContainer/MasterTree')
var current_page : String = ""

var previous_pages = []
var next_pages = []

signal open_link(link)

onready var nodes = {
'DocsViewer': $DocsViewer,
'Next': null,
'Previous':null,
}

func _ready():
set("custom_styles/panel", get_stylebox("Background", "EditorStyles"))

var _scale = get_constant("inspector_margin", "Editor")
_scale = _scale * 0.125
nodes['DocsViewer'].MarkdownParser.editor_scale = _scale
nodes['Next'] = find_parent("EditorView").get_node("ToolBar/DocumentationNavigation/Next")
nodes['Next'].connect('pressed',self, 'open_next_page')
nodes['Previous'] = find_parent("EditorView").get_node("ToolBar/DocumentationNavigation/Previous")
nodes['Previous'].connect('pressed',self, 'open_previous_page')



func load_page(page):
if current_page:
previous_pages.push_back(current_page)
nodes['Previous'].disabled = false
next_pages = []
current_page = page
nodes['DocsViewer'].load_page(current_page)
nodes['Next'].disabled = true


func open_previous_page():
if len(previous_pages):
next_pages.push_front(current_page)
current_page = previous_pages.pop_back()
nodes['DocsViewer'].load_page(current_page)
nodes['Previous'].disabled = len(previous_pages) == 0
nodes['Next'].disabled = false


func open_next_page():
if len(next_pages):
previous_pages.push_back(current_page)
current_page = next_pages.pop_front()
nodes['DocsViewer'].load_page(current_page)
nodes['Next'].disabled = len(next_pages) == 0
nodes['Previous'].disabled = false


func toggle_editing():
nodes['DocsViewer'].toggle_editing()


func _on_DocsViewer_open_non_html_link(link, section):
#print(link, " ", section)
master_tree.select_documentation_item(link)
tool
extends Control
onready var master_tree = get_node('../MasterTreeContainer/MasterTree')
var current_page : String = ""
var previous_pages = []
var next_pages = []
signal open_link(link)
onready var nodes = {
'DocsViewer': $DocsViewer,
'Next': null,
'Previous':null,
}
func _ready():
set("custom_styles/panel", get_stylebox("Background", "EditorStyles"))
var _scale = get_constant("inspector_margin", "Editor")
_scale = _scale * 0.125
nodes['DocsViewer'].MarkdownParser.editor_scale = _scale
nodes['Next'] = find_parent("EditorView").get_node("ToolBar/DocumentationNavigation/Next")
nodes['Next'].connect('pressed',self, 'open_next_page')
nodes['Previous'] = find_parent("EditorView").get_node("ToolBar/DocumentationNavigation/Previous")
nodes['Previous'].connect('pressed',self, 'open_previous_page')
func load_page(page):
if current_page:
previous_pages.push_back(current_page)
nodes['Previous'].disabled = false
next_pages = []
current_page = page
nodes['DocsViewer'].load_page(current_page)
nodes['Next'].disabled = true
func open_previous_page():
if len(previous_pages):
next_pages.push_front(current_page)
current_page = previous_pages.pop_back()
nodes['DocsViewer'].load_page(current_page)
nodes['Previous'].disabled = len(previous_pages) == 0
nodes['Next'].disabled = false
func open_next_page():
if len(next_pages):
previous_pages.push_back(current_page)
current_page = next_pages.pop_front()
nodes['DocsViewer'].load_page(current_page)
nodes['Next'].disabled = len(next_pages) == 0
nodes['Previous'].disabled = false
func toggle_editing():
nodes['DocsViewer'].toggle_editing()
func _on_DocsViewer_open_non_html_link(link, section):
#print(link, " ", section)
master_tree.select_documentation_item(link)
18 changes: 10 additions & 8 deletions addons/dialogic/Editor/EditorView.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ var file_picker_data: Dictionary = {'method': '', 'node': self}
var version_string: String

var dialogicTranslator = load("res://addons/dialogic/Localization/translation_service.gd").new()

var flat_structure = {}
# this is set when the plugins main-view is instanced in dialogic.gd
var editor_interface = null

#runtime cache of all .tscn's loaded by Dialogic, to speed it up
var editor_scene_cache = {}

func _ready():
# Updating the folder structure
flat_structure = DialogicUtil.flat_structure_to_editor_array(DialogicUtil.get_flat_folders_list())

# Adding file dialog to get used by Events
editor_file_dialog = EditorFileDialog.new()
add_child(editor_file_dialog)
Expand All @@ -20,9 +26,6 @@ func _ready():

$MainPanel/MasterTreeContainer/MasterTree.connect("editor_selected", self, 'on_master_tree_editor_selected')

# Updating the folder structure
DialogicUtil.update_resource_folder_structure()

# Sizes
# This part of the code is a bit terrible. But there is no better way
# of doing this in Godot at the moment. I'm sorry.
Expand Down Expand Up @@ -106,7 +109,7 @@ func _ready():
$ToolBar/Version.text = 'Dialogic v' + version_string

$MainPanel/MasterTreeContainer/FilterMasterTreeEdit.right_icon = get_icon("Search", "EditorIcons")

$MainPanel/MasterTreeContainer/MasterTree.build_full_tree()

func on_master_tree_editor_selected(editor: String):
$ToolBar/FoldTools.visible = editor == 'timeline'
Expand Down Expand Up @@ -135,9 +138,8 @@ func popup_remove_confirmation(what):


func _on_RemoveFolderConfirmation_confirmed():
var item_path = $MainPanel/MasterTreeContainer/MasterTree.get_item_path($MainPanel/MasterTreeContainer/MasterTree.get_selected())
DialogicUtil.remove_folder(item_path)
$MainPanel/MasterTreeContainer/MasterTree.build_full_tree()
var item_data = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)
$MainPanel/MasterTreeContainer/MasterTree.remove_selected()


func _on_RemoveConfirmation_confirmed(what: String = ''):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,52 @@ func _on_PickerMenu_about_to_show():

func build_PickerMenu():
picker_menu.get_popup().clear()
var folder_structure = DialogicUtil.get_timelines_folder_structure()

var timeline_structure = find_parent('EditorView').flat_structure['Timelines']
var folder_structure = build_PickerMenuFolderFlat(picker_menu.get_popup(), timeline_structure, "MenuButton")
var files_info = build_PickerMenuFiles(timeline_structure)
## building the root level
build_PickerMenuFolder(picker_menu.get_popup(), folder_structure, "MenuButton")
build_PickerMenuFolder(picker_menu.get_popup(), folder_structure, "MenuButton", files_info)


# is called recursively to build all levels of the folder structure
func build_PickerMenuFolder(menu:PopupMenu, folder_structure:Dictionary, current_folder_name:String):

func build_PickerMenuFolderFlat(menu:PopupMenu, folder_structure:Dictionary, current_folder_name:String):
var nested = {}
nested['folders'] = {}
nested['files'] = []
for item in folder_structure.keys():
DialogicResources.recursive_build(item.right(1), folder_structure[item], nested)

return nested

func build_PickerMenuFiles(timeline_structure):
var files_dict = {}

for i in timeline_structure.keys():
if !("/." in i):
#print(timeline_structure[i])
files_dict[timeline_structure[i]['file']] = {'color':timeline_structure[i]['color'], 'file':i, 'name': timeline_structure[i]['name']}
return files_dict

func build_PickerMenuFolder(menu:PopupMenu, folder_structure:Dictionary, current_folder_name:String, files_info:Dictionary):
var index = 0
for folder_name in folder_structure['folders'].keys():
var submenu = PopupMenu.new()
var submenu_name = build_PickerMenuFolder(submenu, folder_structure['folders'][folder_name], folder_name)
var submenu_name = build_PickerMenuFolder(submenu, folder_structure['folders'][folder_name], folder_name, files_info)
submenu.name = submenu_name
menu.add_submenu_item(folder_name, submenu_name)
menu.set_item_icon(index, get_icon("Folder", "EditorIcons"))
menu.add_child(submenu)
picker_menu.update_submenu_style(submenu)
index += 1

var files_info = DialogicUtil.get_timeline_dict()

for file in folder_structure['files']:
menu.add_item(files_info[file]['name'])
menu.set_item_icon(index, editor_reference.get_node("MainPanel/MasterTreeContainer/MasterTree").timeline_icon)
menu.set_item_metadata(index, {'file':file})
index += 1

if not menu.is_connected("index_pressed", self, "_on_PickerMenu_selected"):
menu.connect("index_pressed", self, '_on_PickerMenu_selected', [menu])

return current_folder_name
Loading