rename stuff

This commit is contained in:
Crispy 2022-05-08 21:26:30 +02:00
parent 9f0b811d24
commit 7edd005bb7
17 changed files with 96 additions and 59 deletions

View file

@ -1,6 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/overlay_cursor.gd" type="Script" id=1]
[node name="OverlayCursor" type="Node"]
script = ExtResource( 1 )

View file

@ -1,6 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/overlay_grab.gd" type="Script" id=1]
[node name="OverlayGrab" type="Node"]
script = ExtResource( 1 )

View file

@ -1,7 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/overlay_cursor.gd" type="Script" id=1]
[node name="OverlayTouchCursor" type="Node"]
script = ExtResource( 1 )
is_touch = true

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/mod/clickable.gd" type="Script" id=1]
[node name="Clickable" type="Node"]
script = ExtResource( 1 )

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/mod/grabbable.gd" type="Script" id=1]
[node name="Grabbable" type="Node"]
script = ExtResource( 1 )

View file

@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/mod/clickable.gd" type="Script" id=1]
[node name="Touchable" type="Node"]
script = ExtResource( 1 )
is_touch = true

View file

@ -23,8 +23,6 @@ var cursor_nodes := {
"right": preload("res://addons/openvr_overlay/interaction/Cursor.tscn").instance(),
"left": preload("res://addons/openvr_overlay/interaction/Cursor.tscn").instance(),
}
var temp = 0
var tstate = true
func _ready() -> void:
viewport.add_child(cursor_nodes.right)
@ -35,29 +33,18 @@ func _ready() -> void:
else:
get_parent().connect("trigger_on", self, "_trigger_on")
get_parent().connect("trigger_off", self, "_trigger_off")
func _process(delta: float) -> void:
cursor_pos.right = get_canvas_pos("right")
cursor_pos.left = get_canvas_pos("left")
_update_cursors()
#_send_move_event()
# _send_move_event()
prev_pos = cursor_pos.duplicate(true)
# if is_touch:
# temp += delta
# if temp > 0.5:
# temp = 0
# var click_event = InputEventMouseButton.new()
# click_event.position = Vector2(240, 340)
# click_event.pressed = tstate
# tstate = !tstate
# click_event.button_index = 1
# viewport.input(click_event)
# print("SENT EVENT ", click_event.position, " -- ", click_event.pressed)
## viewport.
#get canvas position of controller
# get canvas position of controller
func get_canvas_pos(controller) -> Vector2:
var controller_local_pos = _i._overlay_area.global_transform.xform_inv(\
_i.tracker_nodes[controller].translation)
@ -83,7 +70,7 @@ func _update_cursors():
func _send_move_event():
if not active_side:
return# only send move events while a cursor is held down
var event = InputEventMouseMotion.new()
event.position = prev_pos[active_side]
event.relative = cursor_pos[active_side] - prev_pos[active_side]

View file

@ -155,19 +155,16 @@ func _update_target():
# called by overlay_instance after properties are loaded and before overlay scene enters the tree
func spawn_modules():
# grab module
if get_parent().get_property("has_grab"):
var module = preload("res://addons/openvr_overlay/OverlayGrab.tscn")
if get_parent().get_property("grabbable"):
var module = preload("res://addons/openvr_overlay/interaction/mod/Grabbable.tscn")
add_child(module.instance())
# cursor module
if get_parent().get_property("has_cursor"):
var module = preload("res://addons/openvr_overlay/OverlayCursor.tscn")
if get_parent().get_property("clickable"):
var module = preload("res://addons/openvr_overlay/interaction/mod/Clickable.tscn")
add_child(module.instance())
# cursor module
if get_parent().get_property("has_touch"):
var module = preload("res://addons/openvr_overlay/OverlayTouchCursor.tscn")
if get_parent().get_property("touchable"):
var module = preload("res://addons/openvr_overlay/interaction/mod/Touchable.tscn")
add_child(module.instance())

View file

@ -4,10 +4,9 @@ extends Node
const OVERLAY_PROPERTIES_DEFAULT = {
"allow_delete": true,
"allow_hide": true,
# "interaction": true,
"has_cursor": false,
"has_touch": false,
"has_grab": true,
"clickable": false,
"touchable": false,
"grabbable": true,
}
var ovr_interface: ARVRInterface
@ -21,7 +20,6 @@ var trackers = {
}
func _init() -> void:
# OS.window_minimized = true
ovr_config.set_application_type(2) # Set to OVERLAY MODE
ovr_config.set_tracking_universe(1) # Set to SEATED MODE = 0, STANDING MODE = 1, RAW MODE = 2
@ -32,11 +30,12 @@ func _init() -> void:
func _ready() -> void:
OS.window_minimized = true
ARVRServer.connect("tracker_added", self, "_tracker_added")
ARVRServer.connect("tracker_removed", self, "_tracker_removed")
update_hand_ids()
#Input.set_use_accumulated_input(true)
func _tracker_added(tracker_name: String, type: int, id: int):
update_hand_ids()

View file

@ -1,7 +1,7 @@
extends Control
const OVERLAY_PROPERTIES = {
"has_cursor": true,
"clickable": true,
}

View file

@ -1,7 +1,7 @@
extends Control
const OVERLAY_PROPERTIES = {
"has_touch": true,
"touchable": true,
}
export var key_size := 100

View file

@ -3,8 +3,7 @@ extends Control
const OVERLAY_PROPERTIES = {
"allow_hide": false,
"allow_delete": false,
"has_cursor": true,
"has_grab": true,
"clickable": true,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stick.png-328b0dfe10d1d71101c4612bcd737746.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://overlay_resources/touch_stick/stick.png"
dest_files=[ "res://.import/stick.png-328b0dfe10d1d71101c4612bcd737746.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -1,8 +1,8 @@
extends Control
const OVERLAY_PROPERTIES = {
"has_cursor": true,
"has_touch": true,
"clickable": true,
"touchable": true,
}
var grabber

View file

@ -0,0 +1,20 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://overlay_resources/touch_stick/stick.png" type="Texture" id=1]
[node name="stick" type="TextureRect"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -128.0
margin_top = -128.0
margin_right = -30.0
margin_bottom = 128.0
mouse_filter = 2
texture = ExtResource( 1 )
expand = true
stretch_mode = 5
__meta__ = {
"_edit_use_anchors_": false
}