Skip to content

Commit

Permalink
Fix event button section ordering & errors when disabeling addon
Browse files Browse the repository at this point in the history
  • Loading branch information
Jowan-Spooner committed Apr 12, 2024
1 parent c0a9eba commit 8c8ade4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion addons/dialogic/Editor/Common/broken_reference_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func search_timelines(regexes:Array[Array]) -> Array[Dictionary]:

func _exit_tree() -> void:
# Shutting of
if finder_thread.is_alive():
if finder_thread and finder_thread.is_alive():
finder_thread.wait_to_finish()


Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Editor/Settings/settings_general.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func _refresh() -> void:
%SectionList.create_item()
var cached_events := DialogicResourceUtil.get_event_cache()
var sections := []
var section_order :Array = DialogicUtil.get_editor_setting('event_section_order', ['Main', 'Logic', 'Timeline', 'Audio', 'Godot','Other', 'Helper'])
var section_order :Array = DialogicUtil.get_editor_setting('event_section_order', ['Main', 'Logic', 'Flow', 'Audio', 'Visuals','Other', 'Helper'])
for ev in cached_events:
if !ev.event_category in sections:
sections.append(ev.event_category)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,18 @@ func load_event_buttons() -> void:
for button in child.get_children():
button.queue_free()

var scripts := DialogicResourceUtil.get_event_cache()

for child in %RightSidebar.get_child(0).get_children():
child.get_parent().remove_child(child)
child.queue_free()

# Event buttons
var button_scene := load("res://addons/dialogic/Editor/TimelineEditor/VisualEditor/AddEventButton.tscn")

var scripts := DialogicResourceUtil.get_event_cache()
var hidden_buttons :Array = DialogicUtil.get_editor_setting('hidden_event_buttons', [])
var sections := {}

for child in %RightSidebar.get_child(0).get_children():
child.queue_free()

for event_script in scripts:
var event_resource: Variant

Expand Down Expand Up @@ -236,8 +237,7 @@ func load_event_buttons() -> void:
section.add_child(button_container)

sections[event_resource.event_category] = button_container
%RightSidebar.get_child(0).add_child(section)

%RightSidebar.get_child(0).add_child(section, true)

sections[event_resource.event_category].add_child(button)
button.toggle_name(!sidebar_collapsed)
Expand All @@ -246,13 +246,14 @@ func load_event_buttons() -> void:
while event_resource.event_sorting_index < sections[event_resource.event_category].get_child(max(0, button.get_index()-1)).resource.event_sorting_index:
sections[event_resource.event_category].move_child(button, button.get_index()-1)

# Sort event sections
var sections_order :Array= DialogicUtil.get_editor_setting('event_section_order',
['Main', 'Flow', 'Logic', 'Audio', 'Godot','Other', 'Helper'])
['Main', 'Flow', 'Logic', 'Audio', 'Visual','Other', 'Helper'])

# Sort event sections
for section in sections_order:
if %RightSidebar.get_child(0).has_node(section):
%RightSidebar.get_child(0).move_child(%RightSidebar.get_child(0).get_node(section), sections_order.find(section))
sections_order.reverse()
for section_name in sections_order:
if %RightSidebar.get_child(0).has_node(section_name):
%RightSidebar.get_child(0).move_child(%RightSidebar.get_child(0).get_node(section_name), 0)

# Resize RightSidebar
var _scale := DialogicUtil.get_editor_scale()
Expand All @@ -278,7 +279,10 @@ func _on_content_item_clicked(label:String) -> void:


func update_content_list() -> void:
var labels :PackedStringArray = []
if not is_inside_tree():
return

var labels: PackedStringArray = []

for event in %Timeline.get_children():

Expand Down

0 comments on commit 8c8ade4

Please sign in to comment.