-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
117 changed files
with
2,317 additions
and
3,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
addons/dialog_plugin/Editor/Views/timeline_editor/event_buttons_container/PanelContainer.gd
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
...og_plugin/Editor/Views/timeline_editor/event_buttons_container/event_buttons_container.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
tool | ||
extends HBoxContainer | ||
|
||
signal event_pressed(event) | ||
|
||
const Category = preload("res://addons/dialog_plugin/Editor/Views/timeline_editor/event_buttons_container/events_category/events_category_scene.gd") | ||
|
||
var category_scene:PackedScene = load("res://addons/dialog_plugin/Editor/Views/timeline_editor/event_buttons_container/events_category/events_category_scene.tscn") as PackedScene | ||
|
||
func _ready() -> void: | ||
var edited_scene = get_tree().edited_scene_root | ||
if edited_scene: | ||
if edited_scene.is_a_parent_of(owner) or edited_scene == owner: | ||
return | ||
generate_event_buttons() | ||
|
||
func remove_all_childs(): | ||
for child in get_children(): | ||
child.queue_free() | ||
|
||
|
||
func generate_event_buttons(): | ||
remove_all_childs() | ||
# character_event, logic_event, miscelaneous_event, text_event | ||
var groups:Dictionary = _get_event_groups() | ||
var character_events:PoolStringArray = PoolStringArray(groups["character_event"]) | ||
var logic_events:PoolStringArray = PoolStringArray(groups["logic_event"]) | ||
var miscelaneous_events:PoolStringArray = PoolStringArray(groups["miscelaneous_event"]) | ||
var text_events:PoolStringArray = PoolStringArray(groups["text_event"]) | ||
|
||
add_category("Text Events", text_events) | ||
add_category("Logic Events", logic_events) | ||
add_category("Character Events", character_events) | ||
add_category("Misc Events", miscelaneous_events) | ||
|
||
|
||
func add_category(category_name:String, category_events:PoolStringArray) -> void: | ||
var category:Category = category_scene.instance() as Category | ||
var separator:Separator = VSeparator.new() | ||
category.name = category_name | ||
category.category_name = category_name | ||
category.category_events = category_events | ||
category.connect("event_button_pressed", self, "_on_Category_event_button_pressed") | ||
category.connect("ready", category, "call_deferred", ["generate_buttons_from_events"]) | ||
add_child(category) | ||
add_child(separator) | ||
|
||
|
||
func _get_event_groups() -> Dictionary: | ||
var settings:ConfigFile = ConfigFile.new() | ||
settings.load("project.godot") | ||
var keys:PoolStringArray = settings.get_section_keys("textalog") | ||
var groups:Dictionary = {} | ||
for event_property in keys: | ||
# events/{base}/{class} -> String (Script path) | ||
event_property = event_property as String | ||
var sections = event_property.split("/") | ||
var _base:String = sections[1] | ||
var _class:String = sections[2] | ||
if not _base in groups: | ||
groups[_base] = [] | ||
groups[_base].append("textalog/"+event_property) | ||
return groups | ||
|
||
|
||
func _on_Category_event_button_pressed(event:DialogEventResource) -> void: | ||
if not event: | ||
return | ||
emit_signal("event_pressed", event) |
43 changes: 43 additions & 0 deletions
43
...or/Views/timeline_editor/event_buttons_container/events_category/events_category_scene.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
tool | ||
extends VBoxContainer | ||
|
||
signal event_button_pressed(event) | ||
|
||
const EventButton = preload("res://addons/dialog_plugin/Nodes/editor_event_buttons/generic_event_button.gd") | ||
const DialogUtil = preload("res://addons/dialog_plugin/Core/DialogUtil.gd") | ||
|
||
export(NodePath) var NameLabel_path:NodePath | ||
export(NodePath) var EventContainer_path:NodePath | ||
|
||
onready var name_label:Label = get_node(NameLabel_path) as Label | ||
onready var event_buttons_container:Container = get_node(EventContainer_path) | ||
|
||
var category_name:String = "" | ||
var category_events:PoolStringArray = PoolStringArray([]) | ||
var event_button_scene:PackedScene = load("res://addons/dialog_plugin/Nodes/editor_event_buttons/generic_event_button.tscn") as PackedScene | ||
|
||
func _ready() -> void: | ||
name_label.text = category_name | ||
|
||
|
||
func generate_buttons_from_events() -> void: | ||
for event_property in category_events: | ||
var event_path = ProjectSettings.get_setting(event_property) | ||
var event_script:Script = load(event_path) as Script | ||
if not event_script: | ||
continue | ||
var event_button:EventButton = event_button_scene.instance() as EventButton | ||
event_button.event_resource = event_script | ||
event_button.connect("pressed", self, "_on_EventButton_pressed") | ||
DialogUtil.Logger.print_debug(self, "Adding event for "+event_path) | ||
add_event_button(event_button) | ||
|
||
|
||
func add_event_button(event_button:Button) -> void: | ||
event_buttons_container.add_child(event_button) | ||
|
||
|
||
func _on_EventButton_pressed(event:DialogEventResource=null) -> void: | ||
if not event: | ||
return | ||
emit_signal("event_button_pressed", event) |
53 changes: 21 additions & 32 deletions
53
.../Views/timeline_editor/event_buttons_container/events_category/events_category_scene.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,30 @@ | ||
[gd_scene format=2] | ||
[gd_scene load_steps=2 format=2] | ||
|
||
[node name="Category" type="PanelContainer"] | ||
margin_right = 1016.0 | ||
margin_bottom = 32.0 | ||
[ext_resource path="res://addons/dialog_plugin/Editor/Views/timeline_editor/event_buttons_container/events_category/events_category_scene.gd" type="Script" id=1] | ||
|
||
[node name="Category" type="VBoxContainer"] | ||
margin_right = 121.0 | ||
margin_bottom = 18.0 | ||
script = ExtResource( 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
NameLabel_path = NodePath("CategoryName") | ||
EventContainer_path = NodePath("Events") | ||
|
||
[node name="CategoryRow" type="VBoxContainer" parent="."] | ||
margin_left = 7.0 | ||
margin_top = 7.0 | ||
margin_right = 1009.0 | ||
margin_bottom = 25.0 | ||
|
||
[node name="Row1" type="MarginContainer" parent="CategoryRow"] | ||
margin_right = 1002.0 | ||
margin_bottom = 14.0 | ||
|
||
[node name="Items" type="HBoxContainer" parent="CategoryRow/Row1"] | ||
margin_right = 1002.0 | ||
margin_bottom = 14.0 | ||
|
||
[node name="Title" type="Label" parent="CategoryRow/Row1/Items"] | ||
margin_right = 89.0 | ||
[node name="CategoryName" type="Label" parent="."] | ||
margin_right = 121.0 | ||
margin_bottom = 14.0 | ||
text = "Category_Title" | ||
size_flags_horizontal = 7 | ||
size_flags_vertical = 6 | ||
align = 1 | ||
|
||
[node name="HSeparator" type="HSeparator" parent="CategoryRow/Row1/Items"] | ||
margin_left = 93.0 | ||
margin_right = 1002.0 | ||
margin_bottom = 14.0 | ||
size_flags_horizontal = 3 | ||
|
||
[node name="Row2" type="MarginContainer" parent="CategoryRow"] | ||
[node name="Events" type="HBoxContainer" parent="."] | ||
margin_top = 18.0 | ||
margin_right = 1002.0 | ||
margin_right = 121.0 | ||
margin_bottom = 18.0 | ||
|
||
[node name="Items" type="HBoxContainer" parent="CategoryRow/Row2"] | ||
margin_right = 1002.0 | ||
size_flags_vertical = 4 | ||
alignment = 1 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.