mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-10 02:40:25 +01:00
fix overlays not being deleted because of spammed signal
This commit is contained in:
parent
a0e6e932e4
commit
2ff72e5023
3 changed files with 19 additions and 17 deletions
|
@ -57,7 +57,8 @@ func _ready() -> void:
|
|||
container.add_child(overlay_scene.instance())
|
||||
|
||||
update_tracker_id()
|
||||
update_offset()
|
||||
call_deferred("update_offset")
|
||||
|
||||
|
||||
|
||||
func add_cursor():
|
||||
|
@ -173,5 +174,4 @@ func reset_offset() -> void:
|
|||
|
||||
func _notification(what: int) -> void:
|
||||
if what == NOTIFICATION_TRANSFORM_CHANGED:
|
||||
update_offset()
|
||||
emit_signal("offset_changed")
|
||||
|
|
|
@ -44,10 +44,12 @@ func add_overlay(type, name):
|
|||
|
||||
|
||||
func remove_overlay(name):
|
||||
print("Removing overlay '", name, "'")
|
||||
var to_remove = get_node(name)
|
||||
if not to_remove:
|
||||
print("Could not remove overlay '", name, "'")
|
||||
return
|
||||
to_remove.queue_free()
|
||||
emit_signal("removed_overlay", name)
|
||||
Settings.s.overlays.erase(name)
|
||||
emit_signal("removed_overlay", name)
|
||||
|
||||
|
|
|
@ -35,23 +35,23 @@ func _save_prop(prop_name: String, prop_value) -> void:
|
|||
|
||||
func load_all() -> void:
|
||||
if Settings.s.overlays.has(p.name):
|
||||
var loaded = Settings.s.overlays[p.name]
|
||||
var new = Settings.s.overlays[p.name]
|
||||
# type is assigned at creation
|
||||
|
||||
if loaded.has("visible"):
|
||||
p.overlay_visible = loaded.visible
|
||||
if loaded.has("width"):
|
||||
p.width_meters = loaded.width
|
||||
if loaded.has("alpha"):
|
||||
p.alpha = loaded.alpha
|
||||
if loaded.has("target"):
|
||||
p.target = loaded.target
|
||||
if loaded.has("fallback"):
|
||||
p.fallback = loaded.fallback
|
||||
if new.has("visible"):
|
||||
p.overlay_visible = new.visible
|
||||
if new.has("width"):
|
||||
p.width_meters = new.width
|
||||
if new.has("alpha"):
|
||||
p.alpha = new.alpha
|
||||
if new.has("target"):
|
||||
p.target = new.target
|
||||
if new.has("fallback"):
|
||||
p.fallback = new.fallback
|
||||
|
||||
if loaded.has("offsets"):# thorough in case some values are missing in file
|
||||
for t_key in loaded.offsets:
|
||||
var offset = loaded.offsets[t_key]
|
||||
if new.has("offsets"):# thorough in case some values are missing in file
|
||||
for t_key in new.offsets:
|
||||
var offset = new.offsets[t_key]
|
||||
p.set_offset(t_key, offset.pos, offset.rot)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue