Skip to content

Commit 74d7319

Browse files
committed
Merge commit 'ebfb1608adc39345a29a0c9314d861d7828f080d'
2 parents c3e70cd + ebfb160 commit 74d7319

File tree

11 files changed

+66
-35
lines changed

11 files changed

+66
-35
lines changed

addons/event_system_plugin/core/event_inspector.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ func parse_category(object: Object, category: String) -> void:
2828

2929

3030
func parse_property(object: Object, type: int, path: String, hint: int, hint_text: String, usage: int) -> bool:
31+
if object == null:
32+
return false
3133
var path_ignore = path+"_ignore"
3234
if (path_ignore in object):
3335
return true

addons/event_system_plugin/events/call.gd

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
tool
2-
extends Event
3-
class_name EventCall
4-
5-
export(String) var method:String = "" setget set_method
6-
export(Array) var args:Array = []
2+
extends "res://addons/event_system_plugin/events/call_from.gd"
73

84
func _init() -> void:
95
event_color = Color("EB5E55")
106
event_name = "Call"
117
event_category = "Node"
128
event_icon = load("res://addons/event_system_plugin/assets/icons/event_icons/call.png") as Texture
139
event_preview_string = "{method} ( {args} ) "
10+
node_path = NodePath()
1411

1512
args = []
16-
17-
18-
func _execute() -> void:
19-
event_node.callv(method, args)
20-
finish()
13+
push_warning("Call event is deprecated. Will be removed in future versions. Consider using EventCallFrom")
2114

2215

2316
func set_method(value:String) -> void:

addons/event_system_plugin/events/call_from.gd

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
tool
22
extends Event
3-
class_name EventCallFrom
3+
class_name EventCall
44

55
export(NodePath) var node_path:NodePath setget set_node_path
66
export(String) var method:String = "" setget set_method
77
export(Array) var args:Array = []
88

99
func _init() -> void:
10-
event_color = Color("5AA0EB")
11-
event_name = "Call From"
10+
event_color = Color("EB5E55")
11+
event_name = "Call"
1212
event_category = "Node"
1313
event_icon = load("res://addons/event_system_plugin/assets/icons/event_icons/call.png") as Texture
1414
event_preview_string = "{node_path} {method} ( {args} ) "
@@ -17,9 +17,13 @@ func _init() -> void:
1717

1818

1919
func _execute() -> void:
20-
var node = event_node.get_tree().current_scene.get_node_or_null(node_path)
21-
if node != null:
22-
node.callv(method, args)
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)
2327
finish()
2428

2529
func set_node_path(value:NodePath) -> void:
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
tool
2-
extends Event
2+
extends "res://addons/event_system_plugin/events/call_from.gd"
33
class_name EventHide
44

55
func _init() -> void:
66
event_color = Color("EB5E55")
77
event_name = "Hide"
88
event_category = "Node"
99
event_icon = load("res://addons/event_system_plugin/assets/icons/event_icons/hidden.png") as Texture
10+
method = "set"
11+
args = ["visible", false]
12+
event_preview_string = "{node_path}"
1013

1114

12-
func _execute() -> void:
13-
event_node.set("visible", false)
14-
finish()
15+
func _get(property: String):
16+
if property == "method_ignore":
17+
return true
18+
if property == "args_ignore":
19+
return true
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tool
2-
extends Event
2+
extends "res://addons/event_system_plugin/events/call_from.gd"
33
class_name EventSet
44

55
export(String) var variable_name:String = "" setget set_var_name
@@ -12,25 +12,28 @@ func _init() -> void:
1212
event_icon = load("res://addons/event_system_plugin/assets/icons/event_icons/set_variable.png") as Texture
1313
event_preview_string = "Set [ {variable_name} ] to be [ {variable_value} ]"
1414
continue_at_end = true
15-
16-
17-
func _execute() -> void:
18-
event_node.set(variable_name, variable_value)
19-
finish()
15+
method = "set"
16+
args = ["",""]
2017

2118

2219
func set_var_name(value:String) -> void:
2320
variable_name = value
21+
args[0] = variable_name
2422
emit_changed()
2523
property_list_changed_notify()
2624

2725

2826
func set_var_value(value:String) -> void:
2927
variable_value = value
28+
args[1] = variable_value
3029
emit_changed()
3130
property_list_changed_notify()
3231

3332

3433
func _get(property: String):
3534
if property == "continue_at_end_ignore":
3635
return true
36+
if property == "method_ignore":
37+
return true
38+
if property == "args_ignore":
39+
return true
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
tool
2-
extends Event
2+
extends "res://addons/event_system_plugin/events/call_from.gd"
33
class_name EventShow
44

55
func _init() -> void:
66
event_color = Color("EB5E55")
77
event_name = "Show"
88
event_category = "Node"
99
event_icon = load("res://addons/event_system_plugin/assets/icons/event_icons/visible.png") as Texture
10+
method = "set"
11+
args = ["visible", true]
12+
event_preview_string = "{node_path}"
1013

1114

12-
func _execute() -> void:
13-
event_node.set("visible", true)
14-
finish()
15+
func _get(property: String):
16+
if property == "method_ignore":
17+
return true
18+
if property == "args_ignore":
19+
return true

addons/event_system_plugin/events/wait.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ tool
22
extends Event
33
class_name EventWait
44

5-
export(float, 0, 60, 1) var wait_time = 0.0 setget set_wait_time
5+
export(float) var wait_time = 0.0 setget set_wait_time
66

77
func _init():
88
event_name = "Wait"

addons/event_system_plugin/nodes/editor/timeline_editor/event_timeline_editor.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ func _update_history() -> void:
108108

109109
_history_popup_menu.clear()
110110
for res in refs:
111+
if res == null:
112+
continue
111113
_path = "%s | [%s]"%[res.resource_name,res.resource_path]
112114
_history_popup_menu.add_item(_path)
113115

addons/event_system_plugin/nodes/event_manager/event_manager.gd

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ signal timeline_finished(timeline_resource)
1313
export(NodePath) var event_node_path:NodePath = "."
1414
export(bool) var start_on_ready:bool = false
1515

16-
export(Resource) var timeline
16+
var timeline
1717

1818
func _ready() -> void:
1919
if Engine.editor_hint:
@@ -90,3 +90,21 @@ func _notify_timeline_end() -> void:
9090

9191
func _hide_script_from_inspector():
9292
return true
93+
94+
95+
func _get_property_list() -> Array:
96+
var p := []
97+
p.append({"type":TYPE_OBJECT, "name":"timeline", "usage":PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_SCRIPT_VARIABLE, "hint":PROPERTY_HINT_RESOURCE_TYPE, "hint_string":"Resource"})
98+
return p
99+
100+
101+
func property_can_revert(property:String) -> bool:
102+
if property == "timeline":
103+
return true
104+
return false
105+
106+
107+
func property_get_revert(property:String):
108+
if property == "timeline":
109+
var tmln := Timeline.new()
110+
return tmln

addons/event_system_plugin/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
name="EventSystem"
44
description="An easy but powerful event system implementation for Godot Engine"
55
author="AnidemDex"
6-
version="1.2.1"
6+
version="1.3"
77
script="plugin_script.gd"

0 commit comments

Comments
 (0)