-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataConfig.gd
More file actions
53 lines (37 loc) · 1.4 KB
/
DataConfig.gd
File metadata and controls
53 lines (37 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# class_name DataConfig extends Object
## Class to store SubType keys
class SubType:
enum Type {
NULL, ## No Type
}
## Config for Data
static var config: Dictionary[String, Variant] = {
"custom_type_to_string_method": custom_type_to_string,
"get_object_name_signal_method": get_object_name_changed_signal,
"get_object_db": get_object_db,
}
## Converts a custom data type to a string, with a human readable name
@warning_ignore("unused_parameter")
static func custom_type_to_string(p_variant: Variant, p_orignal_type: Data.Type) -> Variant:
## return a String to override default convertion
# return "Value"
## else return false to use default convertion
return false
## Returns the signal emitted when the name of an object is changed
static func get_object_name_changed_signal(p_module: SettingsModule) -> Variant:
var object: Variant = p_module.get_getter().call()
## return Signal() if the object type is invalid, or has no name signal
if typeof(object) != TYPE_OBJECT or not is_instance_valid(object):
return Signal()
## check object type and return correct signal
#if object is Node:
#return (object as Node).renamed
## else return false to use default
return false
## Returns the ObjectDB that p_object's type belongs to
static func get_object_db(p_object: Object) -> ObjectDB:
if not is_instance_valid(p_object):
return null
match p_object.get_base_class():
_:
return null