mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-10 02:40:25 +01:00
cleanup
This commit is contained in:
parent
01c11ffd32
commit
727e559396
5 changed files with 16 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
extends Spatial
|
extends Spatial
|
||||||
|
|
||||||
signal type_changed
|
signal path_changed
|
||||||
signal overlay_visible_changed
|
signal overlay_visible_changed
|
||||||
signal width_changed
|
signal width_changed
|
||||||
signal alpha_changed
|
signal alpha_changed
|
||||||
|
@ -11,8 +11,7 @@ signal offset_changed
|
||||||
const TARGETS = ["head", "left", "right", "world"]
|
const TARGETS = ["head", "left", "right", "world"]
|
||||||
export (String, "head", "left", "right", "world") var target = "left" setget set_target
|
export (String, "head", "left", "right", "world") var target = "left" setget set_target
|
||||||
|
|
||||||
export var overlay_scene: PackedScene# = \
|
export var overlay_scene: PackedScene
|
||||||
# preload("res://addons/openvr_overlay/MissingOverlay.tscn") setget set_overlay_scene
|
|
||||||
export var width_meters := 0.4 setget set_width_in_meters
|
export var width_meters := 0.4 setget set_width_in_meters
|
||||||
export var alpha := 1.0 setget set_alpha
|
export var alpha := 1.0 setget set_alpha
|
||||||
export var add_grabbing := true # add grabbing module
|
export var add_grabbing := true # add grabbing module
|
||||||
|
@ -31,8 +30,8 @@ var current_target: String = "world" setget _set_current_target
|
||||||
var fallback = ["left", "right", "head"] # TODO setget that updates tracking (not important)
|
var fallback = ["left", "right", "head"] # TODO setget that updates tracking (not important)
|
||||||
var interaction_handler: Node
|
var interaction_handler: Node
|
||||||
var overlay_visible := true setget set_overlay_visible
|
var overlay_visible := true setget set_overlay_visible
|
||||||
#var type := "main"
|
|
||||||
var path := "res://special_overlays/MainOverlay.tscn" setget set_path
|
var path := "res://special_overlays/MainOverlay.tscn" setget set_path
|
||||||
|
var path_invalid := false
|
||||||
|
|
||||||
onready var container = $OverlayViewport/Container
|
onready var container = $OverlayViewport/Container
|
||||||
|
|
||||||
|
@ -151,12 +150,17 @@ func set_width_in_meters(width: float) -> void:
|
||||||
|
|
||||||
func set_path(new: String) -> void:
|
func set_path(new: String) -> void:
|
||||||
path = new
|
path = new
|
||||||
|
path_invalid = false
|
||||||
|
|
||||||
overlay_scene = load(path)
|
overlay_scene = load(path)
|
||||||
if not container:
|
if not overlay_scene:
|
||||||
return
|
path_invalid = true
|
||||||
|
overlay_scene = load("res://special_overlays/UnknownType.tscn")
|
||||||
|
|
||||||
if container.get_child_count() > 0:
|
if container.get_child_count() > 0:
|
||||||
container.get_child(0).queue_free()
|
container.get_child(0).queue_free()
|
||||||
container.add_child(overlay_scene.instance())
|
container.add_child(overlay_scene.instance())
|
||||||
|
emit_signal("path_changed")
|
||||||
|
|
||||||
|
|
||||||
func set_alpha(val: float):
|
func set_alpha(val: float):
|
||||||
|
|
|
@ -13,7 +13,6 @@ func _on_Open_pressed() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_FileDialog_file_selected(path: String) -> void:
|
func _on_FileDialog_file_selected(path: String) -> void:
|
||||||
# var img = load(path)
|
|
||||||
var tex = ImageTexture.new()
|
var tex = ImageTexture.new()
|
||||||
tex.load(path)
|
tex.load(path)
|
||||||
$Image.texture = tex
|
$Image.texture = tex
|
||||||
|
|
|
@ -8,7 +8,7 @@ var _needs_sync := true
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
p = get_parent()
|
p = get_parent()
|
||||||
call_deferred("load_all")
|
call_deferred("load_all")
|
||||||
p.connect("type_changed", self, "_prop_changed")
|
p.connect("path_changed", self, "_prop_changed")
|
||||||
p.connect("overlay_visible_changed", self, "_prop_changed")
|
p.connect("overlay_visible_changed", self, "_prop_changed")
|
||||||
p.connect("width_changed", self, "_prop_changed")
|
p.connect("width_changed", self, "_prop_changed")
|
||||||
p.connect("alpha_changed", self, "_prop_changed")
|
p.connect("alpha_changed", self, "_prop_changed")
|
||||||
|
|
|
@ -28,7 +28,7 @@ func get_overlay_paths(root := "res://overlays/"):
|
||||||
var file_name = dir.get_next()
|
var file_name = dir.get_next()
|
||||||
while file_name != "":
|
while file_name != "":
|
||||||
if dir.current_is_dir():
|
if dir.current_is_dir():
|
||||||
# TODO make recursive, must include folder as prefix for type
|
# TODO make recursive
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
found.append(root + file_name)
|
found.append(root + file_name)
|
||||||
|
|
|
@ -15,9 +15,11 @@ func _ready() -> void:
|
||||||
name = overlay_name
|
name = overlay_name
|
||||||
$MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(overlay.target)
|
$MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(overlay.target)
|
||||||
overlay.connect("overlay_visible_changed", self, "_overlay_visible_changed")
|
overlay.connect("overlay_visible_changed", self, "_overlay_visible_changed")
|
||||||
|
overlay.connect("path_changed", self, "_update_warning")
|
||||||
|
|
||||||
#TODO use signal to activate warning
|
|
||||||
# $BasicOptions/List/Warning.visible = overlay.overlay_scene == preload("res://special_overlays/UnknownType.tscn")
|
func _update_warning():
|
||||||
|
$BasicOptions/List/Warning.visible = overlay.path_invalid
|
||||||
$BasicOptions/List/Warning/WarningInfo/Label.text = overlay.path + "\nnot found"
|
$BasicOptions/List/Warning/WarningInfo/Label.text = overlay.path + "\nnot found"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue