mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-10 02:40:25 +01:00
move settings definition file to root, store savepath there too
This commit is contained in:
parent
386465e8d9
commit
b15c00f5f0
3 changed files with 5 additions and 4 deletions
|
@ -5,8 +5,8 @@ signal settings_loaded # emitted when settings are loaded from file, needs to be
|
||||||
signal settings_changed # has to be manually called by the modifying script
|
signal settings_changed # has to be manually called by the modifying script
|
||||||
|
|
||||||
var DEBUG_SETTINGS = false
|
var DEBUG_SETTINGS = false
|
||||||
var SETTINGS_PATH = "user://overlay_data.json"
|
var SETTINGS_PATH = preload("res://settings_definition.gd").PATH
|
||||||
const SETTINGS_DEF = preload("res://addons/settings-manager/settings_definition.gd").DEF
|
const SETTINGS_DEF = preload("res://settings_definition.gd").DEF
|
||||||
|
|
||||||
var has_loaded := false
|
var has_loaded := false
|
||||||
var s := {}
|
var s := {}
|
||||||
|
|
|
@ -39,10 +39,10 @@ func save_all() -> void:
|
||||||
func _save_prop(prop_name: String, prop_value) -> void:
|
func _save_prop(prop_name: String, prop_value) -> void:
|
||||||
Settings.s.overlays[p.name][prop_name] = prop_value
|
Settings.s.overlays[p.name][prop_name] = prop_value
|
||||||
|
|
||||||
|
|
||||||
func load_all() -> void:
|
func load_all() -> void:
|
||||||
if Settings.s.overlays.has(p.name):
|
if Settings.s.overlays.has(p.name):
|
||||||
var new = Settings.s.overlays[p.name]
|
var new = Settings.s.overlays[p.name]
|
||||||
# type is assigned at creation
|
|
||||||
|
|
||||||
if new.has("visible"):
|
if new.has("visible"):
|
||||||
p.overlay_visible = new.visible
|
p.overlay_visible = new.visible
|
||||||
|
@ -61,7 +61,7 @@ func load_all() -> void:
|
||||||
p.set_offset(t_key, offset.pos, offset.rot)
|
p.set_offset(t_key, offset.pos, offset.rot)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("FAILED")
|
print("FAILED to load settings")
|
||||||
save_all()
|
save_all()
|
||||||
loaded = true
|
loaded = true
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
const PATH = "user://overlay_data.json"
|
||||||
const DEF = {
|
const DEF = {
|
||||||
"grab_mode": {
|
"grab_mode": {
|
||||||
"name": "Grab mode",
|
"name": "Grab mode",
|
Loading…
Reference in a new issue