Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
AnidemDex committed Aug 7, 2021
2 parents e08f22b + bb4dd59 commit 98e51c5
Show file tree
Hide file tree
Showing 117 changed files with 2,317 additions and 3,723 deletions.
17 changes: 17 additions & 0 deletions addons/dialog_plugin/Core/DialogUtil.gd
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,20 @@ static func can_evaluate(input:String, global:Object=null, locals:Dictionary={})
# Util function to generate property dictionary
static func get_property_dict(property_name:String,property_type:int,property_hint:int=PROPERTY_HINT_NONE,property_hint_string:String="",property_usage:int=PROPERTY_USAGE_STORAGE) -> Dictionary:
return {"name":property_name, "type":property_type, "hint":property_hint, "hint_string":property_hint_string, "usage":property_usage}


static func get_event_property_dict(property_name:String,property_type:int,property_hint:int=PROPERTY_HINT_NONE,property_hint_string:String="") -> Dictionary:
var condition:int = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_SCRIPT_VARIABLE
var dict:Dictionary = get_property_dict(property_name, property_type, property_hint, property_hint_string, condition)
return dict


# Util function to get a dictionary of object property:value
static func get_property_values_from(object:Object) -> Dictionary:
if object == null:
return {}
var dict = {}
# Hope this doesn't freeze the engine per call
for property in object.get_property_list():
dict[property.name] = object.get(property.name)
return dict
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[ext_resource path="res://addons/dialog_plugin/Nodes/misc/resource_selector/texture_selector.gd" type="Script" id=3]
[ext_resource path="res://addons/dialog_plugin/Editor/Views/character_editor/portrait_container/portrait_container.tscn" type="PackedScene" id=8]


[sub_resource type="StyleBoxFlat" id=1]
draw_center = false
border_width_left = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[ext_resource path="res://addons/dialog_plugin/Nodes/misc/resource_selector/texture_selector.gd" type="Script" id=2]
[ext_resource path="res://addons/dialog_plugin/assets/Images/icons/event_icons/character/change_expression.png" type="Texture" id=3]


[sub_resource type="StyleBoxEmpty" id=4]

[sub_resource type="StyleBoxEmpty" id=2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ __meta__ = {

[node name="Head" type="PanelContainer" parent="VBoxContainer"]
margin_right = 1024.0
margin_bottom = 46.0
margin_bottom = 52.0
custom_styles/panel = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
Expand All @@ -42,11 +42,11 @@ __meta__ = {
margin_left = 2.0
margin_top = 2.0
margin_right = 1022.0
margin_bottom = 44.0
margin_bottom = 50.0

[node name="ControlPanel" type="HBoxContainer" parent="VBoxContainer/Head/VBoxContainer"]
margin_right = 1020.0
margin_bottom = 42.0
margin_bottom = 48.0
size_flags_horizontal = 7
size_flags_vertical = 6
__meta__ = {
Expand All @@ -56,43 +56,42 @@ __meta__ = {

[node name="PanelContainer2" type="PanelContainer" parent="VBoxContainer/Head/VBoxContainer/ControlPanel"]
margin_right = 1020.0
margin_bottom = 42.0
margin_bottom = 48.0
size_flags_horizontal = 3
size_flags_vertical = 0
custom_styles/panel = SubResource( 1 )

[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Head/VBoxContainer/ControlPanel/PanelContainer2"]
margin_right = 1020.0
margin_bottom = 42.0
margin_bottom = 48.0
size_flags_horizontal = 3

[node name="Label" type="Label" parent="VBoxContainer/Head/VBoxContainer/ControlPanel/PanelContainer2/HBoxContainer"]
margin_top = 14.0
margin_top = 17.0
margin_right = 104.0
margin_bottom = 28.0
margin_bottom = 31.0
text = "Locale Selection"

[node name="LocaleList" parent="VBoxContainer/Head/VBoxContainer/ControlPanel/PanelContainer2/HBoxContainer" instance=ExtResource( 6 )]
margin_left = 108.0
margin_top = 11.0
margin_top = 14.0
margin_right = 186.0
margin_bottom = 31.0
margin_bottom = 34.0
size_flags_vertical = 4
items = [ "English", null, false, 0, "en", "Spanish", null, false, 1, "es" ]

[node name="VSeparator" type="VSeparator" parent="VBoxContainer/Head/VBoxContainer/ControlPanel/PanelContainer2/HBoxContainer"]
margin_left = 190.0
margin_right = 194.0
margin_bottom = 42.0
margin_bottom = 48.0

[node name="EventButtonsContainer" parent="VBoxContainer/Head/VBoxContainer/ControlPanel/PanelContainer2/HBoxContainer" instance=ExtResource( 3 )]
anchor_right = 0.0
margin_left = 198.0
margin_right = 1020.0
size_flags_horizontal = 3

[node name="Body" type="VBoxContainer" parent="VBoxContainer"]
margin_top = 50.0
margin_top = 56.0
margin_right = 1024.0
margin_bottom = 560.0
size_flags_vertical = 3
Expand Down Expand Up @@ -126,15 +125,15 @@ text = "<TimelineName>"
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/Body"]
margin_top = 28.0
margin_right = 1024.0
margin_bottom = 510.0
margin_bottom = 504.0
rect_min_size = Vector2( 0, 78 )
size_flags_horizontal = 3
size_flags_vertical = 3
follow_focus = true

[node name="TimelineEventsContainer" type="VBoxContainer" parent="VBoxContainer/Body/ScrollContainer"]
margin_right = 1024.0
margin_bottom = 482.0
margin_bottom = 476.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 0
Expand Down

This file was deleted.

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)
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)
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
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ tool
extends Control

signal event_pressed(event_resource)
signal event_being_dragged


func _on_EventButton_pressed(event:DialogEventResource=null) -> void:
func _on_EventsContainer_event_pressed(event:DialogEventResource) -> void:
if not event:
return
emit_signal("event_pressed", event)


func _on_EventButton_being_dragged() -> void:
emit_signal("event_being_dragged")
Loading

0 comments on commit 98e51c5

Please sign in to comment.