Skip to content

Commit 92cc5cc

Browse files
authored
Merge pull request #81 from AnidemDex/update-event-system-to-1.4
Update event system to 1.4
2 parents 3c00079 + c0306ab commit 92cc5cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2467
-13636
lines changed

addons/event_system_plugin/assets/themes/event_node/event_description_piece.tres

Lines changed: 0 additions & 15 deletions
This file was deleted.

addons/event_system_plugin/assets/themes/event_node/event_node.tres

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,54 @@
1-
[gd_resource type="Theme" load_steps=2 format=2]
1+
[gd_resource type="Theme" load_steps=6 format=2]
22

3-
[sub_resource type="StyleBoxEmpty" id=1]
3+
[sub_resource type="StyleBoxEmpty" id=5]
4+
5+
[sub_resource type="StyleBoxFlat" id=2]
6+
7+
[sub_resource type="StyleBoxFlat" id=3]
8+
content_margin_left = 8.0
9+
content_margin_right = 4.0
10+
content_margin_top = 4.0
11+
content_margin_bottom = 4.0
12+
corner_radius_top_left = 32
13+
corner_radius_bottom_left = 32
14+
15+
[sub_resource type="StyleBoxFlat" id=4]
16+
content_margin_left = 12.0
17+
content_margin_right = 8.0
18+
content_margin_top = 4.0
19+
content_margin_bottom = 4.0
20+
corner_radius_top_right = 32
21+
corner_radius_bottom_right = 32
22+
shadow_offset = Vector2( 2, 0 )
23+
24+
[sub_resource type="StyleBoxFlat" id=1]
25+
content_margin_left = 8.0
26+
content_margin_right = 8.0
27+
content_margin_top = 4.0
428
content_margin_bottom = 4.0
29+
draw_center = false
30+
border_width_left = 2
31+
border_width_top = 2
32+
border_width_right = 2
33+
border_width_bottom = 2
34+
border_color = Color( 0.0980392, 0.113725, 0.156863, 1 )
35+
corner_radius_top_left = 16
36+
corner_radius_top_right = 16
37+
corner_radius_bottom_right = 16
38+
corner_radius_bottom_left = 16
539

640
[resource]
7-
resource_local_to_scene = true
41+
Button/styles/disabled = SubResource( 5 )
42+
Button/styles/focus = SubResource( 5 )
43+
Button/styles/hover = SubResource( 5 )
44+
Button/styles/normal = SubResource( 5 )
45+
Button/styles/pressed = SubResource( 5 )
46+
EventNode/colors/default = Color( 0.6, 0.6, 0.6, 1 )
47+
EventNode/colors/event = Color( 0.984314, 0.694118, 0.235294, 1 )
48+
EventNode/colors/hover = Color( 0.156863, 0.572549, 0.843137, 1 )
49+
EventNode/colors/outline = Color( 0.0980392, 0.113725, 0.156863, 1 )
50+
EventNode/styles/bg = SubResource( 2 )
51+
EventNode/styles/bg_left = SubResource( 3 )
52+
EventNode/styles/bg_right = SubResource( 4 )
53+
EventNode/styles/outline = SubResource( 1 )
854
HBoxContainer/constants/separation = 0
9-
Label/colors/font_color = Color( 0, 0, 0, 1 )
10-
PanelContainer/colors/default = Color( 0.6, 0.6, 0.6, 1 )
11-
PanelContainer/colors/event = Color( 0.984314, 0.694118, 0.235294, 1 )
12-
PanelContainer/colors/hover = Color( 0.156863, 0.572549, 0.843137, 1 )
13-
PanelContainer/colors/outline = Color( 0.0980392, 0.113725, 0.156863, 1 )
14-
PanelContainer/styles/panel = SubResource( 1 )

addons/event_system_plugin/assets/themes/event_node/event_title_piece.tres

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[gd_resource type="Theme" load_steps=5 format=2]
2+
3+
[sub_resource type="StyleBoxFlat" id=2]
4+
5+
[sub_resource type="StyleBoxFlat" id=3]
6+
content_margin_left = 8.0
7+
content_margin_right = 4.0
8+
content_margin_top = 4.0
9+
content_margin_bottom = 4.0
10+
corner_radius_top_left = 32
11+
corner_radius_bottom_left = 32
12+
13+
[sub_resource type="StyleBoxFlat" id=4]
14+
content_margin_left = 12.0
15+
content_margin_right = 8.0
16+
content_margin_top = 4.0
17+
content_margin_bottom = 4.0
18+
corner_radius_top_right = 32
19+
corner_radius_bottom_right = 32
20+
shadow_offset = Vector2( 2, 0 )
21+
22+
[sub_resource type="StyleBoxFlat" id=1]
23+
content_margin_left = 8.0
24+
content_margin_right = 8.0
25+
content_margin_top = 4.0
26+
content_margin_bottom = 4.0
27+
draw_center = false
28+
border_width_left = 2
29+
border_width_top = 2
30+
border_width_right = 2
31+
border_width_bottom = 2
32+
border_color = Color( 0.0980392, 0.113725, 0.156863, 1 )
33+
corner_radius_top_left = 16
34+
corner_radius_top_right = 16
35+
corner_radius_bottom_right = 16
36+
corner_radius_bottom_left = 16
37+
38+
[resource]
39+
EventNode/colors/default = Color( 0.6, 0.6, 0.6, 1 )
40+
EventNode/colors/event = Color( 0.984314, 0.694118, 0.235294, 1 )
41+
EventNode/colors/hover = Color( 0.156863, 0.572549, 0.843137, 1 )
42+
EventNode/colors/outline = Color( 0.0980392, 0.113725, 0.156863, 1 )
43+
EventNode/styles/bg = SubResource( 2 )
44+
EventNode/styles/bg_left = SubResource( 3 )
45+
EventNode/styles/bg_right = SubResource( 4 )
46+
EventNode/styles/outline = SubResource( 1 )
47+
PanelContainer/constants/identation = 32
48+
VBoxContainer/constants/separation = 0

addons/event_system_plugin/assets/themes/timeline_editor/timeline_editor_l.tres

Lines changed: 0 additions & 12012 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
extends Reference
2+
3+
static func get_shortcut(property: String) -> ShortCut:
4+
var shortcut:ShortCut = ShortCut.new()
5+
match property:
6+
"duplicate":
7+
shortcut = null
8+
if Engine.editor_hint:
9+
var plugin = ClassDB.instance("EditorPlugin")
10+
var settings:EditorSettings = plugin.get_editor_interface().get_editor_settings()
11+
# shortcut = settings.get("scene_tree/duplicate") as ShortCut
12+
shortcut = null # We can't get shortcuts for now
13+
plugin.free()
14+
15+
if shortcut == null:
16+
shortcut = ShortCut.new()
17+
var input := InputEventKey.new()
18+
input.scancode = KEY_D
19+
input.control = true
20+
input.pressed = true
21+
shortcut.shortcut = input
22+
23+
"remove","delete":
24+
shortcut = null
25+
26+
if Engine.editor_hint:
27+
var plugin = ClassDB.instance("EditorPlugin")
28+
var settings:EditorSettings = plugin.get_editor_interface().get_editor_settings()
29+
# shortcut = settings.get("scene_tree/delete") as ShortCut
30+
shortcut = null # we can't get shortcuts for now
31+
plugin.free()
32+
33+
if shortcut == null:
34+
shortcut = ShortCut.new()
35+
var input := InputEventKey.new()
36+
input.scancode = KEY_DELETE
37+
input.pressed = true
38+
shortcut.shortcut = input
39+
40+
41+
return shortcut

addons/event_system_plugin/events/call.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ func _init() -> void:
77
event_category = "Node"
88
event_icon = load("res://addons/event_system_plugin/assets/icons/event_icons/call.png") as Texture
99
event_preview_string = "{method} ( {args} ) "
10-
node_path = NodePath()
1110

1211
args = []
1312
push_warning("Call event is deprecated. Will be removed in future versions. Consider using EventCallFrom")

addons/event_system_plugin/events/call_from.gd

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ tool
22
extends Event
33
class_name EventCall
44

5-
export(NodePath) var node_path:NodePath setget set_node_path
65
export(String) var method:String = "" setget set_method
76
export(Array) var args:Array = []
87

@@ -17,20 +16,14 @@ func _init() -> void:
1716

1817

1918
func _execute() -> void:
20-
if node_path == NodePath():
21-
if event_node.has_method(method):
22-
event_node.callv(method, args)
23-
else:
24-
var node = event_node.get_tree().current_scene.get_node_or_null(node_path)
25-
if node != null:
26-
node.callv(method, args)
19+
var node:Node = get_event_node()
20+
21+
if node.has_method(method):
22+
node.callv(method, args)
23+
2724
finish()
2825

29-
func set_node_path(value:NodePath) -> void:
30-
node_path = value
31-
emit_changed()
32-
property_list_changed_notify()
33-
26+
3427
func set_method(value:String) -> void:
3528
method = value
3629
emit_changed()
@@ -41,3 +34,12 @@ func set_args(value:Array) -> void:
4134
args = value.duplicate()
4235
emit_changed()
4336
property_list_changed_notify()
37+
38+
39+
func _set(property: String, value) -> bool:
40+
if property == "node_path":
41+
# This exists because node_path property was removed
42+
event_node_path = value
43+
emit_changed()
44+
return true
45+
return false

