This commit is contained in:
sharpoff
2026-01-14 13:01:37 +09:00
commit 49d7e22132
660 changed files with 41243 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
@tool
class_name XRToolsHighlightMaterial
extends Node
## Mesh to highlight
@export var highlight_mesh_instance : NodePath
## Material to set
@export var highlight_material : Resource
var _original_materials = Array()
var _highlight_mesh_instance: MeshInstance3D
# Add support for is_xr_class on XRTools classes
func is_xr_class(xr_name: String) -> bool:
return xr_name == "XRToolsHighlightMaterial"
# Called when the node enters the scene tree for the first time.
func _ready():
# Get the mesh to highlight
_highlight_mesh_instance = get_node(highlight_mesh_instance)
# Save the materials
if _highlight_mesh_instance:
# if we can find a node remember which materials are currently set on each surface
for i in range(0, _highlight_mesh_instance.get_surface_override_material_count()):
_original_materials.push_back(_highlight_mesh_instance.get_surface_override_material(i))
# Hook the highlight update
get_parent().connect("highlight_updated", _on_highlight_updated)
# Called when the pickable highlight changes
func _on_highlight_updated(_pickable, enable: bool) -> void:
# Set the materials
if _highlight_mesh_instance:
for i in range(0, _highlight_mesh_instance.get_surface_override_material_count()):
if enable:
_highlight_mesh_instance.set_surface_override_material(i, highlight_material)
else:
_highlight_mesh_instance.set_surface_override_material(i, _original_materials[i])
# This method verifies the node
func _get_configuration_warnings() -> PackedStringArray:
var warnings := PackedStringArray()
# Verify parent supports highlighting
var parent := get_parent()
if not parent or not parent.has_signal("highlight_updated"):
warnings.append("Parent does not support highlighting")
return warnings

View File

@@ -0,0 +1 @@
uid://cdl5kcr2wvnav

View File

@@ -0,0 +1,35 @@
@tool
class_name XRToolsHighlightRing
extends MeshInstance3D
# Add support for is_xr_class on XRTools classes
func is_xr_class(xr_name: String) -> bool:
return xr_name == "XRToolsHighlightRing"
# Called when the node enters the scene tree for the first time.
func _ready():
# Turn off until requested
if not Engine.is_editor_hint():
visible = false
# Hook the highlight update
get_parent().connect("highlight_updated", _on_highlight_updated)
# Called when the pickable highlight changes
func _on_highlight_updated(_pickable, enable: bool) -> void:
visible = enable
# This method verifies the node
func _get_configuration_warnings() -> PackedStringArray:
var warnings := PackedStringArray()
# Verify parent supports highlighting
var parent := get_parent()
if not parent or not parent.has_signal("highlight_updated"):
warnings.append("Parent does not support highlighting")
return warnings

View File

@@ -0,0 +1 @@
uid://b8waaso7b6bsr

View File

@@ -0,0 +1,10 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=2]
[ext_resource path="res://addons/godot-xr-tools/images/ring.png" type="Texture2D" id=1]
[resource]
flags_transparent = true
flags_unshaded = true
flags_no_depth_test = true
params_billboard_mode = 1
albedo_texture = ExtResource( 1 )

View File

@@ -0,0 +1,12 @@
[gd_scene load_steps=4 format=3 uid="uid://da2qgxxwwitl6"]
[ext_resource type="Script" uid="uid://b8waaso7b6bsr" path="res://addons/godot-xr-tools/objects/highlight/highlight_ring.gd" id="1"]
[ext_resource type="Material" path="res://addons/godot-xr-tools/objects/highlight/highlight_ring.tres" id="2"]
[sub_resource type="QuadMesh" id="1"]
size = Vector2(0.05, 0.05)
[node name="HighlightRing" type="MeshInstance3D"]
mesh = SubResource("1")
surface_material_override/0 = ExtResource("2")
script = ExtResource("1")

View File

@@ -0,0 +1,35 @@
@tool
class_name XRToolsHighlightVisible
extends Node3D
# Add support for is_xr_class on XRTools classes
func is_xr_class(xr_name: String) -> bool:
return xr_name == "XRToolsHighlightVisible"
# Called when the node enters the scene tree for the first time.
func _ready():
# Turn off until requested
if not Engine.is_editor_hint():
visible = false
# Hook the highlight update
get_parent().connect("highlight_updated", _on_highlight_updated)
# Called when the pickable highlight changes
func _on_highlight_updated(_pickable, enable: bool) -> void:
visible = enable
# This method verifies the node
func _get_configuration_warnings() -> PackedStringArray:
var warnings := PackedStringArray()
# Verify parent supports highlighting
var parent := get_parent()
if not parent or not parent.has_signal("highlight_updated"):
warnings.append("Parent does not support highlighting")
return warnings

View File

@@ -0,0 +1 @@
uid://0b7wkxi4vymb