mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-22 07:30:25 +01:00
store overlay scene as node instead of packedscene
This commit is contained in:
parent
bf3908de5c
commit
5fc14a3def
3 changed files with 9 additions and 12 deletions
|
@ -1,6 +1,5 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://special_overlays/MainOverlay.tscn" type="PackedScene" id=1]
|
|
||||||
[ext_resource path="res://addons/openvr_overlay/OverlayInstance.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/openvr_overlay/OverlayInstance.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://OverlaySettingsSync.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://OverlaySettingsSync.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://overlay_manager.gd" type="Script" id=4]
|
[ext_resource path="res://overlay_manager.gd" type="Script" id=4]
|
||||||
|
@ -9,7 +8,6 @@
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
|
|
||||||
[node name="MainOverlay" parent="." instance=ExtResource( 2 )]
|
[node name="MainOverlay" parent="." instance=ExtResource( 2 )]
|
||||||
overlay_scene = ExtResource( 1 )
|
|
||||||
add_cursor = true
|
add_cursor = true
|
||||||
|
|
||||||
[node name="OverlaySettingsSync" parent="MainOverlay" instance=ExtResource( 3 )]
|
[node name="OverlaySettingsSync" parent="MainOverlay" instance=ExtResource( 3 )]
|
||||||
|
|
|
@ -11,7 +11,6 @@ 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 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
|
||||||
|
@ -34,6 +33,7 @@ var path := "res://special_overlays/MainOverlay.tscn" setget set_path
|
||||||
var path_invalid := false
|
var path_invalid := false
|
||||||
|
|
||||||
onready var container = $OverlayViewport/Container
|
onready var container = $OverlayViewport/Container
|
||||||
|
var overlay_scene: Node
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
@ -53,9 +53,6 @@ func _ready() -> void:
|
||||||
if add_grabbing:
|
if add_grabbing:
|
||||||
add_grab()
|
add_grab()
|
||||||
|
|
||||||
if overlay_scene:
|
|
||||||
container.add_child(overlay_scene.instance())
|
|
||||||
|
|
||||||
update_tracker_id()
|
update_tracker_id()
|
||||||
call_deferred("update_offset")
|
call_deferred("update_offset")
|
||||||
|
|
||||||
|
@ -152,14 +149,16 @@ func set_path(new: String) -> void:
|
||||||
path = new
|
path = new
|
||||||
path_invalid = false
|
path_invalid = false
|
||||||
|
|
||||||
overlay_scene = load(path)
|
var packed_overlay = load(path)
|
||||||
if not overlay_scene:
|
if not packed_overlay:
|
||||||
path_invalid = true
|
path_invalid = true
|
||||||
overlay_scene = load("res://special_overlays/UnknownType.tscn")
|
overlay_scene = load("res://special_overlays/UnknownType.tscn").instance()
|
||||||
|
else:
|
||||||
|
overlay_scene = packed_overlay.instance()
|
||||||
|
|
||||||
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)
|
||||||
emit_signal("path_changed")
|
emit_signal("path_changed")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
const PATH = "user://overlay_data_DEV.json"
|
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