addons/event_system_plugin/events/change_timeline.gd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
tool
22
extends Event
3-
class_name EventChangeTimeline
3+
#class_name EventChangeTimeline
44

55
export(String, FILE, "*.tres, *.res") var timeline_path:String = "" setget set_timeline_path
66
export(int) var start_from_event = 0 setget set_start_event_idx
@@ -14,9 +14,11 @@ func _init() -> void:
1414
event_preview_string = "Jump to: [ {timeline_path} ] and start in event #[ {start_from_event} ]"
1515
event_category = "Logic"
1616
continue_at_end = true
17+
push_warning("Event [%s] is deprecated and will be removed in future versions. Use EventGoto instead."%event_name)
1718

1819

1920
func _execute() -> void:
21+
push_warning("Event [%s] is deprecated and will be removed in future versions. Use EventGoto instead."%event_name)
2022

2123
if not timeline and timeline_path:
2224
timeline = load(timeline_path) as Timeline
@@ -31,7 +33,7 @@ func _execute() -> void:
3133
var _discard = _event_queue.pop_front()
3234

3335
timeline._event_queue = _event_queue
34-
event_manager.start_timeline(timeline)
36+
get_event_manager_node().start_timeline(timeline)
3537

3638

3739
func set_timeline_path(value:String) -> void:
Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
tool
22
extends Event
3-
class_name EventCondition
43

54
const _Utils = preload("res://addons/event_system_plugin/core/utils.gd")
65

76
export(String) var condition:String = "" setget set_condition
8-
export(Resource) var events_if = Timeline.new()
9-
export(Resource) var events_else = Timeline.new()
7+
export(Resource) var events_if = Timeline.new() setget set_if_events
8+
export(Resource) var events_else = Timeline.new() setget set_else_events
109

1110

1211
func _init() -> void:
@@ -21,41 +20,13 @@ func _init() -> void:
2120
events_if = _get_empty_timeline("Timeline IF")
2221

2322
events_else = _get_empty_timeline("Timeline ELSE")
23+
push_warning("Event condition is deprecated and was replaced by a new one. Will be removed in new versions.")
2424

2525

26-
func _execute() -> void:
27-
# TODO: replace with node variables
28-
var variables:Dictionary = {}
29-
30-
var evaluated_condition = _Utils.evaluate(condition, event_node, variables)
31-
32-
var timeline:Timeline
33-
var current_timeline:Timeline = event_manager.timeline
34-
35-
if not current_timeline:
36-
finish()
37-
return
38-
39-
if evaluated_condition and (str(evaluated_condition) != condition):
40-
timeline = events_if
41-
else:
42-
timeline = events_else
43-
44-
if timeline:
45-
var _events:Array = timeline.get_events()
46-
for _event in _events:
47-
current_timeline._event_queue.push_front(_event)
48-
49-
50-
finish()
51-
5226

5327
func _get(property: String):
5428
if property == "continue_at_end_ignore":
5529
return true
56-
57-
if property == "custom_event_node":
58-
return load("res://addons/event_system_plugin/nodes/editor/event_node/event_condition/event_node.tscn").instance()
5930

6031

6132
func set_condition(value:String) -> void:
@@ -65,13 +36,26 @@ func set_condition(value:String) -> void:
6536

6637

6738
func set_if_events(value:Timeline) -> void:
39+
if events_if.is_connected("changed", self, "timeline_changed"):
40+
events_if.disconnect("changed", self, "timeline_changed")
6841
events_if = value
42+
if not events_if.is_connected("changed", self, "timeline_changed"):
43+
events_if.connect("changed", self, "timeline_changed")
6944
emit_changed()
7045
property_list_changed_notify()
7146

7247

7348
func set_else_events(value:Timeline) -> void:
49+
if events_else.is_connected("changed", self, "timeline_changed"):
50+
events_else.disconnect("changed", self, "timeline_changed")
7451
events_else = value
52+
if not events_else.is_connected("changed", self, "timeline_changed"):
53+
events_else.connect("changed", self, "timeline_changed")
54+
emit_changed()
55+
property_list_changed_notify()
56+
57+
58+
func timeline_changed() -> void:
7559
emit_changed()
7660
property_list_changed_notify()
7761

@@ -95,4 +79,4 @@ func _get_empty_timeline(with_name:String) -> Timeline:
9579
var tmln := Timeline.new()
9680
if with_name != "":
9781
tmln.resource_name = with_name
98-
return tmln
82+
return tmln

0 commit comments

Comments
 (0)