mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-22 07:30: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())
|
container.add_child(overlay_scene.instance())
|
||||||
|
|
||||||
update_tracker_id()
|
update_tracker_id()
|
||||||
update_offset()
|
call_deferred("update_offset")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func add_cursor():
|
func add_cursor():
|
||||||
|
@ -173,5 +174,4 @@ func reset_offset() -> void:
|
||||||
|
|
||||||
func _notification(what: int) -> void:
|
func _notification(what: int) -> void:
|
||||||
if what == NOTIFICATION_TRANSFORM_CHANGED:
|
if what == NOTIFICATION_TRANSFORM_CHANGED:
|
||||||
update_offset()
|
|
||||||
emit_signal("offset_changed")
|
emit_signal("offset_changed")
|
||||||
|
|
|
@ -44,10 +44,12 @@ func add_overlay(type, name):
|
||||||
|
|
||||||
|
|
||||||
func remove_overlay(name):
|
func remove_overlay(name):
|
||||||
|
print("Removing overlay '", name, "'")
|
||||||
var to_remove = get_node(name)
|
var to_remove = get_node(name)
|
||||||
if not to_remove:
|
if not to_remove:
|
||||||
print("Could not remove overlay '", name, "'")
|
print("Could not remove overlay '", name, "'")
|
||||||
return
|
return
|
||||||
to_remove.queue_free()
|
to_remove.queue_free()
|
||||||
emit_signal("removed_overlay", name)
|
|
||||||
Settings.s.overlays.erase(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:
|
func load_all() -> void:
|
||||||
if Settings.s.overlays.has(p.name):
|
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
|
# type is assigned at creation
|
||||||
|
|
||||||
if loaded.has("visible"):
|
if new.has("visible"):
|
||||||
p.overlay_visible = loaded.visible
|
p.overlay_visible = new.visible
|
||||||
if loaded.has("width"):
|
if new.has("width"):
|
||||||
p.width_meters = loaded.width
|
p.width_meters = new.width
|
||||||
if loaded.has("alpha"):
|
if new.has("alpha"):
|
||||||
p.alpha = loaded.alpha
|
p.alpha = new.alpha
|
||||||
if loaded.has("target"):
|
if new.has("target"):
|
||||||
p.target = loaded.target
|
p.target = new.target
|
||||||
if loaded.has("fallback"):
|
if new.has("fallback"):
|
||||||
p.fallback = loaded.fallback
|
p.fallback = new.fallback
|
||||||
|
|
||||||
if loaded.has("offsets"):# thorough in case some values are missing in file
|
if new.has("offsets"):# thorough in case some values are missing in file
|
||||||
for t_key in loaded.offsets:
|
for t_key in new.offsets:
|
||||||
var offset = loaded.offsets[t_key]
|
var offset = new.offsets[t_key]
|
||||||
p.set_offset(t_key, offset.pos, offset.rot)
|
p.set_offset(t_key, offset.pos, offset.rot)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue