mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-10 02:40:25 +01:00
upgrade settings manager, add default overlay in settings definition
This commit is contained in:
parent
919319cc83
commit
c51d4aa91d
2 changed files with 80 additions and 52 deletions
|
@ -5,57 +5,7 @@ signal settings_loaded # emitted when settings are loaded from file, needs to be
|
|||
|
||||
var DEBUG_SETTINGS = true
|
||||
var SETTINGS_PATH = "user://settings.json"
|
||||
const SETTINGS_DEF = {
|
||||
"grab_mode": {
|
||||
"name": "Grab mode",
|
||||
"description": "Grab and drag around any overlay",
|
||||
"flags": ["no_save"],
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"overlays": {
|
||||
"name": "Settings for all overlays",
|
||||
"type": "dict",
|
||||
"flags": ["resize"],
|
||||
"definition": {
|
||||
"type": "dict",
|
||||
"definition": {
|
||||
"width": {
|
||||
"name": "Width (m)",
|
||||
"type": "number",
|
||||
"default": 0.4
|
||||
},
|
||||
"target": {
|
||||
"name": "Tracking target",
|
||||
"type": "string",
|
||||
"default": "world"
|
||||
},
|
||||
"fallback": {
|
||||
"name": "Target fallback priority order",
|
||||
"type": "array",
|
||||
"default": ["world"]
|
||||
},
|
||||
"offsets": {
|
||||
"name": "Offsets",
|
||||
"flags": ["resize"],
|
||||
"type": "dict",
|
||||
"definition": {
|
||||
"pos": {
|
||||
"name": "Offset position",
|
||||
"type": "vector3",
|
||||
"default": Vector3()
|
||||
},
|
||||
"rot": {
|
||||
"name": "Offset rotation",
|
||||
"type": "quat",
|
||||
"default": Quat()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const SETTINGS_DEF = preload("res://addons/settings-manager/settings_definition.gd").DEF
|
||||
|
||||
var s: Dictionary = {}
|
||||
|
||||
|
@ -77,7 +27,7 @@ func _init_sub_setting(def):
|
|||
match def.type:
|
||||
"dict":
|
||||
if has_flag(def, "resize"):
|
||||
return {}
|
||||
return def.default
|
||||
var _s = {}
|
||||
for key in def.definition:
|
||||
_s[key] = _init_sub_setting(def.definition[key])
|
||||
|
|
78
ovr-utils/addons/settings-manager/settings_definition.gd
Normal file
78
ovr-utils/addons/settings-manager/settings_definition.gd
Normal file
|
@ -0,0 +1,78 @@
|
|||
extends Node
|
||||
|
||||
const DEF = {
|
||||
"grab_mode": {
|
||||
"name": "Grab mode",
|
||||
"description": "Grab and drag around any overlay",
|
||||
"flags": ["no_save"],
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"overlays": {
|
||||
"name": "Settings for all overlays",
|
||||
"type": "dict",
|
||||
"flags": ["resize"],
|
||||
"definition": {
|
||||
"type": "dict",
|
||||
"definition": {
|
||||
"width": {
|
||||
"name": "Width (m)",
|
||||
"type": "number",
|
||||
"default": 0.4
|
||||
},
|
||||
"target": {
|
||||
"name": "Tracking target",
|
||||
"type": "string",
|
||||
"default": "world"
|
||||
},
|
||||
"fallback": {
|
||||
"name": "Target fallback priority order",
|
||||
"type": "array",
|
||||
"default": ["world"]
|
||||
},
|
||||
"offsets": {
|
||||
"name": "Offsets",
|
||||
"flags": ["resize"],
|
||||
"type": "dict",
|
||||
"definition": {
|
||||
"type": "dict",
|
||||
"definition":{
|
||||
"pos": {
|
||||
"name": "Offset position",
|
||||
"type": "vector3",
|
||||
"default": Vector3()
|
||||
},
|
||||
"rot": {
|
||||
"name": "Offset rotation",
|
||||
"type": "quat",
|
||||
"default": Quat()
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"main": {
|
||||
"width": 0.4,
|
||||
"target": "left",
|
||||
"fallback": ["left", "right", "head"],
|
||||
"offsets": {
|
||||
"left": {
|
||||
"pos": Vector3(),
|
||||
"rot": Quat(),
|
||||
},
|
||||
"right": {
|
||||
"pos": Vector3(),
|
||||
"rot": Quat(),
|
||||
},
|
||||
"head": {
|
||||
"pos": Vector3(0,0,-0.5),
|
||||
"rot": Quat(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue