Skip to content

Commit 3c00079

Browse files
authored
Merge pull request #80 from AnidemDex/revert-79-update-event-system-to-1.4
Revert "Update event system to 1.4"
2 parents cb185ea + 416b8d3 commit 3c00079

Some content is hidden

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

44 files changed

+13574
-2466
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[gd_resource type="StyleBoxFlat" format=2]
2+
3+
[resource]
4+
resource_local_to_scene = true
5+
content_margin_left = 12.0
6+
content_margin_right = 8.0
7+
content_margin_top = 4.0
8+
content_margin_bottom = 4.0
9+
border_width_top = 2
10+
border_width_right = 2
11+
border_width_bottom = 2
12+
border_color = Color( 0.984314, 0.694118, 0.235294, 1 )
13+
corner_radius_top_right = 32
14+
corner_radius_bottom_right = 32
15+
shadow_offset = Vector2( 2, 0 )
Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,14 @@
1-
[gd_resource type="Theme" load_steps=6 format=2]
1+
[gd_resource type="Theme" load_steps=2 format=2]
22

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
3+
[sub_resource type="StyleBoxEmpty" id=1]
284
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
395

406
[resource]
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 )
7+
resource_local_to_scene = true
548
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 )
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[gd_resource type="StyleBoxFlat" format=2]
2+
3+
[resource]
4+
resource_local_to_scene = true
5+
content_margin_left = 8.0
6+
content_margin_right = 4.0
7+
content_margin_top = 4.0
8+
content_margin_bottom = 4.0
9+
bg_color = Color( 0.984314, 0.694118, 0.235294, 1 )
10+
border_width_left = 2
11+
border_width_top = 2
12+
border_width_bottom = 2
13+
border_color = Color( 0.0980392, 0.113725, 0.156863, 1 )
14+
corner_radius_top_left = 32
15+
corner_radius_bottom_left = 32

addons/event_system_plugin/assets/themes/timeline_editor.tres

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

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

Lines changed: 12012 additions & 0 deletions
Large diffs are not rendered by default.

addons/event_system_plugin/core/shortcuts.gd

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

addons/event_system_plugin/events/call_from.gd

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

5+
export(NodePath) var node_path:NodePath setget set_node_path
56
export(String) var method:String = "" setget set_method
67
export(Array) var args:Array = []
78

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

1718

1819
func _execute() -> void:
19-
var node:Node = get_event_node()
20-
21-
if node.has_method(method):
22-
node.callv(method, args)
23-
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)
2427
finish()
2528

26-
29+
func set_node_path(value:NodePath) -> void:
30+
node_path = value
31+
emit_changed()
32+
property_list_changed_notify()
33+
2734
func set_method(value:String) -> void:
2835
method = value
2936
emit_changed()
@@ -34,12 +41,3 @@ func set_args(value:Array) -> void:
3441
args = value.duplicate()
3542
emit_changed()
3643
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: 2 additions & 4 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,11 +14,9 @@ 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)
1817

1918

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

2321
if not timeline and timeline_path:
2422
timeline = load(timeline_path) as Timeline
@@ -33,7 +31,7 @@ func _execute() -> void:
3331
var _discard = _event_queue.pop_front()
3432

3533
timeline._event_queue = _event_queue
36-
get_event_manager_node().start_timeline(timeline)
34+
event_manager.start_timeline(timeline)
3735

3836

3937
func set_timeline_path(value:String) -> void:

addons/event_system_plugin/events/condition.gd

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
tool
22
extends Event
3+
class_name EventCondition
34

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

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

1011

1112
func _init() -> void:
@@ -20,13 +21,41 @@ func _init() -> void:
2021
events_if = _get_empty_timeline("Timeline IF")
2122

2223
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+
2652

2753
func _get(property: String):
2854
if property == "continue_at_end_ignore":
2955
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()
3059

3160

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

3766

3867
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")
4168
events_if = value
42-
if not events_if.is_connected("changed", self, "timeline_changed"):
43-
events_if.connect("changed", self, "timeline_changed")
4469
emit_changed()
4570
property_list_changed_notify()
4671

4772

4873
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")
5174
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:
5975
emit_changed()
6076
property_list_changed_notify()
6177

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

addons/event_system_plugin/events/emit_signal.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func _init() -> void:
1313
event_category = "Node"
1414

1515
func _execute() -> void:
16-
get_event_manager_node().emit_signal("custom_signal", data)
16+
event_manager.emit_signal("custom_signal", data)
1717
finish()
1818

1919

0 commit comments

Comments
 (0)