Merge pull request #127 from Nitwel/improvements
Improvements & UI Update
This commit is contained in:
commit
a75f79257f
|
@ -31,6 +31,8 @@ static func _bind_store(target, prop, store: RdotStore, key, watch_signal=null):
|
|||
return _bind_state(target, prop, store._proxied_value[key], watch_signal)
|
||||
|
||||
static func _bind_state(target, prop, value, watch_signal=null):
|
||||
assert(state != null, "target cannot be null")
|
||||
|
||||
var graph = RdotGraph.getInstance()
|
||||
|
||||
var watch_c = func(new_value):
|
||||
|
|
|
@ -61,4 +61,4 @@ func _init():
|
|||
|
||||
node.value = newValue
|
||||
node.state = State.SET
|
||||
node.version += 1
|
||||
node.version += 1
|
||||
|
|
|
@ -4,9 +4,9 @@ class_name RdotGraph
|
|||
static var instance: RdotGraph = null
|
||||
|
||||
static func getInstance() -> RdotGraph:
|
||||
if instance == null:
|
||||
instance = RdotGraph.new()
|
||||
return instance
|
||||
if instance == null:
|
||||
instance = RdotGraph.new()
|
||||
return instance
|
||||
|
||||
var activeConsumer: RdotNode = null
|
||||
var inNotificationPhase := false
|
||||
|
@ -17,209 +17,209 @@ var postSignalSetFn := Callable()
|
|||
var watcherPending := false
|
||||
|
||||
var watcher = R.Watcher.new(func(_arg):
|
||||
if watcherPending:
|
||||
return
|
||||
if watcherPending:
|
||||
return
|
||||
|
||||
watcherPending=true
|
||||
var endOfFrame=func():
|
||||
watcherPending=true
|
||||
var endOfFrame=func():
|
||||
|
||||
watcherPending=false
|
||||
for s in watcher.getPending():
|
||||
s.do_get()
|
||||
watcherPending=false
|
||||
for s in watcher.getPending():
|
||||
s.do_get()
|
||||
|
||||
watcher.watch()
|
||||
watcher.watch()
|
||||
|
||||
endOfFrame.call_deferred()
|
||||
endOfFrame.call_deferred()
|
||||
)
|
||||
|
||||
func setActiveConsumer(consumer: RdotNode) -> RdotNode:
|
||||
var prev = activeConsumer
|
||||
activeConsumer = consumer
|
||||
return prev
|
||||
var prev = activeConsumer
|
||||
activeConsumer = consumer
|
||||
return prev
|
||||
|
||||
func getActiveConsumer() -> RdotNode:
|
||||
return activeConsumer
|
||||
return activeConsumer
|
||||
|
||||
func isInNotificationPhase() -> bool:
|
||||
return inNotificationPhase
|
||||
return inNotificationPhase
|
||||
|
||||
func producerAccessed(node: RdotNode):
|
||||
assert(inNotificationPhase == false, "Signal read during notification phase")
|
||||
assert(inNotificationPhase == false, "Signal read during notification phase")
|
||||
|
||||
if activeConsumer == null:
|
||||
return
|
||||
if activeConsumer == null:
|
||||
return
|
||||
|
||||
if activeConsumer.consumerOnSignalRead.is_null() == false:
|
||||
activeConsumer.consumerOnSignalRead.call(node)
|
||||
if activeConsumer.consumerOnSignalRead.is_null() == false:
|
||||
activeConsumer.consumerOnSignalRead.call(node)
|
||||
|
||||
var idx = activeConsumer.nextProducerIndex;
|
||||
activeConsumer.nextProducerIndex += 1
|
||||
var idx = activeConsumer.nextProducerIndex;
|
||||
activeConsumer.nextProducerIndex += 1
|
||||
|
||||
assertConsumerNode(activeConsumer)
|
||||
assertConsumerNode(activeConsumer)
|
||||
|
||||
if idx < activeConsumer.producerNode.size()&&activeConsumer.producerNode[idx] != node:
|
||||
if consumerIsLive(activeConsumer):
|
||||
var staleProducer = activeConsumer.producerNode[idx]
|
||||
producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx])
|
||||
if idx < activeConsumer.producerNode.size()&&activeConsumer.producerNode[idx] != node:
|
||||
if consumerIsLive(activeConsumer):
|
||||
var staleProducer = activeConsumer.producerNode[idx]
|
||||
producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx])
|
||||
|
||||
if RdotArray.do_get(activeConsumer.producerNode, idx) != node:
|
||||
RdotArray.do_set(activeConsumer.producerNode, idx, node)
|
||||
RdotArray.do_set(activeConsumer.producerIndexOfThis, idx, producerAddLiveConsumer(node, activeConsumer, idx) if consumerIsLive(activeConsumer) else 0)
|
||||
if RdotArray.do_get(activeConsumer.producerNode, idx) != node:
|
||||
RdotArray.do_set(activeConsumer.producerNode, idx, node)
|
||||
RdotArray.do_set(activeConsumer.producerIndexOfThis, idx, producerAddLiveConsumer(node, activeConsumer, idx) if consumerIsLive(activeConsumer) else 0)
|
||||
|
||||
RdotArray.do_set(activeConsumer.producerLastReadVersion, idx, node.version)
|
||||
RdotArray.do_set(activeConsumer.producerLastReadVersion, idx, node.version)
|
||||
|
||||
func producerIncrementEpoch():
|
||||
epoch += 1
|
||||
epoch += 1
|
||||
|
||||
func producerUpdateValueVersion(node: RdotNode):
|
||||
if consumerIsLive(node)&&!node.dirty:
|
||||
return
|
||||
if consumerIsLive(node)&&!node.dirty:
|
||||
return
|
||||
|
||||
if !node.dirty&&node.lastCleanEpoch == epoch:
|
||||
return
|
||||
if !node.dirty&&node.lastCleanEpoch == epoch:
|
||||
return
|
||||
|
||||
if !node.producerMustRecompute(node)&&!consumerPollProducersForChange(node):
|
||||
node.dirty = false;
|
||||
node.lastCleanEpoch = epoch
|
||||
return
|
||||
if !node.producerMustRecompute(node)&&!consumerPollProducersForChange(node):
|
||||
node.dirty = false;
|
||||
node.lastCleanEpoch = epoch
|
||||
return
|
||||
|
||||
if node.producerRecomputeValue.is_null() == false:
|
||||
node.producerRecomputeValue.call(node)
|
||||
if node.producerRecomputeValue.is_null() == false:
|
||||
node.producerRecomputeValue.call(node)
|
||||
|
||||
node.dirty = false
|
||||
node.lastCleanEpoch = epoch
|
||||
node.dirty = false
|
||||
node.lastCleanEpoch = epoch
|
||||
|
||||
func producerNotifyConsumers(node: RdotNode):
|
||||
if node.liveConsumerNode == null:
|
||||
return
|
||||
if node.liveConsumerNode == null:
|
||||
return
|
||||
|
||||
var prev = inNotificationPhase
|
||||
inNotificationPhase = true
|
||||
var prev = inNotificationPhase
|
||||
inNotificationPhase = true
|
||||
|
||||
for consumer in node.liveConsumerNode:
|
||||
if !consumer.dirty:
|
||||
consumerMarkDirty(consumer)
|
||||
for consumer in node.liveConsumerNode:
|
||||
if !consumer.dirty:
|
||||
consumerMarkDirty(consumer)
|
||||
|
||||
inNotificationPhase = prev
|
||||
inNotificationPhase = prev
|
||||
|
||||
func producerUpdatesAllowed() -> bool:
|
||||
return activeConsumer == null||activeConsumer.consumerAllowSignalWrites != false
|
||||
return activeConsumer == null||activeConsumer.consumerAllowSignalWrites != false
|
||||
|
||||
func consumerMarkDirty(node: RdotNode):
|
||||
node.dirty = true
|
||||
producerNotifyConsumers(node)
|
||||
node.dirty = true
|
||||
producerNotifyConsumers(node)
|
||||
|
||||
if node.consumerMarkedDirty.is_null() == false:
|
||||
node.consumerMarkedDirty.call(node)
|
||||
if node.consumerMarkedDirty.is_null() == false:
|
||||
node.consumerMarkedDirty.call(node)
|
||||
|
||||
func consumerBeforeComputation(node: RdotNode) -> RdotNode:
|
||||
if node:
|
||||
node.nextProducerIndex = 0
|
||||
if node:
|
||||
node.nextProducerIndex = 0
|
||||
|
||||
return setActiveConsumer(node)
|
||||
return setActiveConsumer(node)
|
||||
|
||||
func consumerAfterComputation(node: RdotNode, prevConsumer: RdotNode):
|
||||
setActiveConsumer(prevConsumer)
|
||||
setActiveConsumer(prevConsumer)
|
||||
|
||||
if node == null||node.producerNode == null||node.producerIndexOfThis == null||node.producerLastReadVersion == null:
|
||||
return
|
||||
if node == null||node.producerNode == null||node.producerIndexOfThis == null||node.producerLastReadVersion == null:
|
||||
return
|
||||
|
||||
if consumerIsLive(node):
|
||||
for i in range(node.nextProducerIndex, node.producerNode.size()):
|
||||
producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i])
|
||||
if consumerIsLive(node):
|
||||
for i in range(node.nextProducerIndex, node.producerNode.size()):
|
||||
producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i])
|
||||
|
||||
while node.producerNode.size() > node.nextProducerIndex:
|
||||
node.producerNode.pop_back()
|
||||
node.producerLastReadVersion.pop_back()
|
||||
node.producerIndexOfThis.pop_back()
|
||||
while node.producerNode.size() > node.nextProducerIndex:
|
||||
node.producerNode.pop_back()
|
||||
node.producerLastReadVersion.pop_back()
|
||||
node.producerIndexOfThis.pop_back()
|
||||
|
||||
func consumerPollProducersForChange(node: RdotNode) -> bool:
|
||||
assertConsumerNode(node)
|
||||
assertConsumerNode(node)
|
||||
|
||||
for i in range(node.producerNode.size()):
|
||||
var producer = node.producerNode[i]
|
||||
var seenVersion = node.producerLastReadVersion[i]
|
||||
for i in range(node.producerNode.size()):
|
||||
var producer = node.producerNode[i]
|
||||
var seenVersion = node.producerLastReadVersion[i]
|
||||
|
||||
if seenVersion != producer.version:
|
||||
return true
|
||||
if seenVersion != producer.version:
|
||||
return true
|
||||
|
||||
producerUpdateValueVersion(producer)
|
||||
producerUpdateValueVersion(producer)
|
||||
|
||||
if seenVersion != producer.version:
|
||||
return true
|
||||
if seenVersion != producer.version:
|
||||
return true
|
||||
|
||||
return false
|
||||
return false
|
||||
|
||||
func consumerDestroy(node: RdotNode):
|
||||
assertConsumerNode(node)
|
||||
assertConsumerNode(node)
|
||||
|
||||
if consumerIsLive(node):
|
||||
for i in range(node.producerNode.size()):
|
||||
producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i])
|
||||
if consumerIsLive(node):
|
||||
for i in range(node.producerNode.size()):
|
||||
producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i])
|
||||
|
||||
node.producerNode.clear()
|
||||
node.producerLastReadVersion.clear()
|
||||
node.producerIndexOfThis.clear()
|
||||
node.producerNode.clear()
|
||||
node.producerLastReadVersion.clear()
|
||||
node.producerIndexOfThis.clear()
|
||||
|
||||
if node.liveConsumerNode:
|
||||
node.liveConsumerNode.clear()
|
||||
node.liveConsumerIndexOfThis.clear()
|
||||
if node.liveConsumerNode:
|
||||
node.liveConsumerNode.clear()
|
||||
node.liveConsumerIndexOfThis.clear()
|
||||
|
||||
static func producerAddLiveConsumer(node: RdotNode, consumer: RdotNode, indexOfThis: int) -> int:
|
||||
assertProducerNode(node)
|
||||
assertConsumerNode(node)
|
||||
assertProducerNode(node)
|
||||
assertConsumerNode(node)
|
||||
|
||||
if node.liveConsumerNode.size() == 0:
|
||||
if node.watched.is_null() == false:
|
||||
node.watched.call(node.wrapper)
|
||||
if node.liveConsumerNode.size() == 0:
|
||||
if node.watched.is_null() == false:
|
||||
node.watched.call(node.wrapper)
|
||||
|
||||
for i in range(node.producerNode.size()):
|
||||
node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i)
|
||||
for i in range(node.producerNode.size()):
|
||||
node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i)
|
||||
|
||||
node.liveConsumerIndexOfThis.push_back(indexOfThis)
|
||||
node.liveConsumerNode.push_back(consumer)
|
||||
node.liveConsumerIndexOfThis.push_back(indexOfThis)
|
||||
node.liveConsumerNode.push_back(consumer)
|
||||
|
||||
return node.liveConsumerNode.size() - 1
|
||||
return node.liveConsumerNode.size() - 1
|
||||
|
||||
static func producerRemoveLiveConsumerAtIndex(node: RdotNode, idx: int):
|
||||
assertProducerNode(node)
|
||||
assertConsumerNode(node)
|
||||
assertProducerNode(node)
|
||||
assertConsumerNode(node)
|
||||
|
||||
assert(idx < node.liveConsumerNode.size(), "active consumer index %s is out of bounds of %s consumers)" % [idx, node.liveConsumerNode.size()])
|
||||
assert(idx < node.liveConsumerNode.size(), "active consumer index %s is out of bounds of %s consumers)" % [idx, node.liveConsumerNode.size()])
|
||||
|
||||
if node.liveConsumerNode.size() == 1:
|
||||
if node.unwatched.is_null() == false:
|
||||
node.unwatched.call(node.wrapper)
|
||||
if node.liveConsumerNode.size() == 1:
|
||||
if node.unwatched.is_null() == false:
|
||||
node.unwatched.call(node.wrapper)
|
||||
|
||||
for i in range(node.producerNode.size()):
|
||||
producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i])
|
||||
for i in range(node.producerNode.size()):
|
||||
producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i])
|
||||
|
||||
var lastIdx = node.liveConsumerNode.size() - 1
|
||||
node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx]
|
||||
node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx]
|
||||
var lastIdx = node.liveConsumerNode.size() - 1
|
||||
node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx]
|
||||
node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx]
|
||||
|
||||
node.liveConsumerNode.pop_back()
|
||||
node.liveConsumerIndexOfThis.pop_back()
|
||||
node.liveConsumerNode.pop_back()
|
||||
node.liveConsumerIndexOfThis.pop_back()
|
||||
|
||||
if idx < node.liveConsumerNode.size():
|
||||
var idxProducer = node.liveConsumerIndexOfThis[idx]
|
||||
var consumer = node.liveConsumerNode[idx]
|
||||
assertConsumerNode(consumer)
|
||||
consumer.producerIndexOfThis[idxProducer] = idx
|
||||
if idx < node.liveConsumerNode.size():
|
||||
var idxProducer = node.liveConsumerIndexOfThis[idx]
|
||||
var consumer = node.liveConsumerNode[idx]
|
||||
assertConsumerNode(consumer)
|
||||
consumer.producerIndexOfThis[idxProducer] = idx
|
||||
|
||||
static func consumerIsLive(node: RdotNode) -> bool:
|
||||
return node.consumerIsAlwaysLive||(node.liveConsumerNode != null&&node.liveConsumerNode.size() > 0)
|
||||
return node.consumerIsAlwaysLive||(node.liveConsumerNode != null&&node.liveConsumerNode.size() > 0)
|
||||
|
||||
static func assertConsumerNode(node: RdotNode):
|
||||
if node.producerNode == null:
|
||||
node.producerNode = []
|
||||
if node.producerIndexOfThis == null:
|
||||
node.producerIndexOfThis = []
|
||||
if node.producerLastReadVersion == null:
|
||||
node.producerLastReadVersion = []
|
||||
if node.producerNode == null:
|
||||
node.producerNode = []
|
||||
if node.producerIndexOfThis == null:
|
||||
node.producerIndexOfThis = []
|
||||
if node.producerLastReadVersion == null:
|
||||
node.producerLastReadVersion = []
|
||||
|
||||
static func assertProducerNode(node: RdotNode):
|
||||
if node.liveConsumerNode == null:
|
||||
node.liveConsumerNode = []
|
||||
if node.liveConsumerIndexOfThis == null:
|
||||
node.liveConsumerIndexOfThis = []
|
||||
if node.liveConsumerNode == null:
|
||||
node.liveConsumerNode = []
|
||||
if node.liveConsumerIndexOfThis == null:
|
||||
node.liveConsumerIndexOfThis = []
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://c2j7nev6qx25s"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c2j7nev6qx25s"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/entities/button/button.gd" id="1_ja7lt"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_r4tef"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="3_vrobf"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="4_7upxo"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_um5pa"]
|
||||
size = Vector3(0.0700684, 0.011734, 0.0703125)
|
||||
size = Vector3(0.07, 0.07, 0.012)
|
||||
|
||||
[node name="Button" type="StaticBody3D"]
|
||||
script = ExtResource("1_ja7lt")
|
||||
|
||||
[node name="Button" parent="." instance=ExtResource("1_r4tef")]
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("4_7upxo")
|
||||
|
||||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("3_vrobf")
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://b0nq4wjfckxsa"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b0nq4wjfckxsa"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/entities/camera/camera.gd" id="1_htxq3"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_e2u6o"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="3_jheyx"]
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_830bv"]
|
||||
size = Vector2(0.15, 0.15)
|
||||
|
@ -10,7 +9,7 @@ size = Vector2(0.15, 0.15)
|
|||
[sub_resource type="BoxShape3D" id="BoxShape3D_te0pn"]
|
||||
size = Vector3(0.15, 0.15, 0.01)
|
||||
|
||||
[node name="Camera" type="StaticBody3D" ]
|
||||
[node name="Camera" type="StaticBody3D"]
|
||||
script = ExtResource("1_htxq3")
|
||||
|
||||
[node name="View" type="Sprite3D" parent="."]
|
||||
|
@ -26,6 +25,3 @@ shape = SubResource("BoxShape3D_te0pn")
|
|||
|
||||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("2_e2u6o")
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("3_jheyx")
|
||||
|
|
|
@ -15,9 +15,9 @@ const color_wheel_img := preload ("res://assets/canvas.png")
|
|||
@onready var mode_before = $Modes/Previous
|
||||
@onready var mode_label = $Modes/Label
|
||||
|
||||
var state = true
|
||||
var brightness = 0 # 0-255
|
||||
var color = color_on
|
||||
var active = R.state(false)
|
||||
var brightness = R.state(0) # 0-255
|
||||
var color = R.state(color_on)
|
||||
var color_supported = false
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
@ -26,7 +26,7 @@ func _ready():
|
|||
|
||||
icon.value = "lightbulb"
|
||||
var stateInfo = await HomeApi.get_state(entity_id)
|
||||
set_state(stateInfo["state"] == "on", stateInfo["attributes"])
|
||||
set_state(stateInfo)
|
||||
|
||||
if stateInfo.has("attributes")&&stateInfo["attributes"].has("effect_list")&&stateInfo["attributes"]["effect_list"].size() > 0:
|
||||
if stateInfo["attributes"].has("effect")&&stateInfo["attributes"]["effect"] != null:
|
||||
|
@ -65,79 +65,65 @@ func _ready():
|
|||
var delta=Vector2(target_point.x, target_point.z) * (1.0 / 0.08)
|
||||
if delta.length() > 1:
|
||||
delta=delta.normalized()
|
||||
|
||||
print("delta", delta)
|
||||
|
||||
var color=color_wheel_img.get_image().get_pixel((delta.x * 0.5 + 0.5) * 1000, (delta.y * 0.5 + 0.5) * 1000)
|
||||
var picked_color=color_wheel_img.get_image().get_pixel((delta.x * 0.5 + 0.5) * 1000, (delta.y * 0.5 + 0.5) * 1000)
|
||||
|
||||
print("color", color)
|
||||
|
||||
color_puck.material_override.albedo_color=color
|
||||
color_puck.material_override.albedo_color=picked_color
|
||||
color_puck.position=Vector3(target_point.x, color_puck.position.y, target_point.z)
|
||||
|
||||
var attributes={
|
||||
"rgb_color": [int(color.r * 255), int(color.g * 255), int(color.b * 255)],
|
||||
"rgb_color": [int(picked_color.r * 255), int(picked_color.g * 255), int(picked_color.b * 255)],
|
||||
}
|
||||
|
||||
HomeApi.set_state(entity_id, "on", attributes)
|
||||
set_state(state, attributes)
|
||||
)
|
||||
color_supported = true
|
||||
else:
|
||||
remove_child(color_wheel)
|
||||
|
||||
await HomeApi.watch_state(entity_id, func(new_state):
|
||||
if (new_state["state"] == "on") == state:
|
||||
return
|
||||
set_state(new_state["state"] == "on", new_state["attributes"])
|
||||
set_state(new_state)
|
||||
)
|
||||
|
||||
slider.on_value_changed.connect(func(new_value):
|
||||
var value=new_value / 100 * 255
|
||||
HomeApi.set_state(entity_id, "on" if state else "off", {"brightness": int(value)})
|
||||
set_state(state, {"brightness": value})
|
||||
HomeApi.set_state(entity_id, "on" if active.value else "off", {"brightness": int(value)})
|
||||
)
|
||||
|
||||
func set_state(new_state: bool, attributes={}):
|
||||
if state == false&&new_state == false:
|
||||
func set_state(stateInfo):
|
||||
if active.value == false&&stateInfo["state"] == "off":
|
||||
return
|
||||
|
||||
state = new_state
|
||||
var attributes = stateInfo["attributes"]
|
||||
|
||||
if attributes.has("brightness"):
|
||||
brightness = attributes["brightness"]
|
||||
active.value = stateInfo["state"] == "on"
|
||||
|
||||
if attributes.has("brightness")&&attributes["brightness"] != null:
|
||||
brightness.value = attributes["brightness"]
|
||||
slider.value = attributes["brightness"] / 255.0 * 100
|
||||
|
||||
if attributes.has("rgb_color")&&attributes["rgb_color"] != null:
|
||||
color = Color(attributes["rgb_color"][0] / 255.0, attributes["rgb_color"][1] / 255.0, attributes["rgb_color"][2] / 255.0, 1)
|
||||
color.value = Color(attributes["rgb_color"][0] / 255.0, attributes["rgb_color"][1] / 255.0, attributes["rgb_color"][2] / 255.0, 1)
|
||||
|
||||
var tween = create_tween()
|
||||
|
||||
var target_color = color_off
|
||||
|
||||
if state:
|
||||
if brightness == null:
|
||||
target_color = color if color_supported else color_on
|
||||
if active.value:
|
||||
if brightness.value == null:
|
||||
target_color = color.value if color_supported else color_on
|
||||
else:
|
||||
target_color = color_off.lerp(color if color_supported else color_on, brightness / 255.0)
|
||||
target_color = color_off.lerp(color.value if color_supported else color_on, brightness.value / 255.0)
|
||||
|
||||
icon_color.value = target_color
|
||||
tween.tween_property(lightbulb, "material_override:albedo_color", target_color, 0.3)
|
||||
|
||||
func _on_click(event):
|
||||
if event.target == self:
|
||||
var attributes = {}
|
||||
|
||||
if !state&&brightness != null:
|
||||
attributes["brightness"] = int(brightness)
|
||||
|
||||
HomeApi.set_state(entity_id, "on" if !state else "off", attributes)
|
||||
set_state(!state, attributes)
|
||||
_toggle()
|
||||
|
||||
func quick_action():
|
||||
var attributes = {}
|
||||
_toggle()
|
||||
|
||||
if !state&&brightness != null:
|
||||
attributes["brightness"] = int(brightness)
|
||||
|
||||
HomeApi.set_state(entity_id, "on" if !state else "off", attributes)
|
||||
set_state(!state, attributes)
|
||||
func _toggle():
|
||||
HomeApi.set_state(entity_id, "off" if active.value else "on")
|
|
@ -1,9 +1,8 @@
|
|||
[gd_scene load_steps=15 format=3 uid="uid://cw86rc42dv2d8"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://cw86rc42dv2d8"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/entities/light/light.gd" id="1_ykxy3"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_4sfxb"]
|
||||
[ext_resource type="Material" uid="uid://vce66e7sbc3n" path="res://content/entities/light/light_on.tres" id="5_50gph"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="5_oh4jg"]
|
||||
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="6_mhjlm"]
|
||||
[ext_resource type="Texture2D" uid="uid://hy2f6is7qjyv" path="res://assets/canvas.png" id="7_ximu1"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="8_1sfll"]
|
||||
|
@ -37,9 +36,6 @@ script = ExtResource("1_ykxy3")
|
|||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_ukj14")
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("5_oh4jg")
|
||||
|
||||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("4_4sfxb")
|
||||
|
||||
|
@ -59,11 +55,10 @@ height = 0.03
|
|||
sides = 36
|
||||
|
||||
[node name="Slider" parent="." instance=ExtResource("6_mhjlm")]
|
||||
transform = Transform3D(1.91069e-15, 4.37114e-08, 1, 1, -4.37114e-08, 0, 4.37114e-08, 1, -4.37114e-08, 0.08, 0, 0)
|
||||
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0.08, 0, 0)
|
||||
max = 100.0
|
||||
value = 100.0
|
||||
step = 1.0
|
||||
size = Vector3(10, 0.4, 1)
|
||||
|
||||
[node name="ColorWheel" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.15, 0, 0)
|
||||
|
@ -95,12 +90,12 @@ mesh = SubResource("CylinderMesh_x68ys")
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.11, 0)
|
||||
|
||||
[node name="Next" parent="Modes" instance=ExtResource("8_nhcff")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.04, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.04, 0, 0)
|
||||
label = "navigate_next"
|
||||
icon = true
|
||||
|
||||
[node name="Previous" parent="Modes" instance=ExtResource("8_nhcff")]
|
||||
transform = Transform3D(1, 0, 0, 0, 2.98023e-08, -1, 0, 1, 2.98023e-08, -0.1, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1, 0, 0)
|
||||
label = "navigate_before"
|
||||
icon = true
|
||||
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
albedo_color = Color(0.231373, 0.231373, 0.231373, 1)
|
||||
emission = Color(1, 0.65098, 0, 1)
|
||||
emission_energy_multiplier = 0.0
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://dyktdg7ggiwl4"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dyktdg7ggiwl4"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_8opk3"]
|
||||
[ext_resource type="Script" path="res://content/entities/media_player/media_player.gd" id="1_ame17"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="3_bguto"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="4_fnfum"]
|
||||
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_w73hw"]
|
||||
[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="5_koe28"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_vi3eg"]
|
||||
size = Vector3(0.23, 0.142768, 0.01)
|
||||
|
||||
[node name="MediaPlayer" type="StaticBody3D" ]
|
||||
[node name="MediaPlayer" type="StaticBody3D"]
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_ame17")
|
||||
|
||||
|
@ -19,17 +18,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0364514, -0.01)
|
|||
shape = SubResource("BoxShape3D_vi3eg")
|
||||
|
||||
[node name="Previous" parent="." instance=ExtResource("1_8opk3")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.07, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.07, 0, 0)
|
||||
label = "skip_previous"
|
||||
icon = true
|
||||
|
||||
[node name="Play" parent="." instance=ExtResource("1_8opk3")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -4.65661e-08, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.65661e-08, 0, 0)
|
||||
label = "pause"
|
||||
icon = true
|
||||
|
||||
[node name="Next" parent="." instance=ExtResource("1_8opk3")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.07, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.07, 0, 0)
|
||||
label = "skip_next"
|
||||
icon = true
|
||||
|
||||
|
@ -60,20 +59,15 @@ pixel_size = 0.001
|
|||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("3_bguto")
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("4_fnfum")
|
||||
|
||||
[node name="Slider" parent="." instance=ExtResource("4_w73hw")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.0562844, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0562844, 0)
|
||||
max = 100.0
|
||||
value = 30.0
|
||||
step = 1.0
|
||||
show_label = true
|
||||
label_unit = "%"
|
||||
size = Vector3(15, 0.4, 1)
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="Slider"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.088399, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.088399, 0, 0.01)
|
||||
pixel_size = 0.001
|
||||
text = "volume_up"
|
||||
font = ExtResource("5_koe28")
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bbwedgq63bj84"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bbwedgq63bj84"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/entities/number/number.gd" id="1_26xwp"]
|
||||
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="2_sninv"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="3_x8wda"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="4_3xwop"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_7mk8w"]
|
||||
size = Vector3(0.0390625, 0.114258, 0.0142822)
|
||||
size = Vector3(0.0390625, 0.150391, 0.0142822)
|
||||
|
||||
[node name="Number" type="StaticBody3D" ]
|
||||
[node name="Number" type="StaticBody3D"]
|
||||
script = ExtResource("1_26xwp")
|
||||
|
||||
[node name="Slider" parent="." instance=ExtResource("2_sninv")]
|
||||
transform = Transform3D(8.74228e-08, 4.37114e-08, 1, 1, 4.37114e-08, -8.74228e-08, -4.37114e-08, 1, -4.37114e-08, 0, 0, 0)
|
||||
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
|
||||
value = 0.0
|
||||
size = Vector3(20, 0.8, 2)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.00762939)
|
||||
|
@ -22,6 +20,3 @@ shape = SubResource("BoxShape3D_7mk8w")
|
|||
|
||||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("3_x8wda")
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("4_3xwop")
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://xsiy71rsqulj"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://xsiy71rsqulj"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/entities/sensor/sensor.gd" id="1_57ac8"]
|
||||
[ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="2_4np3x"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_fpq5q"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="3_l3sp5"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_bmtkc"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_phuot"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.18, 0.03, 0.02)
|
||||
|
||||
[node name="Sensor" type="StaticBody3D" ]
|
||||
[node name="Sensor" type="StaticBody3D"]
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_57ac8")
|
||||
|
||||
|
@ -28,11 +27,8 @@ font_size = 80
|
|||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("2_fpq5q")
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("3_l3sp5")
|
||||
|
||||
[node name="Button" parent="." instance=ExtResource("5_bmtkc")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.1, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0)
|
||||
label = "add_chart"
|
||||
icon = true
|
||||
|
||||
|
|
|
@ -4,42 +4,35 @@ const Entity = preload ("../entity.gd")
|
|||
|
||||
@onready var sprite: AnimatedSprite3D = $Icon
|
||||
|
||||
var active = R.state(false)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
super()
|
||||
var stateInfo = await HomeApi.get_state(entity_id)
|
||||
|
||||
set_state(stateInfo)
|
||||
|
||||
await HomeApi.watch_state(entity_id, func(new_state):
|
||||
set_state(new_state)
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
sprite.set_frame(1 if active.value else 0)
|
||||
)
|
||||
|
||||
func set_state(stateInfo):
|
||||
if stateInfo == null:
|
||||
return
|
||||
|
||||
if stateInfo["state"] == "on":
|
||||
sprite.set_frame(0)
|
||||
else:
|
||||
sprite.set_frame(1)
|
||||
|
||||
active.value = stateInfo["state"] == "on"
|
||||
icon.value = "toggle_" + stateInfo["state"]
|
||||
|
||||
await HomeApi.watch_state(entity_id, func(new_state):
|
||||
if new_state["state"] == "on":
|
||||
sprite.set_frame(0)
|
||||
else:
|
||||
sprite.set_frame(1)
|
||||
|
||||
icon.value="toggle_" + new_state["state"]
|
||||
)
|
||||
|
||||
func _on_click(_event):
|
||||
HomeApi.set_state(entity_id, "off" if sprite.get_frame() == 0 else "on")
|
||||
if sprite.get_frame() == 0:
|
||||
sprite.set_frame(1)
|
||||
else:
|
||||
sprite.set_frame(0)
|
||||
|
||||
func _on_request_completed():
|
||||
pass
|
||||
_toggle()
|
||||
|
||||
func quick_action():
|
||||
HomeApi.set_state(entity_id, "off" if sprite.get_frame() == 0 else "on")
|
||||
if sprite.get_frame() == 0:
|
||||
sprite.set_frame(1)
|
||||
else:
|
||||
sprite.set_frame(0)
|
||||
_toggle()
|
||||
|
||||
func _toggle():
|
||||
HomeApi.set_state(entity_id, "off" if active.value else "on")
|
|
@ -1,10 +1,9 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://cscl5k7lhopj5"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cscl5k7lhopj5"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/entities/switch/switch.gd" id="1_8ffhi"]
|
||||
[ext_resource type="Texture2D" uid="uid://br3p0c2foputg" path="res://assets/materials/swich_on.png" id="1_w68gw"]
|
||||
[ext_resource type="Texture2D" uid="uid://co2ishj2hx57p" path="res://assets/materials/switch_off.png" id="2_86ba1"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_6xr03"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="5_j5ucu"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
||||
radius = 0.0482081
|
||||
|
@ -13,17 +12,17 @@ radius = 0.0482081
|
|||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("1_w68gw")
|
||||
"texture": ExtResource("2_86ba1")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_86ba1")
|
||||
"texture": ExtResource("1_w68gw")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="Switch" type="StaticBody3D" ]
|
||||
[node name="Switch" type="StaticBody3D"]
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_8ffhi")
|
||||
|
||||
|
@ -37,6 +36,3 @@ sprite_frames = SubResource("SpriteFrames_ldpuo")
|
|||
|
||||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("4_6xr03")
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("5_j5ucu")
|
||||
|
|
|
@ -8,18 +8,31 @@ signal on_moved()
|
|||
@export var restricted: bool = false
|
||||
@export var restrict_movement: Callable
|
||||
@export var lock_rotation: bool = false
|
||||
@export var disabled: bool = false
|
||||
var hit_node := Node3D.new()
|
||||
var initiator = null
|
||||
|
||||
func _on_grab_down(event: EventPointer):
|
||||
if restricted && event.target != get_parent():
|
||||
if disabled:
|
||||
return
|
||||
|
||||
event.initiator.node.add_child(hit_node)
|
||||
if restricted&&event.target != get_parent():
|
||||
return
|
||||
|
||||
initiator = event.initiator
|
||||
|
||||
if hit_node.get_parent() != null:
|
||||
hit_node.get_parent().remove_child(hit_node)
|
||||
|
||||
initiator.node.add_child(hit_node)
|
||||
hit_node.global_transform = get_parent().global_transform
|
||||
|
||||
func _on_grab_move(_event: EventPointer):
|
||||
func _on_grab_move(event: EventPointer):
|
||||
if hit_node.get_parent() == null:
|
||||
return
|
||||
|
||||
if event.initiator != initiator:
|
||||
return
|
||||
|
||||
if restrict_movement:
|
||||
get_parent().global_position = restrict_movement.call(hit_node.global_position)
|
||||
|
@ -33,7 +46,14 @@ func _on_grab_move(_event: EventPointer):
|
|||
on_move.emit(get_parent().global_position, Vector3(0, 0, 0))
|
||||
|
||||
func _on_grab_up(event: EventPointer):
|
||||
event.initiator.node.remove_child(hit_node)
|
||||
if event.initiator != initiator:
|
||||
return
|
||||
|
||||
if hit_node.get_parent() == null:
|
||||
return
|
||||
|
||||
initiator = null
|
||||
hit_node.get_parent().remove_child(hit_node)
|
||||
on_moved.emit()
|
||||
|
||||
func _get_configuration_warnings() -> PackedStringArray:
|
||||
|
@ -41,6 +61,5 @@ func _get_configuration_warnings() -> PackedStringArray:
|
|||
|
||||
if get_parent() is StaticBody3D == false:
|
||||
warnings.append("Movable requires a StaticBody3D as parent.")
|
||||
|
||||
|
||||
return warnings
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
extends Function
|
||||
class_name Occludable
|
||||
|
||||
var ray := RayCast3D.new()
|
||||
@onready var player_camera: XRCamera3D = get_node("/root/Main/XROrigin3D/XRCamera3D")
|
||||
|
||||
func _ready():
|
||||
ray.set_collision_mask_value(1, false)
|
||||
ray.set_collision_mask_value(5, true)
|
||||
get_parent().add_child.call_deferred(ray)
|
||||
|
||||
EventSystem.on_slow_tick.connect(_slow_tick)
|
||||
|
||||
func _slow_tick(_delta):
|
||||
if player_camera.is_inside_tree() == false||ray.is_inside_tree() == false:
|
||||
return
|
||||
|
||||
ray.target_position = get_parent().to_local(player_camera.global_position)
|
||||
|
||||
get_parent().visible = ray.is_colliding() == false
|
|
@ -18,13 +18,11 @@ sky_material = ExtResource("5_wgwf8")
|
|||
|
||||
[sub_resource type="Environment" id="Environment_7ghp0"]
|
||||
background_mode = 1
|
||||
background_color = Color(1, 1, 1, 0)
|
||||
background_color = Color(0, 0, 0, 0)
|
||||
background_energy_multiplier = 0.0
|
||||
sky = SubResource("Sky_vhymk")
|
||||
ambient_light_source = 2
|
||||
ambient_light_color = Color(1, 1, 1, 1)
|
||||
ambient_light_energy = 0.5
|
||||
reflected_light_source = 1
|
||||
ssao_radius = 6.52
|
||||
ssao_intensity = 5.68
|
||||
|
||||
|
@ -43,7 +41,7 @@ script = ExtResource("1_uvrd4")
|
|||
environment = SubResource("Environment_7ghp0")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.834925, -0.386727, -0.39159, 0.550364, 0.586681, 0.594058, 2.91038e-11, -0.711511, 0.702675, -2.91038e-10, 7.21041, 2.06458)
|
||||
transform = Transform3D(1, -2.51787e-05, 0.000567105, -0.000567105, 4.3985e-08, 1, -2.51784e-05, -1, 2.97105e-08, -4.65661e-10, 7.21041, 2.06458)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="XROrigin3D" type="XROrigin3D" parent="."]
|
||||
|
@ -76,16 +74,16 @@ min_camera_height = 0.01
|
|||
xr_origin = NodePath("../XROrigin3D")
|
||||
|
||||
[node name="Menu" parent="." instance=ExtResource("8_du83w")]
|
||||
transform = Transform3D(0.999998, -0.000514899, -6.55874e-05, 1.96975e-05, 0.163911, -0.986474, 0.000518685, 0.986474, 0.163911, -0.0165588, 0.796337, -0.634317)
|
||||
transform = Transform3D(0.999999, -1.39633e-11, 0, 1.60657e-10, 1, -4.54747e-13, 0, 0, 0.999999, -0.0165677, 0.766337, -0.634317)
|
||||
|
||||
[node name="Keyboard" parent="." instance=ExtResource("9_e5n3p")]
|
||||
transform = Transform3D(0.499999, -0.000139169, -6.50204e-05, 5.24307e-05, 0.353553, -0.353553, 0.000144383, 0.353553, 0.353553, -0.0199266, 0.550784, -0.47368)
|
||||
transform = Transform3D(0.5, 5.24309e-05, 0.000144384, -0.000139169, 0.353553, 0.353553, -6.50204e-05, -0.353553, 0.353553, -0.0199266, 0.550784, -0.47368)
|
||||
|
||||
[node name="Rooms" type="Node3D" parent="."]
|
||||
|
||||
[node name="House" parent="." instance=ExtResource("9_np6mw")]
|
||||
|
||||
[node name="Onboarding" parent="." instance=ExtResource("12_uq2nj")]
|
||||
transform = Transform3D(0.999999, -1.39632e-11, 0, 9.48097e-12, 0.999999, 0, 0, 0, 0.999999, -0.529594, 0.820154, -0.600147)
|
||||
transform = Transform3D(1, -1.39636e-11, 0, 4.42413e-11, 1, 0, 0, 0, 1, -0.576793, 0.820168, -0.60016)
|
||||
|
||||
[editable path="XROrigin3D/XRControllerLeft"]
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var menu_button = $Menu
|
||||
@onready var mini_button = $Mini
|
||||
@onready var clock = $Clock
|
||||
@onready var main = $"/root/Main"
|
||||
|
||||
func _ready():
|
||||
menu_button.on_button_down.connect(func():
|
||||
main.toggle_menu()
|
||||
)
|
||||
|
||||
mini_button.on_button_down.connect(func():
|
||||
House.body.mini_view = !House.body.mini_view
|
||||
)
|
|
@ -1,23 +0,0 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bexxngoxcegul"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/system/armband/armband.gd" id="1_4tskg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_egcvm"]
|
||||
|
||||
[node name="Armband" type="Node3D"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
script = ExtResource("1_4tskg")
|
||||
|
||||
[node name="Menu" parent="." instance=ExtResource("1_egcvm")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.04, 0, 0.04)
|
||||
label = "menu"
|
||||
icon = true
|
||||
|
||||
[node name="Mini" parent="." instance=ExtResource("1_egcvm")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, 0, 0.04)
|
||||
label = "view_comfy"
|
||||
icon = true
|
||||
|
||||
[node name="Clock" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 4.37114e-08, 4.37114e-08, -4.37114e-08, -4.37114e-08, 1, 4.37114e-08, -1, -4.37114e-08, 0, 0.02, -0.02)
|
||||
pixel_size = 0.001
|
||||
text = "10:00"
|
|
@ -26,6 +26,10 @@ func _ready():
|
|||
var index = AudioServer.get_bus_index("Record")
|
||||
effect = AudioServer.get_bus_effect(index, 0)
|
||||
|
||||
chat_assistant.visible = false
|
||||
chat_user.visible = false
|
||||
loader.visible = false
|
||||
|
||||
if !HomeApi.has_connected():
|
||||
await HomeApi.on_connect
|
||||
|
||||
|
@ -91,6 +95,9 @@ func finish():
|
|||
loader.visible = false
|
||||
|
||||
func _process(_delta):
|
||||
if voice_assistant == null:
|
||||
return
|
||||
|
||||
var sterioData: PackedVector2Array = effect.get_buffer(effect.get_frames_available())
|
||||
|
||||
if sterioData.size() == 0:
|
||||
|
|
|
@ -119,3 +119,4 @@ libraries = {
|
|||
}
|
||||
|
||||
[node name="Raycast" parent="." instance=ExtResource("4_n7lao")]
|
||||
is_right = false
|
||||
|
|
|
@ -34,7 +34,7 @@ func _ready():
|
|||
)
|
||||
|
||||
func _on_click(_event: EventPointer):
|
||||
if entity.has_method("quick_action"):
|
||||
if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false:
|
||||
entity.quick_action()
|
||||
else:
|
||||
miniature.entity_select.toggle(entity)
|
||||
|
@ -61,7 +61,7 @@ func _on_touch_move(_event: EventTouch):
|
|||
func _on_touch_leave(_event: EventTouch):
|
||||
if touch_ran: return
|
||||
|
||||
if entity.has_method("quick_action"):
|
||||
if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false:
|
||||
entity.quick_action()
|
||||
else:
|
||||
miniature.entity_select.toggle(entity)
|
|
@ -17,10 +17,12 @@ const Miniature = preload ("res://content/system/house/mini/miniature.gd")
|
|||
@onready var humidity_button = $XRHandLeft/Palm/QuickActions/Humidity
|
||||
@export var ray_left: RayCast3D
|
||||
@export var ray_right: RayCast3D
|
||||
var initiator: Initiator = Initiator.new()
|
||||
var left_initiator: Initiator = Initiator.new()
|
||||
var right_initiator: Initiator = Initiator.new()
|
||||
var touch: Touch
|
||||
var collide: Collide
|
||||
var pointer: Pointer
|
||||
var left_pointer: Pointer
|
||||
var right_pointer: Pointer
|
||||
var press_distance = 0.03
|
||||
var grip_distance = 0.03
|
||||
var close_distance = 0.1
|
||||
|
@ -43,7 +45,7 @@ func _ready():
|
|||
add_child(touch)
|
||||
add_child(collide)
|
||||
|
||||
_ready_hand(hand_right)
|
||||
_ready_hand()
|
||||
|
||||
mini_view_button.on_button_up.connect(func():
|
||||
House.body.mini_view.small.value=!House.body.mini_view.small.value
|
||||
|
@ -63,12 +65,18 @@ func _ready():
|
|||
House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.HUMIDITY
|
||||
)
|
||||
|
||||
func _ready_hand(hand: OpenXRHand):
|
||||
initiator.type = Initiator.Type.HAND_RIGHT if hand == hand_right else Initiator.Type.HAND_LEFT
|
||||
initiator.node = ray_left.get_parent() if hand == hand_left else ray_right.get_parent()
|
||||
func _ready_hand():
|
||||
left_initiator.type = Initiator.Type.HAND_LEFT
|
||||
left_initiator.node = ray_left.get_parent()
|
||||
|
||||
pointer = Pointer.new(initiator, ray_left if hand == hand_left else ray_right)
|
||||
add_child(pointer)
|
||||
left_pointer = Pointer.new(left_initiator, ray_left)
|
||||
add_child(left_pointer)
|
||||
|
||||
right_initiator.type = Initiator.Type.HAND_RIGHT
|
||||
right_initiator.node = ray_right.get_parent()
|
||||
|
||||
right_pointer = Pointer.new(right_initiator, ray_right)
|
||||
add_child(right_pointer)
|
||||
|
||||
func _process(_delta):
|
||||
if main.camera.global_transform.basis.z.dot(palm.global_transform.basis.y) > 0.85:
|
||||
|
@ -86,6 +94,7 @@ func _process_hand(hand: OpenXRHand):
|
|||
var middle_tip = hand.get_node("MiddleTip/Marker3D")
|
||||
|
||||
var _ray = ray_left if hand == hand_left else ray_right
|
||||
var initiator = left_initiator if hand == hand_left else right_initiator
|
||||
|
||||
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
|
||||
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
|
||||
|
@ -113,12 +122,12 @@ func _process_hand(hand: OpenXRHand):
|
|||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
||||
grabbed_left = false
|
||||
else:
|
||||
if trigger_close&&!grabbed_right:
|
||||
if trigger_close&&!grabbed_left:
|
||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
||||
grabbed_right = true
|
||||
elif !trigger_close&&grabbed_right:
|
||||
grabbed_left = true
|
||||
elif !trigger_close&&grabbed_left:
|
||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
||||
grabbed_right = false
|
||||
grabbed_left = false
|
||||
else:
|
||||
if !distance_close:
|
||||
if trigger_close&&!pressed_right:
|
||||
|
|
|
@ -84,7 +84,7 @@ shape = SubResource("CapsuleShape3D_dopke")
|
|||
transform = Transform3D(-0.707107, -8.74228e-08, -0.707107, 6.18173e-08, -1, 6.18173e-08, -0.707107, -8.29045e-24, 0.707107, 0.01, -0.04, -5.58794e-09)
|
||||
|
||||
[node name="QuickActions" type="Node3D" parent="XRHandLeft/Palm"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
transform = Transform3D(0.5, -4.47035e-08, -4.37114e-08, 4.37114e-08, -2.18557e-08, 0.5, -4.47035e-08, -0.5, -2.18557e-08, 0.005, 0, 0.005)
|
||||
|
||||
[node name="MiniView" parent="XRHandLeft/Palm/QuickActions" instance=ExtResource("3_te2p8")]
|
||||
transform = Transform3D(1, -3.55271e-15, -4.33681e-19, 3.55271e-15, 1, 3.5525e-15, -4.33681e-19, -3.55291e-15, 1, -0.0600001, 0, 0)
|
||||
|
|
|
@ -50,6 +50,9 @@ func get_new_transform():
|
|||
func update_align_reference():
|
||||
corner1.global_position = Store.house.state.align_position1
|
||||
corner2.global_position = Store.house.state.align_position2
|
||||
|
||||
if corner1.global_position == corner2.global_position:
|
||||
corner2.global_position = corner1.global_position + Vector3(1, 0, 0)
|
||||
|
||||
corner2.look_at(corner1.global_position, Vector3.UP)
|
||||
corner2.rotate(Vector3.UP, deg_to_rad( - 90))
|
||||
|
|
|
@ -4,17 +4,20 @@ const DotScene = preload ("res://content/system/dot/dot.tscn")
|
|||
const Entity = preload ("res://content/entities/entity.gd")
|
||||
|
||||
@onready var dots = $"../Small/Dots"
|
||||
@onready var main = $"/root/Main"
|
||||
|
||||
var active_type = null
|
||||
var editing = R.state([])
|
||||
var group_entity = null
|
||||
|
||||
var house_small = null
|
||||
|
||||
func _ready():
|
||||
await House.body.ready
|
||||
|
||||
# Update Group Entity
|
||||
R.effect(func(_arg):
|
||||
if editing.value.size() == 0:
|
||||
if house_small.value == false||editing.value.size() == 0:
|
||||
if group_entity != null:
|
||||
group_entity.queue_free()
|
||||
group_entity=null
|
||||
|
@ -23,7 +26,9 @@ func _ready():
|
|||
group_entity=EntityFactory.create_entity(id, active_type)
|
||||
for entity_node in group_entity.get_children():
|
||||
if entity_node is Movable:
|
||||
group_entity.remove_child(entity_node)
|
||||
entity_node.disabled=true
|
||||
|
||||
group_entity.transform=Transform3D().looking_at(to_local((main.camera.global_position)), Vector3.UP, true)
|
||||
add_child(group_entity)
|
||||
else:
|
||||
HomeApi.groups.update_entities(group_entity.entity_id, editing.value.map(func(entity): return entity.entity_id))
|
||||
|
@ -58,6 +63,9 @@ func _ready():
|
|||
dots.add_child(dot)
|
||||
)
|
||||
|
||||
func selection_active():
|
||||
return editing.value.size() > 0
|
||||
|
||||
func toggle(entity: Entity):
|
||||
if active_type == null:
|
||||
active_type = entity.entity_id.split(".")[0]
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
[ext_resource type="Texture2D" uid="uid://bbuq4wn7e5o2q" path="res://content/system/house/mini/temp_gradient.tres" id="2_3lwi8"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
render_priority = 10
|
||||
shader = ExtResource("1_sbr3e")
|
||||
shader_parameter/data = PackedFloat32Array()
|
||||
shader_parameter/data_size = 0
|
||||
shader_parameter/alpha = 0.3
|
||||
shader_parameter/roughness = 0.15
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/color_gradient = ExtResource("2_3lwi8")
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_opaque, cull_disabled, diffuse_lambert, specular_schlick_ggx, unshaded;
|
||||
render_mode blend_mix, depth_draw_opaque, cull_disabled, diffuse_burley, specular_schlick_ggx, shadows_disabled;
|
||||
|
||||
uniform vec4 data[100];
|
||||
uniform int data_size: hint_range(0, 100, 1);
|
||||
uniform float alpha: hint_range(0.0, 1.0, 0.1) = 0.3;
|
||||
uniform sampler2D color_gradient;
|
||||
|
||||
uniform float roughness : hint_range(0.0, 1.0) = 0.15;
|
||||
uniform vec4 edge_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
varying vec3 color;
|
||||
|
||||
float simple_weight(int index, vec3 world_pos, float p) {
|
||||
|
@ -17,6 +20,12 @@ float sphere_weight(int index, vec3 world_pos, float r) {
|
|||
return pow(max(0, r - dist) / (r * dist), 2);
|
||||
}
|
||||
|
||||
float SchlickFresnel(float u) {
|
||||
float m = 1.0 - u;
|
||||
float m2 = m * m;
|
||||
return m2 * m2 * m;
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
color = vec3(1.0, 1.0, 1.0);
|
||||
|
||||
|
@ -60,4 +69,15 @@ void vertex() {
|
|||
void fragment() {
|
||||
ALBEDO = vec3(color.xyz);
|
||||
ALPHA = alpha;
|
||||
}
|
||||
|
||||
float VdotN = dot(VIEW, NORMAL);
|
||||
float fresnel = clamp(SchlickFresnel(VdotN), 0.0, 1.0);
|
||||
|
||||
// apply glass look
|
||||
float a = mix(0.001, 1.0, ALPHA);
|
||||
ALPHA = mix(fresnel * edge_color.a, 1.0, a);
|
||||
ALBEDO = mix(edge_color.rgb * edge_color.a, ALBEDO, a);
|
||||
ROUGHNESS = roughness;
|
||||
SPECULAR = 0.5 * inversesqrt(ALPHA);
|
||||
DEPTH = FRAGCOORD.z - 0.00001;
|
||||
}
|
|
@ -9,7 +9,6 @@ const temperature_gradient = preload ("./temp_gradient.tres")
|
|||
@onready var small_node = $Body/Small
|
||||
@onready var model = $Body/Small/Model
|
||||
@onready var collision_shape = $Body/CollisionShape3D
|
||||
@onready var toggle_heatmap = $Body/HeatmapButton
|
||||
@onready var entity_select = $Body/EntitySelect
|
||||
|
||||
enum HeatmapType {
|
||||
|
@ -38,6 +37,8 @@ func _ready():
|
|||
wall_material.set_shader_parameter("data", [])
|
||||
wall_material.set_shader_parameter("data_size", 0)
|
||||
|
||||
entity_select.house_small = small
|
||||
|
||||
if Store.house.is_loaded() == false:
|
||||
await Store.house.on_loaded
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ script = ExtResource("1_b53yn")
|
|||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
|
||||
shape = SubResource("BoxShape3D_bckw3")
|
||||
disabled = true
|
||||
|
||||
[node name="Movable" type="Node" parent="Body"]
|
||||
script = ExtResource("2_x7oed")
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://bswgmclohuqui"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://bswgmclohuqui"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/system/house/room/room.gd" id="1_fccq0"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="1_ugebq"]
|
||||
[ext_resource type="Material" uid="uid://bbx6fv7jq50tr" path="res://content/system/house/room/wall.tres" id="3_w4vos"]
|
||||
[ext_resource type="Script" path="res://lib/utils/state_machine/state_machine.gd" id="4_nbbo6"]
|
||||
[ext_resource type="Script" path="res://content/system/house/room/states/view.gd" id="6_g066t"]
|
||||
[ext_resource type="Script" path="res://content/system/house/room/states/edit.gd" id="7_ap14h"]
|
||||
|
@ -25,8 +26,10 @@ shape = SubResource("WorldBoundaryShape3D_08sv0")
|
|||
script = ExtResource("1_ugebq")
|
||||
|
||||
[node name="WallMesh" type="MeshInstance3D" parent="."]
|
||||
material_override = ExtResource("3_w4vos")
|
||||
|
||||
[node name="CeilingMesh" type="MeshInstance3D" parent="."]
|
||||
material_override = ExtResource("3_w4vos")
|
||||
|
||||
[node name="WallCollision" type="StaticBody3D" parent="."]
|
||||
collision_layer = 24
|
||||
|
|
|
@ -8,9 +8,6 @@ func _on_enter():
|
|||
if room_store == null||room_store.corners.size() < 3:
|
||||
return
|
||||
|
||||
room.wall_mesh.visible = false
|
||||
room.ceiling_mesh.visible = false
|
||||
|
||||
room.wall_mesh.mesh = Room.generate_wall_mesh(room_store)
|
||||
|
||||
if room.wall_mesh.mesh == null:
|
||||
|
@ -38,3 +35,5 @@ func _on_leave():
|
|||
room.room_floor.get_node("CollisionShape3D").disabled = true
|
||||
|
||||
room.wall_collision.shape = null
|
||||
room.wall_mesh.mesh = null
|
||||
room.ceiling_mesh.mesh = null
|
|
@ -1,6 +1,8 @@
|
|||
[gd_resource type="StandardMaterial3D" format=3 uid="uid://bbx6fv7jq50tr"]
|
||||
|
||||
[resource]
|
||||
transparency = 1
|
||||
render_priority = -100
|
||||
blend_mode = 2
|
||||
cull_mode = 2
|
||||
albedo_color = Color(1, 1, 1, 0)
|
||||
depth_draw_mode = 1
|
||||
shading_mode = 0
|
||||
|
|
|
@ -71,6 +71,7 @@ func create_key(key: Key):
|
|||
var key_node = button_scene.instantiate()
|
||||
|
||||
key_node.label = EventKey.key_to_string(key, caps)
|
||||
key_node.size = Vector3(0.05, 0.05, 0.01)
|
||||
key_node.focusable = false
|
||||
key_node.font_size = 32
|
||||
key_node.echo = true
|
||||
|
|
|
@ -4,60 +4,72 @@
|
|||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_xdpwr"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/grid_container/grid_container.gd" id="3_mx544"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_86fct"]
|
||||
[ext_resource type="Material" uid="uid://bnwimm214q67g" path="res://assets/materials/sec-500.material" id="5_8c8rc"]
|
||||
[ext_resource type="Script" path="res://content/functions/occludable.gd" id="6_y4sdl"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="5_0dbg6"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_k5ib7"]
|
||||
size = Vector3(0.79, 0.01, 0.26)
|
||||
size = Vector3(0.86, 0.27, 0.02)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_7rntc"]
|
||||
size = Vector3(0.79, 0.01, 0.26)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_x72nd"]
|
||||
render_priority = 19
|
||||
shader = ExtResource("5_0dbg6")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.86, 0.27)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_88pdc"]
|
||||
size = Vector2(0.86, 0.27)
|
||||
|
||||
[node name="Keyboard" type="StaticBody3D" groups=["ui_focus_stop"]]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_maojw")
|
||||
|
||||
[node name="Backspace" parent="." instance=ExtResource("1_xdpwr")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.349964, 0, -0.0700361)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.38, 0.09, 0)
|
||||
focusable = false
|
||||
label = "backspace"
|
||||
icon = true
|
||||
echo = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
metadata/key = 4194308
|
||||
|
||||
[node name="Caps" parent="." instance=ExtResource("1_xdpwr")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.370036, 0, 0.059964)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.39, -0.03, 0)
|
||||
focusable = false
|
||||
label = "keyboard_capslock"
|
||||
icon = true
|
||||
toggleable = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="Paste" parent="." instance=ExtResource("1_xdpwr")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.349964, 0, 0.089964)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.38, -0.09, 0)
|
||||
focusable = false
|
||||
label = "assignment"
|
||||
icon = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="Keys" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.310036, 0, -0.090036)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.325, 0.09, 0)
|
||||
script = ExtResource("3_mx544")
|
||||
columns = 11
|
||||
depth_gap = 0.06
|
||||
size = Vector3(0.6, 1, 1)
|
||||
gaps = Vector2(0.01, 0.01)
|
||||
size = Vector3(0.6, 0.15, 1)
|
||||
|
||||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("4_86fct")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0093171, -0.009645, 0.00284005)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.01)
|
||||
shape = SubResource("BoxShape3D_k5ib7")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0093171, -0.009645, 0.00284005)
|
||||
material_override = ExtResource("5_8c8rc")
|
||||
mesh = SubResource("BoxMesh_7rntc")
|
||||
|
||||
[node name="Occludable" type="Node" parent="."]
|
||||
script = ExtResource("6_y4sdl")
|
||||
material_override = SubResource("ShaderMaterial_x72nd")
|
||||
mesh = SubResource("QuadMesh_88pdc")
|
||||
|
|
|
@ -31,6 +31,7 @@ lower_fade = 0.000919435
|
|||
[node name="CursorSprite" type="Sprite3D" parent="Cursor"]
|
||||
transform = Transform3D(0.03, 2.71051e-20, 0, -5.42101e-20, 0.03, -2.03288e-21, -2.46521e-33, 2.5411e-21, 0.03, 0, 0, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 90
|
||||
texture = ExtResource("1_2f2iv")
|
||||
|
||||
[node name="Ray" type="MeshInstance3D" parent="."]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@tool
|
||||
|
||||
extends Node3D
|
||||
extends Container3D
|
||||
class_name Button3D
|
||||
|
||||
signal on_button_down()
|
||||
|
@ -12,8 +12,13 @@ const ECHO_WAIT_INITIAL = 0.5
|
|||
const ECHO_WAIT_REPEAT = 0.1
|
||||
|
||||
@onready var body: StaticBody3D = $Body
|
||||
@onready var panel: Panel3D = $Body/Panel3D
|
||||
@onready var collision: CollisionShape3D = $Body/CollisionShape3D
|
||||
@onready var label_node: Label3D = $Body/Label
|
||||
@onready var finger_area: Area3D = $FingerArea
|
||||
@onready var finger_area_collision: CollisionShape3D = $FingerArea/CollisionShape3D
|
||||
@onready var touch_collision: CollisionShape3D = $TouchBody/CollisionShape3D
|
||||
@onready var touch: StaticBody3D = $TouchBody
|
||||
|
||||
@export var focusable: bool = true:
|
||||
set(value):
|
||||
|
@ -42,19 +47,26 @@ const ECHO_WAIT_REPEAT = 0.1
|
|||
|
||||
if icon:
|
||||
label_node.font = IconFont
|
||||
label_node.font_size = 36
|
||||
label_node.font_size = size.x / 0.05 * 36
|
||||
label_node.width = 1000
|
||||
label_node.autowrap_mode = TextServer.AUTOWRAP_OFF
|
||||
else:
|
||||
label_node.font = null
|
||||
label_node.font_size = font_size
|
||||
label_node.width = 50
|
||||
label_node.width = size.x / label_node.pixel_size
|
||||
label_node.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
|
||||
@export var toggleable: bool = false
|
||||
@export var disabled: bool = false
|
||||
@export var echo: bool = false
|
||||
@export var initial_active: bool = false
|
||||
@export var initial_active: bool = false:
|
||||
set(value):
|
||||
if initial_active == value:
|
||||
return
|
||||
|
||||
initial_active = value
|
||||
if !is_inside_tree(): return
|
||||
update_animation(1.0 if initial_active else 0.0)
|
||||
|
||||
var active: bool = false:
|
||||
set(value):
|
||||
|
@ -64,6 +76,7 @@ var active: bool = false:
|
|||
on_toggled.emit(value)
|
||||
active = value
|
||||
if !is_inside_tree(): return
|
||||
panel.active = active
|
||||
update_animation(1.0 if active else 0.0)
|
||||
|
||||
var echo_timer: Timer = null
|
||||
|
@ -72,6 +85,8 @@ func _ready():
|
|||
if initial_active:
|
||||
active = true
|
||||
|
||||
_update()
|
||||
|
||||
Update.props(self, ["active", "external_value", "icon", "label", "font_size", "disabled"])
|
||||
|
||||
if echo:
|
||||
|
@ -92,8 +107,8 @@ func update_animation(value: float):
|
|||
var tween = create_tween()
|
||||
tween.set_parallel(true)
|
||||
|
||||
tween.tween_property(body, "scale:y", lerpf(1.0, 0.5, value), 0.2)
|
||||
tween.tween_property(body, "position:y", lerpf(0.01, 0.005, value), 0.2)
|
||||
tween.tween_property(body, "scale:z", lerpf(1.0, 0.5, value), 0.2)
|
||||
tween.tween_property(body, "position:z", lerpf(size.z / 2, size.z / 4, value), 0.2)
|
||||
|
||||
func _on_press_down(event):
|
||||
if disabled:
|
||||
|
@ -131,6 +146,15 @@ func _on_press_up(event):
|
|||
active = false
|
||||
on_button_up.emit()
|
||||
|
||||
func _on_ray_enter(_event: EventPointer):
|
||||
if disabled:
|
||||
return
|
||||
|
||||
panel.hovering = true
|
||||
|
||||
func _on_ray_leave(_event: EventPointer):
|
||||
panel.hovering = false
|
||||
|
||||
func _on_touch_enter(event: EventTouch):
|
||||
if event.target != finger_area:
|
||||
return
|
||||
|
@ -181,12 +205,25 @@ func _touch_change(event: EventTouch):
|
|||
var pos = Vector3(0, 1, 0)
|
||||
for finger in event.fingers:
|
||||
var finger_pos = to_local(finger.area.global_position)
|
||||
if pos.y > finger_pos.y:
|
||||
if pos.z > finger_pos.z:
|
||||
pos = finger_pos
|
||||
|
||||
var button_height = 0.2
|
||||
var button_center = 0.1
|
||||
|
||||
var percent = clamp((button_center + button_height / 2 - pos.y) / (button_height / 2), 0, 1)
|
||||
var percent = clamp((button_center + button_height / 2 - pos.z) / (button_height / 2), 0, 1)
|
||||
|
||||
update_animation(percent)
|
||||
|
||||
func _update():
|
||||
body.position = Vector3(0, 0, size.z / 2)
|
||||
finger_area.position = Vector3(0, 0, -0.015)
|
||||
touch.position = Vector3(0, 0, size.z / 2)
|
||||
|
||||
panel.size = Vector2(size.x, size.y)
|
||||
panel.position = Vector3(0, 0, size.z / 2)
|
||||
collision.shape.size = Vector3(size.x, size.y, size.z)
|
||||
label_node.width = size.x / label_node.pixel_size
|
||||
label_node.position = Vector3(0, 0, size.z / 2 + 0.001)
|
||||
|
||||
finger_area_collision.shape.size = Vector3(size.x, size.y, 0.03)
|
BIN
app/content/ui/components/button/button.material.depren
Normal file
BIN
app/content/ui/components/button/button.material.depren
Normal file
Binary file not shown.
|
@ -1,59 +1,80 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://bsjqdvkt0u87c"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://bsjqdvkt0u87c"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://iv4lk77axlk4" path="res://assets/immersive_home/button.obj" id="2_cve3l"]
|
||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_wx7av"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_db5by"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="3_skm86"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_tulmb"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 10
|
||||
shader = ExtResource("2_db5by")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(1, 1)
|
||||
shader_parameter/border_size = 0.01
|
||||
shader_parameter/border_fade_in = 0.05
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.2
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_hvywi"]
|
||||
size = Vector2(0.04, 0.04)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"]
|
||||
size = Vector3(0.05, 0.02, 0.05)
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.04, 0.04, 0.01)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_bqjii"]
|
||||
size = Vector3(0.0501598, 0.0390937, 0.0501598)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_vkbuh"]
|
||||
size = Vector3(0.05, 0.03, 0.05)
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.04, 0.04, 0.03)
|
||||
|
||||
[node name="Button" type="Node3D" groups=["ui_focus"]]
|
||||
script = ExtResource("1_74x7g")
|
||||
label = "Example Text"
|
||||
size = Vector3(0.04, 0.04, 0.01)
|
||||
|
||||
[node name="Body" type="StaticBody3D" parent="." groups=["ui_focus_skip"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
collision_layer = 2
|
||||
collision_mask = 0
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Body"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.005, 0)
|
||||
material_override = ExtResource("2_wx7av")
|
||||
mesh = ExtResource("2_cve3l")
|
||||
[node name="Panel3D" type="MeshInstance3D" parent="Body"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
material_override = SubResource("ShaderMaterial_tulmb")
|
||||
mesh = SubResource("QuadMesh_hvywi")
|
||||
skeleton = NodePath("../..")
|
||||
script = ExtResource("3_skm86")
|
||||
size = Vector2(0.04, 0.04)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
|
||||
shape = SubResource("BoxShape3D_xwopm")
|
||||
|
||||
[node name="Label" type="Label3D" parent="Body"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.0107199, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.006)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 30
|
||||
text = "Example Text"
|
||||
font_size = 10
|
||||
outline_size = 0
|
||||
autowrap_mode = 3
|
||||
width = 50.0
|
||||
width = 40.0
|
||||
|
||||
[node name="FingerArea" type="Area3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0101447, 0)
|
||||
[node name="FingerArea" type="Area3D" parent="." groups=["ui_focus_skip"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.015)
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="FingerArea"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.00975001, 0)
|
||||
shape = SubResource("BoxShape3D_bqjii")
|
||||
|
||||
[node name="TouchBody" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TouchBody"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.005, 0)
|
||||
shape = SubResource("BoxShape3D_vkbuh")
|
||||
shape = SubResource("BoxShape3D_xwopm")
|
||||
|
|
BIN
app/content/ui/components/button/button_active.material.depren
Normal file
BIN
app/content/ui/components/button/button_active.material.depren
Normal file
Binary file not shown.
|
@ -1,15 +1,18 @@
|
|||
@tool
|
||||
|
||||
extends Node3D
|
||||
class_name Container3D
|
||||
|
||||
@export var size := Vector3(1.0, 1.0, 1.0) :
|
||||
@export var size := Vector3(1.0, 1.0, 1.0):
|
||||
set(value):
|
||||
size = value
|
||||
_update_container()
|
||||
size = Vector3(max(0, value.x), max(0, value.y), max(0, value.z))
|
||||
|
||||
@export var padding: Vector4 = Vector4(0, 0, 0, 0) :
|
||||
set(value):
|
||||
padding = value
|
||||
_update_container()
|
||||
if !is_inside_tree(): return
|
||||
|
||||
func _update_container():
|
||||
_update()
|
||||
|
||||
func _ready():
|
||||
_update()
|
||||
|
||||
func _update():
|
||||
pass
|
100
app/content/ui/components/flex_container/flex_container.gd
Normal file
100
app/content/ui/components/flex_container/flex_container.gd
Normal file
|
@ -0,0 +1,100 @@
|
|||
@tool
|
||||
extends Container3D
|
||||
class_name FlexContainer3D
|
||||
|
||||
enum Justification {
|
||||
START,
|
||||
CENTER,
|
||||
END,
|
||||
SPACE_BETWEEN,
|
||||
SPACE_AROUND,
|
||||
SPACE_EVENLY,
|
||||
}
|
||||
|
||||
@export var justification: Justification = Justification.START:
|
||||
set(value):
|
||||
justification = value
|
||||
_update()
|
||||
@export var vertical: bool = false:
|
||||
set(value):
|
||||
vertical = value
|
||||
_update()
|
||||
@export var gap: float = 0.0:
|
||||
set(value):
|
||||
gap = value
|
||||
_update()
|
||||
|
||||
func _ready():
|
||||
_update()
|
||||
|
||||
func _update():
|
||||
var width = size.y if vertical else size.x
|
||||
var children_size := Vector2(0, 0)
|
||||
var child_count = 0
|
||||
|
||||
for child in get_children():
|
||||
if child is Container3D == false:
|
||||
continue
|
||||
|
||||
if vertical:
|
||||
children_size.x = max(child.size.x, children_size.x)
|
||||
children_size.y += child.size.y + gap
|
||||
else:
|
||||
children_size.x += child.size.x + gap
|
||||
children_size.y = max(child.size.y, children_size.y)
|
||||
|
||||
child_count += 1
|
||||
|
||||
if child_count == 0:
|
||||
return
|
||||
|
||||
var children_scale = Vector2(size.x, size.y) / children_size
|
||||
children_size.clamp(Vector2(0, 0), Vector2(size.x, size.y))
|
||||
|
||||
children_scale = children_scale.clamp(Vector2(0.001, 0.001), Vector2(1, 1))
|
||||
|
||||
var offset = 0.0
|
||||
|
||||
var children_width = children_size.y if vertical else children_size.x
|
||||
|
||||
match justification:
|
||||
Justification.START:
|
||||
offset = 0.0
|
||||
Justification.CENTER:
|
||||
offset = (width - children_width) / 2.0
|
||||
Justification.END:
|
||||
offset = width - children_width
|
||||
Justification.SPACE_BETWEEN:
|
||||
offset = 0.0
|
||||
Justification.SPACE_AROUND:
|
||||
offset = (width - children_width) / child_count / 2.0
|
||||
Justification.SPACE_EVENLY:
|
||||
offset = (width - children_width) / (child_count + 1)
|
||||
|
||||
for child in get_children():
|
||||
if child is Container3D == false:
|
||||
continue
|
||||
|
||||
child.scale = Vector3(children_scale.x, children_scale.y, 1)
|
||||
|
||||
if vertical:
|
||||
var child_width = child.size.y * children_scale.y
|
||||
|
||||
child.position = Vector3(0, -offset - child_width / 2.0, 0)
|
||||
offset += child.size.y * children_scale.y
|
||||
else:
|
||||
var child_width = child.size.x * children_scale.x
|
||||
|
||||
child.position = Vector3(offset + child_width / 2.0, 0, 0)
|
||||
offset += child.size.x * children_scale.x
|
||||
|
||||
match justification:
|
||||
Justification.START, Justification.CENTER, Justification.END:
|
||||
offset += gap
|
||||
Justification.SPACE_BETWEEN:
|
||||
offset += (width - children_width) / (child_count - 1)
|
||||
Justification.SPACE_AROUND:
|
||||
offset += (width - children_width) / child_count
|
||||
Justification.SPACE_EVENLY:
|
||||
offset += (width - children_width) / (child_count + 1)
|
||||
|
|
@ -2,41 +2,46 @@
|
|||
extends Container3D
|
||||
class_name GridContainer3D
|
||||
|
||||
|
||||
@export var columns := 5 :
|
||||
@export var columns := 5:
|
||||
set(value):
|
||||
columns = value
|
||||
_update_container()
|
||||
_update()
|
||||
|
||||
@export var rows := 1 :
|
||||
@export var gaps := Vector2(0, 0):
|
||||
set(value):
|
||||
rows = value
|
||||
_update_container()
|
||||
|
||||
@export var depth_gap := 1.0 :
|
||||
set(value):
|
||||
depth_gap = value
|
||||
_update_container()
|
||||
gaps = value
|
||||
_update()
|
||||
|
||||
func _ready():
|
||||
_update_container()
|
||||
_update()
|
||||
|
||||
func get_gaps() -> Vector3:
|
||||
return Vector3(
|
||||
(float(size.x) / (columns - 1 )) if columns != 1 else 0.0,
|
||||
(float(size.y) / (rows - 1)) if rows != 1 else 0.0,
|
||||
depth_gap
|
||||
child_entered_tree.connect(func(_arg):
|
||||
_update()
|
||||
)
|
||||
|
||||
child_exiting_tree.connect(func(_arg):
|
||||
_update()
|
||||
)
|
||||
|
||||
func _update_container():
|
||||
var i := 0
|
||||
var gaps := get_gaps()
|
||||
child_order_changed.connect(func():
|
||||
_update()
|
||||
)
|
||||
|
||||
func _update():
|
||||
var column := 0
|
||||
var row_pos := 0.0
|
||||
var column_max_height := 0.0
|
||||
|
||||
for child in get_children():
|
||||
var x := (i % columns) * gaps.x
|
||||
var y := ((i / columns) % rows) * gaps.y
|
||||
var z := (i / (columns * rows)) * gaps.z
|
||||
if child is Container3D == false:
|
||||
continue
|
||||
|
||||
child.set_position(Vector3(x, -y, z))
|
||||
i += 1
|
||||
column_max_height = max(column_max_height, child.size.y)
|
||||
|
||||
child.position = Vector3(column * ((size.x / columns) + gaps.x), row_pos, 0)
|
||||
|
||||
column += 1
|
||||
if column >= columns:
|
||||
column = 0
|
||||
row_pos -= column_max_height + gaps.y
|
||||
|
|
@ -1,24 +1,15 @@
|
|||
@tool
|
||||
extends StaticBody3D
|
||||
extends Container3D
|
||||
class_name Input3D
|
||||
|
||||
var text_handler = preload ("res://content/ui/components/input/text_handler.gd").new()
|
||||
|
||||
@onready var caret: MeshInstance3D = $Label/Caret
|
||||
@onready var mesh_box: MeshInstance3D = $Box
|
||||
@onready var collision: CollisionShape3D = $Collision
|
||||
@onready var caret: MeshInstance3D = $Body/Label/Caret
|
||||
@onready var panel: Panel3D = $Body/Panel3D
|
||||
@onready var body: StaticBody3D = $Body
|
||||
@onready var collision: CollisionShape3D = $Body/Collision
|
||||
@onready var animation: AnimationPlayer = $AnimationPlayer
|
||||
@onready var label: Label3D = $Label
|
||||
|
||||
@export_range(0.1, 2, 0.01, "suffix:m") var width: float = 0.15:
|
||||
set(value):
|
||||
width = value
|
||||
text_handler.width = value
|
||||
if !is_inside_tree(): return
|
||||
|
||||
mesh_box.mesh.size.x = width
|
||||
collision.shape.size.x = width
|
||||
label.position.x = -width / 2 + 0.002
|
||||
@onready var label: Label3D = $Body/Label
|
||||
|
||||
@export var text: String:
|
||||
set(value):
|
||||
|
@ -38,7 +29,7 @@ var text_handler = preload ("res://content/ui/components/input/text_handler.gd")
|
|||
label.modulate = Color(0.7, 0.7, 0.7)
|
||||
add_to_group("ui_focus_skip")
|
||||
animation.stop()
|
||||
caret.hide()
|
||||
caret.visible = false
|
||||
else:
|
||||
label.modulate = Color(1, 1, 1)
|
||||
remove_from_group("ui_focus_skip")
|
||||
|
@ -48,10 +39,11 @@ var keyboard_input: bool = false
|
|||
var input_plane = Plane(Vector3.UP, Vector3.ZERO)
|
||||
|
||||
func _ready():
|
||||
Update.props(self, ["text", "disabled", "width"])
|
||||
|
||||
text_handler.label = label
|
||||
|
||||
Update.props(self, ["text", "disabled", "width"])
|
||||
_update()
|
||||
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
|
@ -112,13 +104,23 @@ func _on_press_move(event):
|
|||
caret.position.x = text_handler.get_caret_position()
|
||||
label.text = text_handler.get_display_text()
|
||||
|
||||
func _on_ray_enter(_event: EventPointer):
|
||||
if disabled:
|
||||
return
|
||||
|
||||
panel.hovering = true
|
||||
|
||||
func _on_ray_leave(_event: EventPointer):
|
||||
panel.hovering = false
|
||||
|
||||
func _on_focus_in(_event):
|
||||
if disabled:
|
||||
return
|
||||
|
||||
caret.position.x = text_handler.get_caret_position()
|
||||
label.text = text_handler.get_display_text()
|
||||
caret.show()
|
||||
caret.visible = true
|
||||
panel.active = true
|
||||
animation.play("blink")
|
||||
|
||||
func update_caret_position(event):
|
||||
|
@ -143,7 +145,8 @@ func _on_focus_out(_event):
|
|||
return
|
||||
|
||||
animation.stop()
|
||||
caret.hide()
|
||||
caret.visible = false
|
||||
panel.active = false
|
||||
|
||||
func _draw_debug_text_gaps():
|
||||
if text_handler.gap_offsets == null:
|
||||
|
@ -156,3 +159,12 @@ func _draw_debug_text_gaps():
|
|||
label.to_global(Vector3(offset, 0.01, 0)),
|
||||
Color(1, 0, 0) if i != text_handler.overflow_index else Color(0, 1, 0)
|
||||
)
|
||||
|
||||
func _update():
|
||||
text_handler.width = size.x
|
||||
panel.size = Vector2(size.x, size.y)
|
||||
panel.position.z = size.z / 2
|
||||
collision.shape.size = size
|
||||
label.position = Vector3( - size.x / 2 + 0.002, 0, size.z / 2)
|
||||
label.text = text_handler.get_display_text()
|
||||
body.position = Vector3(0, 0, size.z / 2)
|
|
@ -1,16 +1,34 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://blrhy2uccrdn4"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://blrhy2uccrdn4"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="1_0kd7r"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/input/input.gd" id="1_uml3t"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="3_3bvrj"]
|
||||
[ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="3_ij5fh"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_nl02b"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_kjbca"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_exbug"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.15, 0.006, 0.03)
|
||||
render_priority = 10
|
||||
shader = ExtResource("3_nl02b")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(3.75, 0.75)
|
||||
shader_parameter/border_size = 0.01
|
||||
shader_parameter/border_fade_in = 0.05
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.2
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_lemta"]
|
||||
size = Vector2(0.15, 0.03)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_x4yp8"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.15, 0.006, 0.03)
|
||||
size = Vector3(0.15, 0.03, 0.01)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_x1ra7"]
|
||||
shading_mode = 0
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_2736g"]
|
||||
size = Vector3(0.001, 0.02, 0.001)
|
||||
|
@ -52,36 +70,46 @@ _data = {
|
|||
"blink": SubResource("Animation_8ny1h")
|
||||
}
|
||||
|
||||
[node name="Input" type="StaticBody3D" groups=["ui_focus"]]
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
[node name="Input" type="Node3D" groups=["ui_focus"]]
|
||||
script = ExtResource("1_uml3t")
|
||||
text = "Example"
|
||||
text = "Example Text"
|
||||
size = Vector3(0.15, 0.03, 0.01)
|
||||
|
||||
[node name="Box" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.003, 0)
|
||||
material_override = ExtResource("1_0kd7r")
|
||||
mesh = SubResource("BoxMesh_kjbca")
|
||||
[node name="Body" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
collision_layer = 6
|
||||
collision_mask = 6
|
||||
|
||||
[node name="Collision" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.003, 0)
|
||||
[node name="Panel3D" type="MeshInstance3D" parent="Body"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
material_override = SubResource("ShaderMaterial_exbug")
|
||||
mesh = SubResource("QuadMesh_lemta")
|
||||
script = ExtResource("3_3bvrj")
|
||||
size = Vector2(0.15, 0.03)
|
||||
|
||||
[node name="Collision" type="CollisionShape3D" parent="Body"]
|
||||
shape = SubResource("BoxShape3D_x4yp8")
|
||||
|
||||
[node name="Label" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.073, 0.00618291, 0)
|
||||
[node name="Label" type="Label3D" parent="Body"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.073, 0, 0.005)
|
||||
pixel_size = 0.001
|
||||
text = "Example"
|
||||
double_sided = false
|
||||
render_priority = 30
|
||||
outline_render_priority = 29
|
||||
text = "Example Text"
|
||||
font = ExtResource("3_ij5fh")
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Caret" type="MeshInstance3D" parent="Label"]
|
||||
[node name="Caret" type="MeshInstance3D" parent="Body/Label"]
|
||||
visible = false
|
||||
material_override = SubResource("StandardMaterial3D_x1ra7")
|
||||
mesh = SubResource("BoxMesh_2736g")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
root_node = NodePath("../Body")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_1sy4t")
|
||||
}
|
||||
|
|
|
@ -5,7 +5,12 @@ const FontTools = preload ("res://lib/utils/font_tools.gd")
|
|||
var label: Label3D
|
||||
|
||||
var text: String = ""
|
||||
var width: float = 0.2
|
||||
var width: float = 0.2:
|
||||
set(value):
|
||||
width = max(0.0, value)
|
||||
gap_offsets = _calculate_text_gaps()
|
||||
overflow_index = _calculate_overflow_index()
|
||||
caret_position = 0
|
||||
var gap_offsets = null
|
||||
var overflow_index: int = -1
|
||||
var char_offset: int = 0
|
||||
|
@ -13,9 +18,6 @@ var caret_position: int = 3:
|
|||
set(value):
|
||||
caret_position = clampi(value, 0, text.length())
|
||||
|
||||
func set_width(value: float):
|
||||
width = value
|
||||
|
||||
func set_text(value: String, insert: bool=false):
|
||||
var old_text = text
|
||||
text = value
|
||||
|
|
32
app/content/ui/components/label_container/label_container.gd
Normal file
32
app/content/ui/components/label_container/label_container.gd
Normal file
|
@ -0,0 +1,32 @@
|
|||
@tool
|
||||
extends Container3D
|
||||
class_name LabelContainer3D
|
||||
|
||||
const FontTools = preload ("res://lib/utils/font_tools.gd")
|
||||
|
||||
@onready var label: Label3D = $Label3D
|
||||
|
||||
@export var text: String = "Example":
|
||||
set(value):
|
||||
text = value
|
||||
|
||||
if !is_inside_tree(): return
|
||||
|
||||
_update_text()
|
||||
|
||||
@export var font_size: int = 18:
|
||||
set(value):
|
||||
font_size = value
|
||||
|
||||
if !is_inside_tree(): return
|
||||
|
||||
_update_text()
|
||||
|
||||
func _ready():
|
||||
_update_text()
|
||||
|
||||
func _update_text():
|
||||
label.font_size = font_size
|
||||
label.text = text
|
||||
var text_size = FontTools.get_font_size(label)
|
||||
size = Vector3(text_size.x, text_size.y, 0.1)
|
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://blkfqa3ttk0d2"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/components/label_container/label_container.gd" id="1_hqtij"]
|
||||
[ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="2_6y3jl"]
|
||||
|
||||
[node name="LabelContainer" type="Node3D"]
|
||||
script = ExtResource("1_hqtij")
|
||||
size = Vector3(0.08, 0.023, 0.1)
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="."]
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Example"
|
||||
font = ExtResource("2_6y3jl")
|
||||
font_size = 18
|
||||
outline_size = 0
|
|
@ -10,7 +10,7 @@ cull_mode = 2
|
|||
shading_mode = 0
|
||||
albedo_color = Color(0.109804, 0.721569, 0.262745, 1)
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_mec1l"]
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_5xylt"]
|
||||
_surfaces = [{
|
||||
"aabb": AABB(-0.000587015, -0.000596339, 0.0005, 0.501171, 0.301189, 1e-05),
|
||||
"format": 34359742465,
|
||||
|
@ -43,7 +43,7 @@ script = ExtResource("1_n7fu8")
|
|||
|
||||
[node name="Line" type="MeshInstance3D" parent="."]
|
||||
material_override = SubResource("StandardMaterial3D_20gpn")
|
||||
mesh = SubResource("ArrayMesh_mec1l")
|
||||
mesh = SubResource("ArrayMesh_5xylt")
|
||||
|
||||
[node name="Plane" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, 0.15, -0.001)
|
||||
|
|
|
@ -1,15 +1,29 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://bqj7qwj5mgd30"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bqj7qwj5mgd30"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/components/notification/notification.gd" id="1_yw3yb"]
|
||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_5b8oo"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_b68od"]
|
||||
[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="3_1ljpc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_ocg5j"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_s37oj"]
|
||||
size = Vector3(0.25, 0.01, 0.05)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0ktvn"]
|
||||
render_priority = 10
|
||||
shader = ExtResource("2_b68od")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.25, 0.05)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.025
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_dx2yp"]
|
||||
size = Vector2(0.25, 0.05)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_m4d21"]
|
||||
size = Vector3(0.25, 0.01, 0.05)
|
||||
size = Vector3(0.25, 0.05, 0.01)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bkual"]
|
||||
length = 0.001
|
||||
|
@ -164,25 +178,30 @@ script = ExtResource("1_yw3yb")
|
|||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="AnimationNode"]
|
||||
material_override = ExtResource("2_5b8oo")
|
||||
mesh = SubResource("BoxMesh_s37oj")
|
||||
[node name="MeshInstance3D2" type="MeshInstance3D" parent="AnimationNode"]
|
||||
material_override = SubResource("ShaderMaterial_0ktvn")
|
||||
mesh = SubResource("QuadMesh_dx2yp")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="AnimationNode"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.005)
|
||||
shape = SubResource("BoxShape3D_m4d21")
|
||||
|
||||
[node name="Text" type="Label3D" parent="AnimationNode"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.08, 0.006, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.08, 0, 0.001)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
font_size = 10
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
autowrap_mode = 3
|
||||
width = 190.0
|
||||
width = 170.0
|
||||
|
||||
[node name="Icon" type="Label3D" parent="AnimationNode"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.1, 0.006, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1, 0, 0.001)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "info"
|
||||
font = ExtResource("3_1ljpc")
|
||||
font_size = 24
|
||||
|
@ -194,7 +213,7 @@ libraries = {
|
|||
}
|
||||
|
||||
[node name="Button" parent="AnimationNode" instance=ExtResource("4_ocg5j")]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.12, -0.003, -0.02)
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.1, 0, 0)
|
||||
label = "close"
|
||||
icon = true
|
||||
|
||||
|
|
109
app/content/ui/components/pagination/pagination.gd
Normal file
109
app/content/ui/components/pagination/pagination.gd
Normal file
|
@ -0,0 +1,109 @@
|
|||
@tool
|
||||
extends FlexContainer3D
|
||||
class_name Pagination3D
|
||||
|
||||
signal on_page_changed(page: int)
|
||||
|
||||
const ButtonScene = preload ("res://content/ui/components/button/button.tscn")
|
||||
const LabelScene = preload ("res://content/ui/components/label_container/label_container.tscn")
|
||||
|
||||
@onready var prev_button = $Prev
|
||||
@onready var next_button = $Next
|
||||
|
||||
@export var page: int = 0:
|
||||
set(value):
|
||||
if page == value: return
|
||||
|
||||
page = clamp(value, 0, pages - 1)
|
||||
_update()
|
||||
@export var pages: int = 5:
|
||||
set(value):
|
||||
if pages == value: return
|
||||
|
||||
pages = max(1, value)
|
||||
_update()
|
||||
@export var visible_pages: int = 5:
|
||||
set(value):
|
||||
if visible_pages == value: return
|
||||
|
||||
visible_pages = max(5, value)
|
||||
_update()
|
||||
|
||||
func _ready():
|
||||
_update()
|
||||
|
||||
prev_button.on_button_up.connect(func():
|
||||
page -= 1
|
||||
on_page_changed.emit(page)
|
||||
)
|
||||
|
||||
next_button.on_button_up.connect(func():
|
||||
page += 1
|
||||
on_page_changed.emit(page)
|
||||
)
|
||||
|
||||
func _update():
|
||||
if !is_node_ready(): return
|
||||
|
||||
for child in get_children():
|
||||
if child != prev_button&&child != next_button:
|
||||
remove_child(child)
|
||||
child.queue_free()
|
||||
|
||||
var display_pages = min(pages, visible_pages)
|
||||
var center_pos = floor(display_pages / 2)
|
||||
var start_dots = pages > visible_pages&&page > visible_pages - center_pos - 1
|
||||
var end_dots = pages > visible_pages&&page < pages - visible_pages + floor((display_pages - 1) / 2)
|
||||
|
||||
var at_start = page == 0
|
||||
prev_button.disabled = at_start
|
||||
prev_button.visible = !at_start
|
||||
|
||||
var at_end = page == pages - 1
|
||||
next_button.disabled = at_end
|
||||
next_button.visible = !at_end
|
||||
|
||||
prev_button.size = Vector3(size.y, size.y, size.z)
|
||||
next_button.size = Vector3(size.y, size.y, size.z)
|
||||
|
||||
for i in range(display_pages):
|
||||
if (start_dots&&i == 1)||(end_dots&&i == display_pages - 2):
|
||||
var container = Container3D.new()
|
||||
container.size = Vector3(size.y, size.y, size.z)
|
||||
add_child(container)
|
||||
move_child(container, -2)
|
||||
|
||||
var dots = LabelScene.instantiate()
|
||||
dots.text = "..."
|
||||
container.add_child(dots)
|
||||
continue
|
||||
|
||||
var button = ButtonScene.instantiate()
|
||||
button.size = Vector3(size.y, size.y, size.z)
|
||||
button.toggleable = true
|
||||
|
||||
if i == 0:
|
||||
button.label = "1"
|
||||
elif i == display_pages - 1:
|
||||
button.label = str(pages)
|
||||
elif pages <= visible_pages:
|
||||
button.label = str(i + 1)
|
||||
elif visible_pages % 2 == 1:
|
||||
button.label = str(clamp(page, center_pos, pages - 1 - center_pos) - center_pos + i + 1)
|
||||
else:
|
||||
button.label = str(clamp(page + 1, 3, pages - 3) - center_pos + i + 1)
|
||||
|
||||
button.on_button_down.connect(func():
|
||||
page=int(button.label) - 1
|
||||
on_page_changed.emit(page)
|
||||
)
|
||||
|
||||
if (int(button.label) - 1) == page:
|
||||
button.initial_active = true
|
||||
button.disabled = true
|
||||
|
||||
add_child(button)
|
||||
move_child(button, -2)
|
||||
|
||||
super._update()
|
||||
|
24
app/content/ui/components/pagination/pagination.tscn
Normal file
24
app/content/ui/components/pagination/pagination.tscn
Normal file
|
@ -0,0 +1,24 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bef3gamrm6at2"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/components/pagination/pagination.gd" id="1_3ylfj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="2_lsc4w"]
|
||||
|
||||
[node name="Pagination" type="Node3D"]
|
||||
script = ExtResource("1_3ylfj")
|
||||
page = 1
|
||||
pages = 4
|
||||
visible_pages = 7
|
||||
gap = 0.01
|
||||
size = Vector3(9.92, 0.05, 0.01)
|
||||
|
||||
[node name="Prev" parent="." instance=ExtResource("2_lsc4w")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.025, 0, 0)
|
||||
label = "navigate_before"
|
||||
icon = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="Next" parent="." instance=ExtResource("2_lsc4w")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.325, 0, 0)
|
||||
label = "navigate_next"
|
||||
icon = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
81
app/content/ui/components/panel/glass.gdshader
Normal file
81
app/content/ui/components/panel/glass.gdshader
Normal file
|
@ -0,0 +1,81 @@
|
|||
shader_type spatial;
|
||||
|
||||
render_mode diffuse_burley, specular_schlick_ggx, blend_mix, cull_disabled, shadows_disabled;
|
||||
|
||||
group_uniforms Color;
|
||||
uniform vec4 color : source_color = vec4(1.0, 1.0, 1.0, 0.3);
|
||||
uniform vec4 border_color : source_color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
uniform vec4 edge_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
group_uniforms Size;
|
||||
uniform vec2 size = vec2(1.0, 1.0);
|
||||
uniform float border_size: hint_range(0.0, 0.5) = 0.001;
|
||||
uniform float border_fade_in: hint_range(0.0, 0.5) = 0.005;
|
||||
uniform float border_fade_out: hint_range(0.0, 0.5) = 0.0;
|
||||
uniform float corner_radius = 0.04;
|
||||
|
||||
group_uniforms Roughness;
|
||||
uniform float roughness : hint_range(0.0, 1.0) = 0.3;
|
||||
uniform float grain_amount : hint_range(0.0, 1.0) = 0.02;
|
||||
|
||||
|
||||
float rectangle(vec2 position) {
|
||||
vec2 component_wise_edge_distance = abs(position) - (vec2(0.5, 0.5) * size + corner_radius * (size - 1.0));
|
||||
float outsideDistance = length(max(component_wise_edge_distance, 0));
|
||||
float insideDistance = min(max(component_wise_edge_distance.x, component_wise_edge_distance.y), 0);
|
||||
return outsideDistance + insideDistance;
|
||||
}
|
||||
|
||||
float SchlickFresnel(float u) {
|
||||
float m = 1.0 - u;
|
||||
float m2 = m * m;
|
||||
return m2 * m2 * m;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
|
||||
float VdotN = dot(VIEW, NORMAL);
|
||||
float fresnel = clamp(SchlickFresnel(VdotN), 0.0, 1.0);
|
||||
|
||||
ALBEDO = border_color.xyz;
|
||||
ALPHA = 0.0;
|
||||
float border_scale = 1.0 + 2.0 * corner_radius;
|
||||
float d = rectangle((UV - 0.5) * size * border_scale);
|
||||
float border_width = (border_size + border_fade_in + border_fade_out) * border_scale;
|
||||
|
||||
bool inside = false;
|
||||
|
||||
if (d >= corner_radius - border_width && d <= corner_radius) {
|
||||
// Border
|
||||
float rel_d = (d - corner_radius + border_width) / border_width;
|
||||
float alpha = min((rel_d / (border_fade_in * border_scale / border_width)), (1.0 - (rel_d)) / (border_fade_out * border_scale / border_width));
|
||||
if (d < corner_radius - (border_size + border_fade_out) * border_scale) {
|
||||
// Inner Fade
|
||||
ALBEDO = mix(color, border_color, alpha).xyz;
|
||||
ALPHA = mix(color.w, border_color.w, alpha);
|
||||
inside = true;
|
||||
} else {
|
||||
// Outer Fade
|
||||
ALBEDO = border_color.xyz;
|
||||
ALPHA = mix(0.0, border_color.w, alpha);
|
||||
}
|
||||
} else if (d < corner_radius - border_width ) {
|
||||
// Inside
|
||||
ALBEDO = color.xyz;
|
||||
ALPHA = color.w;
|
||||
inside = true;
|
||||
}
|
||||
|
||||
if (inside) {
|
||||
float a = mix(0.001, 1.0, ALPHA);
|
||||
ALPHA = mix(fresnel * edge_color.a, 1.0, a);
|
||||
ALBEDO = mix(edge_color.rgb * edge_color.a, ALBEDO.rgb, a);
|
||||
|
||||
ROUGHNESS = roughness;
|
||||
SPECULAR = 0.5 * inversesqrt(ALPHA);
|
||||
|
||||
float noise = (fract(sin(dot(UV, vec2(12.9898, 78.233))) * 43758.5453) - 0.5) * 2.0;
|
||||
|
||||
ALBEDO += noise * grain_amount;
|
||||
}
|
||||
}
|
67
app/content/ui/components/panel/panel.gd
Normal file
67
app/content/ui/components/panel/panel.gd
Normal file
|
@ -0,0 +1,67 @@
|
|||
@tool
|
||||
extends MeshInstance3D
|
||||
class_name Panel3D
|
||||
|
||||
const PanelMaterial = preload ("panel.material")
|
||||
|
||||
const COLOR = Color(1.0, 1.0, 1.0, 0.3)
|
||||
const BORDER_COLOR = Color(1.0, 1.0, 1.0, 1.0)
|
||||
const COLOR_ACTIVE = Color(0.949, 0.353, 0.22, 0.3)
|
||||
const BORDER_COLOR_ACTIVE = Color(0.949, 0.353, 0.22, 1.0)
|
||||
const COLOR_HOVER = Color(0.5, 0.5, 0.5, 0.3)
|
||||
const BORDER_COLOR_HOVER = Color(0.7, 0.7, 0.7, 1.0)
|
||||
|
||||
@export var hovering = false:
|
||||
set(value):
|
||||
hovering = value
|
||||
_update_style()
|
||||
|
||||
@export var active = false:
|
||||
set(value):
|
||||
active = value
|
||||
_update_style()
|
||||
|
||||
@export var size = Vector2(1, 1):
|
||||
set(value):
|
||||
size = value
|
||||
_update_size()
|
||||
|
||||
@export var corner_radius = 0.2:
|
||||
set(value):
|
||||
corner_radius = value
|
||||
_update_corner_radius()
|
||||
|
||||
@export var border = 0.6:
|
||||
set(value):
|
||||
border = value
|
||||
_update_border()
|
||||
|
||||
func _ready():
|
||||
mesh = QuadMesh.new()
|
||||
material_override = PanelMaterial.duplicate()
|
||||
_update_style()
|
||||
_update_size()
|
||||
_update_corner_radius()
|
||||
_update_border()
|
||||
|
||||
func _update_border():
|
||||
material_override.set_shader_parameter("border_size", border * 1.0 / 60.0)
|
||||
material_override.set_shader_parameter("border_fade_in", border * 5.0 / 60.0)
|
||||
|
||||
func _update_corner_radius():
|
||||
material_override.set_shader_parameter("corner_radius", corner_radius)
|
||||
|
||||
func _update_style():
|
||||
if active:
|
||||
material_override.set_shader_parameter("color", COLOR_ACTIVE)
|
||||
material_override.set_shader_parameter("border_color", BORDER_COLOR_ACTIVE)
|
||||
elif hovering:
|
||||
material_override.set_shader_parameter("color", COLOR_HOVER)
|
||||
material_override.set_shader_parameter("border_color", BORDER_COLOR_HOVER)
|
||||
else:
|
||||
material_override.set_shader_parameter("color", COLOR)
|
||||
material_override.set_shader_parameter("border_color", BORDER_COLOR)
|
||||
|
||||
func _update_size():
|
||||
mesh.size = size
|
||||
material_override.set_shader_parameter("size", size * 25)
|
3
app/content/ui/components/panel/panel.material
Normal file
3
app/content/ui/components/panel/panel.material
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5698a4c471cde4f3d6593fd94837a5f7238dfc832323c3ee96658f480a23c7a3
|
||||
size 450
|
30
app/content/ui/components/panel/panel.tscn
Normal file
30
app/content/ui/components/panel/panel.tscn
Normal file
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dnam3fe36gg62"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="1_2jq4a"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="1_mpdsy"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jbi6t"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 10
|
||||
shader = ExtResource("1_mpdsy")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(1, 1)
|
||||
shader_parameter/border_size = 0.01
|
||||
shader_parameter/border_fade_in = 0.05
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.04
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_vcnnc"]
|
||||
size = Vector2(0.04, 0.04)
|
||||
|
||||
[node name="Panel" type="MeshInstance3D"]
|
||||
material_override = SubResource("ShaderMaterial_jbi6t")
|
||||
mesh = SubResource("QuadMesh_vcnnc")
|
||||
script = ExtResource("1_2jq4a")
|
||||
size = Vector2(0.04, 0.04)
|
||||
corner_radius = null
|
||||
border = null
|
|
@ -1,5 +1,5 @@
|
|||
@tool
|
||||
extends Node3D
|
||||
extends Container3D
|
||||
class_name Slider3D
|
||||
|
||||
@export var min: float = 0.0:
|
||||
|
@ -42,32 +42,11 @@ class_name Slider3D
|
|||
if !is_inside_tree(): return
|
||||
label.text = str(value) + " " + label_unit
|
||||
|
||||
@export var size: Vector3 = Vector3(0.2, 0.01, 0.02): # Warning, units are in cm
|
||||
set(value):
|
||||
size = value
|
||||
if !is_inside_tree(): return
|
||||
_update_shape()
|
||||
@export var cutout_border: float = 0.02:
|
||||
set(value):
|
||||
cutout_border = value
|
||||
if !is_inside_tree(): return
|
||||
_update_shape()
|
||||
@export var cutout_depth: float = 0.05:
|
||||
set(value):
|
||||
cutout_depth = value
|
||||
if !is_inside_tree(): return
|
||||
_update_shape()
|
||||
|
||||
@onready var outside_rod: CSGBox3D = $Rod/Outside
|
||||
@onready var cutout: CSGCombiner3D = $Rod/Cutout
|
||||
@onready var cutout_box: CSGBox3D = $Rod/Cutout/Length
|
||||
@onready var cutout_end_left: CSGCylinder3D = $Rod/Cutout/EndLeft
|
||||
@onready var cutout_end_right: CSGCylinder3D = $Rod/Cutout/EndRight
|
||||
@onready var label: Label3D = $Label
|
||||
|
||||
@onready var body_collision_shape: CollisionShape3D = $CollisionBody/CollisionShape3D
|
||||
@onready var mesh: MeshInstance3D = $Body/MeshInstance3D
|
||||
@onready var body_collision_shape: CollisionShape3D = $Body/CollisionShape3D
|
||||
@onready var area_collision_shape: CollisionShape3D = $Area3D/CollisionShape3D
|
||||
|
||||
@onready var slider_knob: MeshInstance3D = $Knob
|
||||
|
||||
signal on_value_changed(value: float)
|
||||
|
@ -78,7 +57,7 @@ func _ready():
|
|||
Update.props(self, ["value", "show_label", "label_unit"])
|
||||
|
||||
_update_slider()
|
||||
_update_shape()
|
||||
_update()
|
||||
move_plane = Plane(Vector3.UP, Vector3(0, size.y / 200, 0))
|
||||
|
||||
func _on_press_down(event: EventPointer):
|
||||
|
@ -91,9 +70,7 @@ func _on_touch_enter(event: EventTouch):
|
|||
_handle_touch(event)
|
||||
|
||||
func _get_slider_min_max():
|
||||
var cutout_radius = (size.z - cutout_border * 2) / 2
|
||||
|
||||
return Vector2( - size.x / 2 + cutout_border + cutout_radius, size.x / 2 - cutout_border - cutout_radius) / 100
|
||||
return Vector2( - size.x / 2 + 0.01, size.x / 2 - 0.01)
|
||||
|
||||
func _handle_press(event: EventPointer):
|
||||
var ray_pos = event.ray.global_position
|
||||
|
@ -134,46 +111,20 @@ func _update_slider():
|
|||
|
||||
slider_knob.position.x = lerp(min_max.x, min_max.y, click_percent)
|
||||
|
||||
func _update_shape():
|
||||
outside_rod.size = size
|
||||
func _update():
|
||||
_update_slider()
|
||||
body_collision_shape.shape.size = size
|
||||
body_collision_shape.position = Vector3(0, 0, size.z / 2)
|
||||
|
||||
body_collision_shape.shape.size = size * 0.01
|
||||
area_collision_shape.shape.size = Vector3(size.x, size.y * 2, size.z) * 0.01
|
||||
area_collision_shape.position = Vector3(0, size.y, 0) * 0.01
|
||||
area_collision_shape.shape.size = Vector3(size.x, size.y, 0.01)
|
||||
area_collision_shape.position = Vector3(0, 0, size.z + 0.005)
|
||||
|
||||
var cutout_width = size.z - cutout_border * 2
|
||||
mesh.position = Vector3(0, 0, size.z)
|
||||
mesh.mesh.size = Vector2(size.x, size.y)
|
||||
mesh.material_override.set_shader_parameter("size", Vector2(size.x, size.y) * 10.0)
|
||||
|
||||
cutout_box.size = Vector3(
|
||||
size.x - cutout_border * 2 - (cutout_width),
|
||||
cutout_depth,
|
||||
cutout_width
|
||||
)
|
||||
slider_knob.position.z = size.z + 0.002
|
||||
slider_knob.mesh.size = Vector2(size.y * 0.75, size.y * 0.75)
|
||||
slider_knob.material_override.set_shader_parameter("size", Vector2(size.y * 7.5, size.y * 7.5))
|
||||
|
||||
cutout.position = Vector3(
|
||||
0,
|
||||
size.y / 2 - cutout_depth / 2 + 0.001,
|
||||
0
|
||||
)
|
||||
|
||||
cutout_end_left.radius = cutout_box.size.z / 2
|
||||
cutout_end_right.radius = cutout_box.size.z / 2
|
||||
cutout_end_left.height = cutout_depth
|
||||
cutout_end_right.height = cutout_depth
|
||||
|
||||
cutout_end_left.position = Vector3(
|
||||
- cutout_box.size.x / 2,
|
||||
0,
|
||||
0
|
||||
)
|
||||
|
||||
cutout_end_right.position = Vector3(
|
||||
cutout_box.size.x / 2,
|
||||
0,
|
||||
0
|
||||
)
|
||||
|
||||
label.position = Vector3(
|
||||
size.x / 200 + 0.005,
|
||||
0,
|
||||
0
|
||||
)
|
||||
label.position = Vector3(size.x / 2 + 0.005, 0, size.z)
|
|
@ -1,92 +1,92 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://pk5k1q8bx0rj"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://pk5k1q8bx0rj"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/components/slider/slider.gd" id="1_ylune"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eiwwn"]
|
||||
albedo_color = Color(0.133333, 0.133333, 0.133333, 1)
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_77ny1"]
|
||||
material = SubResource("StandardMaterial3D_eiwwn")
|
||||
top_radius = 0.008
|
||||
bottom_radius = 0.008
|
||||
height = 0.003
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_v34nn"]
|
||||
top_radius = 0.002
|
||||
bottom_radius = 0.002
|
||||
height = 0.005
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_by0d8"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_h1mn1"]
|
||||
size = Vector3(0.2, 0.004, 0.01)
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.15, 0.02, 0.01)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vgpd3"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 20
|
||||
shader = ExtResource("2_by0d8")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(1.5, 0.2)
|
||||
shader_parameter/border_size = 0.005
|
||||
shader_parameter/border_fade_in = 0.04
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.12
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_k78f4"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(0.15, 0.02)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mv0la"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 30
|
||||
shader = ExtResource("2_by0d8")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.15, 0.15)
|
||||
shader_parameter/border_size = 0.002
|
||||
shader_parameter/border_fade_in = 0.02
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.085
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_vw14o"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(0.015, 0.015)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_s64dk"]
|
||||
size = Vector3(0.2, 0.008, 0.01)
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.15, 0.02, 0.01)
|
||||
|
||||
[node name="Slider" type="Node3D"]
|
||||
script = ExtResource("1_ylune")
|
||||
size = Vector3(20, 0.4, 1)
|
||||
cutout_border = 0.2
|
||||
cutout_depth = 0.36
|
||||
show_label = true
|
||||
size = Vector3(0.15, 0.02, 0.01)
|
||||
|
||||
[node name="Rod" type="CSGCombiner3D" parent="."]
|
||||
transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0)
|
||||
snap = 0.0001
|
||||
|
||||
[node name="Outside" type="CSGBox3D" parent="Rod"]
|
||||
snap = 0.0001
|
||||
size = Vector3(20, 0.4, 1)
|
||||
|
||||
[node name="Cutout" type="CSGCombiner3D" parent="Rod"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.021, 0)
|
||||
operation = 2
|
||||
snap = 0.0001
|
||||
|
||||
[node name="Length" type="CSGBox3D" parent="Rod/Cutout"]
|
||||
snap = 0.0001
|
||||
size = Vector3(19, 0.36, 0.6)
|
||||
|
||||
[node name="EndRight" type="CSGCylinder3D" parent="Rod/Cutout"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.5, 0, 0)
|
||||
snap = 0.0001
|
||||
radius = 0.3
|
||||
height = 0.36
|
||||
sides = 36
|
||||
|
||||
[node name="EndLeft" type="CSGCylinder3D" parent="Rod/Cutout"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.5, 0, 0)
|
||||
snap = 0.0001
|
||||
radius = 0.3
|
||||
height = 0.36
|
||||
sides = 36
|
||||
|
||||
[node name="Knob" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.057, 0.00409426, 0)
|
||||
mesh = SubResource("CylinderMesh_77ny1")
|
||||
|
||||
[node name="Pin" type="MeshInstance3D" parent="Knob"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.00353538, 0)
|
||||
mesh = SubResource("CylinderMesh_v34nn")
|
||||
|
||||
[node name="CollisionBody" type="StaticBody3D" parent="."]
|
||||
[node name="Body" type="StaticBody3D" parent="."]
|
||||
collision_layer = 6
|
||||
collision_mask = 6
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionBody"]
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
shape = SubResource("BoxShape3D_h1mn1")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Body"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.01)
|
||||
material_override = SubResource("ShaderMaterial_vgpd3")
|
||||
mesh = SubResource("QuadMesh_k78f4")
|
||||
|
||||
[node name="Label" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.105, 0, 0)
|
||||
visible = false
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.08, 0, 0.01)
|
||||
pixel_size = 0.001
|
||||
render_priority = 30
|
||||
outline_render_priority = 29
|
||||
text = "0.2 "
|
||||
font_size = 10
|
||||
outline_size = 4
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Knob" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.039, 0, 0.012)
|
||||
material_override = SubResource("ShaderMaterial_mv0la")
|
||||
mesh = SubResource("QuadMesh_vw14o")
|
||||
skeleton = NodePath("../Body")
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="."]
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.004, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.015)
|
||||
shape = SubResource("BoxShape3D_s64dk")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
extends Node3D
|
||||
@tool
|
||||
extends FlexContainer3D
|
||||
class_name Tabs3D
|
||||
|
||||
signal on_select(selected: int)
|
||||
|
@ -8,6 +9,11 @@ var selected = R.state(null)
|
|||
@export var initial_selected: Node3D
|
||||
|
||||
func _ready():
|
||||
_update()
|
||||
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
if initial_selected:
|
||||
selected.value = initial_selected
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ func _ready():
|
|||
R.effect(func(_arg):
|
||||
if tabs.selected.value.get_index() == i:
|
||||
add_child(child)
|
||||
else:
|
||||
elif child.get_parent() == self:
|
||||
remove_child(child)
|
||||
)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var button = $Button
|
||||
@export var id: String = "0"
|
||||
|
||||
func set_device_name(text):
|
||||
assert(button != null, "Device has to be added to the scene tree")
|
||||
button.label = text
|
|
@ -1,14 +0,0 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dbe8slnyhro2n"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/edit/device/device.gd" id="1_rbo86"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="2_go2es"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="3_6wicx"]
|
||||
|
||||
[node name="Device" type="Node3D"]
|
||||
script = ExtResource("1_rbo86")
|
||||
|
||||
[node name="Button" parent="." instance=ExtResource("2_go2es")]
|
||||
focusable = true
|
||||
|
||||
[node name="Clickable" type="Node" parent="."]
|
||||
script = ExtResource("3_6wicx")
|
46
app/content/ui/menu/edit/devices.gd
Normal file
46
app/content/ui/menu/edit/devices.gd
Normal file
|
@ -0,0 +1,46 @@
|
|||
extends Node3D
|
||||
|
||||
signal on_select_device(device_id)
|
||||
|
||||
const ButtonScene = preload ("res://content/ui/components/button/button.tscn")
|
||||
|
||||
@onready var grid_container = $GridContainer3D
|
||||
@onready var pagination = $Pagination3D
|
||||
|
||||
var page = R.state(0)
|
||||
var page_size = 28.0
|
||||
|
||||
func _ready():
|
||||
|
||||
var pages = R.computed(func(_arg):
|
||||
var devices=Store.devices.state.devices
|
||||
|
||||
return ceil(devices.size() / page_size)
|
||||
)
|
||||
|
||||
var visible_devices = R.computed(func(_arg):
|
||||
var devices=Store.devices.state.devices
|
||||
|
||||
return devices.slice(page.value * page_size, page.value * page_size + page_size)
|
||||
)
|
||||
|
||||
R.bind(pagination, "pages", pages)
|
||||
R.bind(pagination, "page", page, pagination.on_page_changed)
|
||||
|
||||
R.effect(func(_arg):
|
||||
for child in grid_container.get_children():
|
||||
grid_container.remove_child(child)
|
||||
child.free()
|
||||
|
||||
for device in visible_devices.value:
|
||||
var info=device.values()[0]
|
||||
|
||||
var button_instance=ButtonScene.instantiate()
|
||||
button_instance.label=info["name"]
|
||||
button_instance.font_size=8
|
||||
button_instance.on_button_up.connect(func():
|
||||
on_select_device.emit(device.keys()[0])
|
||||
)
|
||||
grid_container.add_child(button_instance)
|
||||
|
||||
)
|
|
@ -2,164 +2,45 @@ extends Node3D
|
|||
|
||||
const ButtonScene = preload ("res://content/ui/components/button/button.tscn")
|
||||
|
||||
@onready var devices_node: GridContainer3D = $Devices
|
||||
@onready var next_page_button = $Buttons/NextPageButton
|
||||
@onready var previous_page_button = $Buttons/PreviousPageButton
|
||||
@onready var page_number_label = $PageNumberLabel
|
||||
var devices = []
|
||||
var page = 0
|
||||
var last_device_page = 0
|
||||
var page_size = 20
|
||||
var pages = 0
|
||||
@onready var devices_page = $Devices
|
||||
@onready var entities_page = $Entities
|
||||
|
||||
var selected_device = R.state(null)
|
||||
|
||||
var selected_device = null
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
next_page_button.on_button_down.connect(func():
|
||||
next_page()
|
||||
entities_page.selected_device = selected_device
|
||||
remove_child(entities_page)
|
||||
|
||||
devices_page.on_select_device.connect(func(device):
|
||||
selected_device.value=device
|
||||
entities_page.page.value=0
|
||||
)
|
||||
|
||||
previous_page_button.on_button_down.connect(func():
|
||||
previous_page()
|
||||
entities_page.on_select_entity.connect(func(entity_name):
|
||||
AudioPlayer.play_effect("spawn")
|
||||
|
||||
var entity=House.body.create_entity(entity_name, global_position)
|
||||
|
||||
if entity == null:
|
||||
EventSystem.notify("Entity is not in Room", EventNotify.Type.INFO)
|
||||
)
|
||||
|
||||
func _enter_tree():
|
||||
if !HomeApi.has_connected(): await HomeApi.on_connect
|
||||
|
||||
if is_node_ready():
|
||||
load_devices()
|
||||
|
||||
func load_devices():
|
||||
if devices.size() == 0:
|
||||
devices = await HomeApi.get_devices()
|
||||
devices.sort_custom(func(a, b):
|
||||
return a.values()[0]["name"].to_lower() < b.values()[0]["name"].to_lower()
|
||||
)
|
||||
|
||||
for device in devices:
|
||||
device.values()[0]["entities"].sort_custom(func(a, b):
|
||||
return a.to_lower() < b.to_lower()
|
||||
)
|
||||
|
||||
render()
|
||||
|
||||
HomeApi.on_disconnect.connect(func():
|
||||
devices=[]
|
||||
if is_node_ready():
|
||||
render()
|
||||
)
|
||||
|
||||
func update_pages():
|
||||
if selected_device == null:
|
||||
pages = ceil(float(devices.size()) / page_size)
|
||||
else:
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device:
|
||||
pages = ceil(float(device.values()[0]["entities"].size()) / page_size)
|
||||
|
||||
func get_page():
|
||||
if selected_device == null:
|
||||
return devices.slice(page * page_size, page * page_size + page_size)
|
||||
else:
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device:
|
||||
return device.values()[0]["entities"].slice(page * page_size, page * page_size + page_size)
|
||||
|
||||
func next_page():
|
||||
if page >= pages - 1:
|
||||
return
|
||||
page += 1
|
||||
render()
|
||||
|
||||
func previous_page():
|
||||
if page <= 0:
|
||||
return
|
||||
|
||||
page -= 1
|
||||
render()
|
||||
|
||||
func render():
|
||||
if devices.size() == 0:
|
||||
return
|
||||
|
||||
update_pages()
|
||||
page_number_label.set_text(str(page + 1) + " / " + str(pages))
|
||||
|
||||
var has_prev_page = page > 0
|
||||
var has_next_page = page < pages - 1
|
||||
|
||||
previous_page_button.visible = has_prev_page
|
||||
previous_page_button.disabled = !has_prev_page
|
||||
previous_page_button.body.get_node("CollisionShape3D").disabled = !has_prev_page
|
||||
next_page_button.visible = has_next_page
|
||||
next_page_button.disabled = !has_next_page
|
||||
next_page_button.body.get_node("CollisionShape3D").disabled = !has_next_page
|
||||
|
||||
clear_menu()
|
||||
if selected_device == null:
|
||||
render_devices()
|
||||
else:
|
||||
render_entities()
|
||||
|
||||
func render_devices():
|
||||
var page_devices = get_page()
|
||||
|
||||
for device in page_devices:
|
||||
var info = device.values()[0]
|
||||
|
||||
var button_instance = ButtonScene.instantiate()
|
||||
button_instance.label = info["name"]
|
||||
button_instance.on_button_down.connect(func():
|
||||
_on_device_click(device.keys()[0])
|
||||
)
|
||||
devices_node.add_child(button_instance)
|
||||
|
||||
devices_node._update_container()
|
||||
|
||||
func render_entities():
|
||||
var entities = get_page()
|
||||
|
||||
var back_button = ButtonScene.instantiate()
|
||||
back_button.label = "arrow_back"
|
||||
back_button.icon = true
|
||||
back_button.on_button_down.connect(func():
|
||||
_on_entity_click("#back")
|
||||
entities_page.on_back.connect(func():
|
||||
selected_device.value=null
|
||||
)
|
||||
devices_node.add_child(back_button)
|
||||
|
||||
for entity in entities:
|
||||
var button_instance = ButtonScene.instantiate()
|
||||
button_instance.label = entity
|
||||
button_instance.on_button_down.connect(func():
|
||||
_on_entity_click(entity)
|
||||
)
|
||||
devices_node.add_child(button_instance)
|
||||
|
||||
devices_node._update_container()
|
||||
|
||||
func _on_device_click(device_id):
|
||||
selected_device = device_id
|
||||
last_device_page = page
|
||||
page = 0
|
||||
|
||||
render()
|
||||
R.effect(func(_arg):
|
||||
if selected_device.value == null:
|
||||
if devices_page.is_inside_tree() == false:
|
||||
add_child(devices_page)
|
||||
|
||||
func _on_entity_click(entity_name):
|
||||
if entity_name == "#back":
|
||||
selected_device = null
|
||||
page = last_device_page
|
||||
AudioPlayer.play_effect("click")
|
||||
render()
|
||||
return
|
||||
if entities_page.is_inside_tree():
|
||||
remove_child(entities_page)
|
||||
|
||||
AudioPlayer.play_effect("spawn")
|
||||
|
||||
var entity = House.body.create_entity(entity_name, global_position)
|
||||
|
||||
if entity == null:
|
||||
EventSystem.notify("Entity is not in Room", EventNotify.Type.INFO)
|
||||
|
||||
func clear_menu():
|
||||
for child in devices_node.get_children():
|
||||
devices_node.remove_child(child)
|
||||
child.queue_free()
|
||||
if selected_device.value != null:
|
||||
if entities_page.is_inside_tree() == false:
|
||||
add_child(entities_page)
|
||||
|
||||
if devices_page.is_inside_tree():
|
||||
remove_child(devices_page)
|
||||
)
|
||||
|
|
|
@ -1,33 +1,95 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://crrb0l3ekuotj"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://crrb0l3ekuotj"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/edit/edit_menu.gd" id="1_34cbn"]
|
||||
[ext_resource type="Script" path="res://content/ui/menu/edit/devices.gd" id="2_rkvf4"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/grid_container/grid_container.gd" id="3_0xvyw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_tvimg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bef3gamrm6at2" path="res://content/ui/components/pagination/pagination.tscn" id="4_4jiu6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_lpv7m"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="4_xunmy"]
|
||||
[ext_resource type="Script" path="res://content/ui/menu/edit/entities.gd" id="5_t34xe"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/flex_container/flex_container.gd" id="6_cr6p6"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hstwo"]
|
||||
render_priority = -3
|
||||
shader = ExtResource("4_xunmy")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.42, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_4pj6f"]
|
||||
size = Vector2(0.42, 0.32)
|
||||
|
||||
[node name="EditMenu" type="Node3D"]
|
||||
script = ExtResource("1_34cbn")
|
||||
|
||||
[node name="Devices" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0.01, 0.03)
|
||||
script = ExtResource("2_rkvf4")
|
||||
|
||||
[node name="GridContainer3D" type="Node3D" parent="Devices"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.05, -0.08, 0)
|
||||
script = ExtResource("3_0xvyw")
|
||||
depth_gap = 0.06
|
||||
size = Vector3(0.24, 0.1, 0.1)
|
||||
columns = 7
|
||||
gaps = Vector2(0.01, 0.01)
|
||||
size = Vector3(0.28, 0.1, 0.1)
|
||||
|
||||
[node name="PageNumberLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.01, 0.27)
|
||||
[node name="Label3D" type="Label3D" parent="Devices"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.03, 0)
|
||||
pixel_size = 0.001
|
||||
text = "0 / 0"
|
||||
font_size = 18
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Devices"
|
||||
font_size = 24
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Buttons" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, 0.01, 0.27)
|
||||
[node name="Pagination3D" parent="Devices" instance=ExtResource("4_4jiu6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.29, 0)
|
||||
pages = 10
|
||||
size = Vector3(9.92, 0.03, 0.01)
|
||||
|
||||
[node name="NextPageButton" parent="Buttons" instance=ExtResource("4_tvimg")]
|
||||
label = "navigate_next"
|
||||
[node name="Entities" type="Node3D" parent="."]
|
||||
script = ExtResource("5_t34xe")
|
||||
|
||||
[node name="FlexContainer3D" type="Node3D" parent="Entities"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.06, 0)
|
||||
script = ExtResource("6_cr6p6")
|
||||
vertical = true
|
||||
gap = 0.01
|
||||
size = Vector3(1, 0.2, 1)
|
||||
|
||||
[node name="Pagination3D" parent="Entities" instance=ExtResource("4_4jiu6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.29, 0)
|
||||
pages = 10
|
||||
size = Vector3(9.92, 0.03, 0.01)
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="Entities"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.05, -0.03, 0)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "My Entity"
|
||||
font_size = 24
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Button" parent="Entities" instance=ExtResource("4_lpv7m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.03, 0)
|
||||
label = "arrow_back"
|
||||
icon = true
|
||||
size = Vector3(0.03, 0.03, 0.01)
|
||||
|
||||
[node name="PreviousPageButton" parent="Buttons" instance=ExtResource("4_tvimg")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.08, 0, 0)
|
||||
label = "navigate_before"
|
||||
icon = true
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0)
|
||||
visible = false
|
||||
material_override = SubResource("ShaderMaterial_hstwo")
|
||||
mesh = SubResource("QuadMesh_4pj6f")
|
||||
skeleton = NodePath("../..")
|
||||
|
|
58
app/content/ui/menu/edit/entities.gd
Normal file
58
app/content/ui/menu/edit/entities.gd
Normal file
|
@ -0,0 +1,58 @@
|
|||
extends Node3D
|
||||
|
||||
signal on_select_entity(entity_id)
|
||||
signal on_back()
|
||||
|
||||
const EntityScene = preload ("entity.tscn")
|
||||
|
||||
@onready var entity_container = $FlexContainer3D
|
||||
@onready var pagination = $Pagination3D
|
||||
@onready var back_button = $Button
|
||||
|
||||
var page = R.state(0)
|
||||
var page_size = 5.0
|
||||
var selected_device = R.state(null)
|
||||
|
||||
func _ready():
|
||||
var entities = R.computed(func(_arg):
|
||||
var devices=Store.devices.state.devices
|
||||
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device.value:
|
||||
return device.values()[0]["entities"]
|
||||
|
||||
return []
|
||||
)
|
||||
|
||||
var pages = R.computed(func(_arg):
|
||||
return ceil(entities.value.size() / page_size)
|
||||
)
|
||||
|
||||
var visible_entities = R.computed(func(_arg):
|
||||
return entities.value.slice(page.value * page_size, page.value * page_size + page_size)
|
||||
)
|
||||
|
||||
R.bind(pagination, "pages", pages)
|
||||
R.bind(pagination, "page", page, pagination.on_page_changed)
|
||||
|
||||
back_button.on_button_up.connect(func():
|
||||
on_back.emit()
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
for child in entity_container.get_children():
|
||||
entity_container.remove_child(child)
|
||||
child.queue_free()
|
||||
|
||||
for entity in visible_entities.value:
|
||||
var entity_node=EntityScene.instantiate()
|
||||
entity_node.icon=EntityFactory.get_entity_icon(entity.split(".")[0])
|
||||
entity_node.text=entity
|
||||
entity_node.on_select.connect(func():
|
||||
on_select_entity.emit(entity)
|
||||
)
|
||||
entity_container.add_child(entity_node)
|
||||
|
||||
entity_container._update()
|
||||
|
||||
)
|
32
app/content/ui/menu/edit/entity.gd
Normal file
32
app/content/ui/menu/edit/entity.gd
Normal file
|
@ -0,0 +1,32 @@
|
|||
@tool
|
||||
extends FlexContainer3D
|
||||
|
||||
signal on_select()
|
||||
|
||||
@onready var button = $Button
|
||||
@onready var label = $LabelContainer
|
||||
|
||||
@export var icon: String = "question_mark":
|
||||
set(value):
|
||||
icon = value
|
||||
_update()
|
||||
|
||||
@export var text: String = "Button":
|
||||
set(value):
|
||||
text = value
|
||||
_update()
|
||||
|
||||
func _ready():
|
||||
super._ready()
|
||||
|
||||
button.on_button_up.connect(func():
|
||||
on_select.emit()
|
||||
)
|
||||
|
||||
func _update():
|
||||
if !is_node_ready(): return
|
||||
|
||||
button.label = icon
|
||||
label.text = text
|
||||
|
||||
super._update()
|
22
app/content/ui/menu/edit/entity.tscn
Normal file
22
app/content/ui/menu/edit/entity.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://uogsamyglyw5"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/edit/entity.gd" id="1_d4c6l"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="2_gi1de"]
|
||||
[ext_resource type="PackedScene" uid="uid://blkfqa3ttk0d2" path="res://content/ui/components/label_container/label_container.tscn" id="3_vva3t"]
|
||||
|
||||
[node name="Entity" type="Node3D"]
|
||||
script = ExtResource("1_d4c6l")
|
||||
gap = 0.01
|
||||
size = Vector3(0.35, 0.03, 1)
|
||||
|
||||
[node name="Button" parent="." instance=ExtResource("2_gi1de")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.015, 0, 0)
|
||||
label = "question_mark"
|
||||
icon = true
|
||||
size = Vector3(0.03, 0.03, 0.01)
|
||||
|
||||
[node name="LabelContainer" parent="." instance=ExtResource("3_vva3t")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0615, 0, 0)
|
||||
text = "Button"
|
||||
font_size = 12
|
||||
size = Vector3(0.043, 0.015, 0.1)
|
|
@ -1,9 +0,0 @@
|
|||
extends StaticBody3D
|
||||
|
||||
@onready var label: Label3D = $Label
|
||||
@export var text = "Default"
|
||||
|
||||
func set_entity_name(text):
|
||||
assert(label != null, "Entity has to be added to the scene tree")
|
||||
label.text = text.replace(".", "\n")
|
||||
self.text = text
|
|
@ -1,32 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://xo0o5nrfjl23"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/edit/entity/entity.gd" id="1_825oj"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="2_i054q"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_aa3i4"]
|
||||
size = Vector3(0.05, 0.01, 0.05)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_28fjq"]
|
||||
size = Vector3(0.05, 0.01, 0.05)
|
||||
|
||||
[node name="Entity" type="StaticBody3D"]
|
||||
script = ExtResource("1_825oj")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("BoxMesh_aa3i4")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("BoxShape3D_28fjq")
|
||||
|
||||
[node name="Label" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.007, 0)
|
||||
pixel_size = 0.001
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
text = "Text"
|
||||
font_size = 8
|
||||
outline_size = 0
|
||||
autowrap_mode = 3
|
||||
width = 50.0
|
||||
|
||||
[node name="Clickable" type="Node" parent="."]
|
||||
script = ExtResource("2_i054q")
|
|
@ -35,7 +35,7 @@ func _ready():
|
|||
notification_node.type=event.type
|
||||
|
||||
for child in notify_place.get_children():
|
||||
child.position += Vector3(0, 0, -0.06)
|
||||
child.position += Vector3(0, 0.06, 0)
|
||||
|
||||
notify_place.add_child(notification_node)
|
||||
)
|
||||
|
@ -44,6 +44,4 @@ func move_into_view():
|
|||
var camera_transform = main.camera.global_transform
|
||||
camera_transform.origin -= camera_transform.basis.z * 0.5
|
||||
|
||||
camera_transform.basis = camera_transform.basis.rotated(camera_transform.basis.x, deg_to_rad(90))
|
||||
|
||||
global_transform = camera_transform
|
|
@ -1,8 +1,8 @@
|
|||
[gd_scene load_steps=19 format=3 uid="uid://c3kdssrmv84kv"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://c3kdssrmv84kv"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"]
|
||||
[ext_resource type="Material" uid="uid://bnwimm214q67g" path="res://assets/materials/sec-500.material" id="2_0x5at"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="2_8coxu"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_htaoi"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/tabs/tabs.gd" id="4_eavfx"]
|
||||
[ext_resource type="PackedScene" uid="uid://crrb0l3ekuotj" path="res://content/ui/menu/edit/edit_menu.tscn" id="4_r2raj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_w4i01"]
|
||||
|
@ -13,16 +13,42 @@
|
|||
[ext_resource type="PackedScene" uid="uid://c6r4higceibif" path="res://content/ui/menu/settings/settings_menu.tscn" id="11_7wm6b"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_e1esh"]
|
||||
size = Vector3(0.38, 0.0128076, 0.32)
|
||||
size = Vector3(0.51, 0.32, 0.013)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_6xn1i"]
|
||||
size = Vector3(0.3, 0.0264844, 0.3)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_du6qr"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_htaoi")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.42, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_01s1g"]
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_4bh1v"]
|
||||
lightmap_size_hint = Vector2i(4, 3)
|
||||
size = Vector2(0.42, 0.32)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_08du6"]
|
||||
material = SubResource("StandardMaterial3D_01s1g")
|
||||
size = Vector3(0.3, 0.01, 0.3)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mhqg4"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_htaoi")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.07, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_7q1en"]
|
||||
size = Vector2(0.07, 0.32)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_61md4"]
|
||||
length = 0.001
|
||||
|
@ -162,69 +188,78 @@ _data = {
|
|||
}
|
||||
|
||||
[node name="Menu" type="StaticBody3D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
collision_layer = 6
|
||||
collision_mask = 6
|
||||
script = ExtResource("1_ng4u3")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, -0.00286309, 1.49012e-08)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, -0.005)
|
||||
shape = SubResource("BoxShape3D_e1esh")
|
||||
|
||||
[node name="Movable" type="Node" parent="."]
|
||||
script = ExtResource("2_8coxu")
|
||||
|
||||
[node name="AnimationContainer" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0, -0.15)
|
||||
collision_layer = 6
|
||||
collision_mask = 6
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="AnimationContainer"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21, -0.00824219, 0.15)
|
||||
shape = SubResource("BoxShape3D_6xn1i")
|
||||
[node name="AnimationContainer" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23, 0.15, 0)
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="AnimationContainer"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21, 0, 0.15)
|
||||
material_override = ExtResource("2_0x5at")
|
||||
mesh = SubResource("BoxMesh_08du6")
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.23, -0.15, 0)
|
||||
material_override = SubResource("ShaderMaterial_du6qr")
|
||||
mesh = SubResource("QuadMesh_4bh1v")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Background2" type="MeshInstance3D" parent="AnimationContainer"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, -0.02, -0.15, 0)
|
||||
material_override = SubResource("ShaderMaterial_mhqg4")
|
||||
mesh = SubResource("QuadMesh_7q1en")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Tabs" type="Node3D" parent="AnimationContainer" node_paths=PackedStringArray("initial_selected")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, -0.005, 0)
|
||||
script = ExtResource("4_eavfx")
|
||||
initial_selected = NodePath("View")
|
||||
vertical = true
|
||||
gap = 0.01
|
||||
size = Vector3(0.05, 0.4, 1)
|
||||
|
||||
[node name="View" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.03)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.025, 0)
|
||||
label = "visibility"
|
||||
icon = true
|
||||
toggleable = true
|
||||
disabled = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="Edit" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.09)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.085, 0)
|
||||
label = "widgets"
|
||||
icon = true
|
||||
toggleable = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="Room" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.15)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.145, 0)
|
||||
label = "view_in_ar"
|
||||
icon = true
|
||||
toggleable = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="Automate" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.21)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.205, 0)
|
||||
label = "schema"
|
||||
icon = true
|
||||
toggleable = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="Settings" parent="AnimationContainer/Tabs" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.27)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.265, 0)
|
||||
label = "settings"
|
||||
icon = true
|
||||
toggleable = true
|
||||
size = Vector3(0.05, 0.05, 0.01)
|
||||
|
||||
[node name="TabsContent" type="Node3D" parent="AnimationContainer" node_paths=PackedStringArray("tabs")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, 0.00999999, 0)
|
||||
script = ExtResource("6_7rntr")
|
||||
tabs = NodePath("../Tabs")
|
||||
|
||||
|
@ -243,11 +278,11 @@ visible = false
|
|||
visible = false
|
||||
|
||||
[node name="NotifyPlace" type="Marker3D" parent="AnimationContainer"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, -0.05)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0.06, 0)
|
||||
gizmo_extents = 0.02
|
||||
|
||||
[node name="KeyboardPlace" type="Marker3D" parent="AnimationContainer"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.353553, 0.353553, 0, -0.353553, 0.353553, 0.2, 0.130848, 0.45)
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.353553, 0.353553, 0, -0.353553, 0.353553, 0.2, -0.38, 0.16)
|
||||
gizmo_extents = 0.02
|
||||
|
||||
[node name="ImmersiveHomePanels" type="MeshInstance3D" parent="."]
|
||||
|
|
|
@ -1,43 +1,62 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://c01gkeldvjwtr"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://c01gkeldvjwtr"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/room/room_menu.gd" id="1_ch4jb"]
|
||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_7m4yn"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_cghmp"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/tabs/tabs.gd" id="5_ddrep"]
|
||||
[ext_resource type="PackedScene" uid="uid://dd71loi64gnmp" path="res://content/ui/menu/room/views/overview.tscn" id="6_206ad"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/tabs/tabs_content.gd" id="6_ba00g"]
|
||||
[ext_resource type="PackedScene" uid="uid://bpta22fahai46" path="res://content/ui/menu/room/views/rooms.tscn" id="7_2f8e0"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="7_bxp1w"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_e37nn"]
|
||||
size = Vector3(0.3, 0.01, 0.3)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2asng"]
|
||||
render_priority = -3
|
||||
shader = ExtResource("7_bxp1w")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.42, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_16sg5"]
|
||||
size = Vector2(0.42, 0.32)
|
||||
|
||||
[node name="RoomMenu" type="Node3D"]
|
||||
script = ExtResource("1_ch4jb")
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0, 0.15)
|
||||
material_override = ExtResource("2_7m4yn")
|
||||
mesh = SubResource("BoxMesh_e37nn")
|
||||
|
||||
[node name="Interface" type="Node3D" parent="."]
|
||||
|
||||
[node name="Tabs3D" type="Node3D" parent="Interface" node_paths=PackedStringArray("initial_selected")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.04, 0)
|
||||
script = ExtResource("5_ddrep")
|
||||
initial_selected = NodePath("Overview")
|
||||
gap = 0.01
|
||||
|
||||
[node name="Overview" parent="Interface/Tabs3D" instance=ExtResource("4_cghmp")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0.02)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0)
|
||||
label = "Overview"
|
||||
size = Vector3(0.06, 0.04, 0.01)
|
||||
|
||||
[node name="Rooms" parent="Interface/Tabs3D" instance=ExtResource("4_cghmp")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.09, 0, 0.02)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, 0, 0)
|
||||
label = "Rooms"
|
||||
size = Vector3(0.06, 0.04, 0.01)
|
||||
|
||||
[node name="TabsContent3D" type="Node3D" parent="Interface" node_paths=PackedStringArray("tabs")]
|
||||
script = ExtResource("6_ba00g")
|
||||
tabs = NodePath("../Tabs3D")
|
||||
|
||||
[node name="Overview" parent="Interface/TabsContent3D" instance=ExtResource("6_206ad")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.04)
|
||||
|
||||
[node name="Rooms" parent="Interface/TabsContent3D" instance=ExtResource("7_2f8e0")]
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0)
|
||||
visible = false
|
||||
material_override = SubResource("ShaderMaterial_2asng")
|
||||
mesh = SubResource("QuadMesh_16sg5")
|
||||
skeleton = NodePath("../..")
|
||||
|
|
|
@ -1,24 +1,52 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dd71loi64gnmp"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dd71loi64gnmp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_fteh8"]
|
||||
[ext_resource type="Script" path="res://content/ui/menu/room/views/overview.gd" id="1_jesad"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_2yl2s"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_n3lbn"]
|
||||
render_priority = -3
|
||||
shader = ExtResource("3_2yl2s")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.42, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_l1dos"]
|
||||
size = Vector2(0.42, 0.32)
|
||||
|
||||
[node name="Overview" type="Node3D"]
|
||||
script = ExtResource("1_jesad")
|
||||
|
||||
[node name="EditButton" parent="." instance=ExtResource("1_fteh8")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, 0, 0.07)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, -0.12, 0)
|
||||
label = "edit"
|
||||
icon = true
|
||||
|
||||
[node name="FixButton" parent="." instance=ExtResource("1_fteh8")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, 0, 0.07)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, -0.12, 0)
|
||||
label = "healing"
|
||||
icon = true
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.06, 0.01, 0.02)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.08, 0.01)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Reference"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0)
|
||||
visible = false
|
||||
material_override = SubResource("ShaderMaterial_n3lbn")
|
||||
mesh = SubResource("QuadMesh_l1dos")
|
||||
skeleton = NodePath("../..")
|
||||
|
|
|
@ -104,7 +104,7 @@ func _on_click(event: EventPointer):
|
|||
func _generate_room_map():
|
||||
var rooms = Store.house.state.rooms
|
||||
|
||||
var target_size = Vector2(0.2, 0.24)
|
||||
var target_size = Vector2(0.2, 0.2)
|
||||
var target_offset = Vector2(0, 0.05)
|
||||
|
||||
for old_room in rooms_map.get_children():
|
||||
|
@ -156,6 +156,7 @@ func _generate_room_map():
|
|||
var scale_value = min(target_scale.x, target_scale.y)
|
||||
|
||||
rooms_map.position.x = -current_min.x * scale_value + target_offset.x
|
||||
rooms_map.position.z = -current_min.y * scale_value + target_offset.y
|
||||
rooms_map.position.y = current_min.y * scale_value - target_offset.y
|
||||
rooms_map.position.z = 0.002
|
||||
|
||||
rooms_map.scale = Vector3(scale_value, scale_value, scale_value)
|
||||
|
|
|
@ -1,21 +1,46 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bpta22fahai46"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bpta22fahai46"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/room/views/rooms.gd" id="1_3a1oa"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_y3lty"]
|
||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="2_hstw7"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="4_jx6i3"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dah0r"]
|
||||
render_priority = -3
|
||||
shader = ExtResource("4_jx6i3")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.42, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_fq44b"]
|
||||
size = Vector2(0.42, 0.32)
|
||||
|
||||
[node name="Rooms" type="Node3D"]
|
||||
script = ExtResource("1_3a1oa")
|
||||
|
||||
[node name="Rooms" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0.01, 0.17)
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.14, -0.15, 0)
|
||||
|
||||
[node name="Button" parent="." instance=ExtResource("1_y3lty")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.27, 0, 0.27)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.28, 0)
|
||||
label = "add"
|
||||
icon = true
|
||||
|
||||
[node name="Input" parent="." instance=ExtResource("2_hstw7")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.12, 0.005, 0.27)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.09, -0.28, 0)
|
||||
text = "Room 1"
|
||||
disabled = true
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0)
|
||||
visible = false
|
||||
material_override = SubResource("ShaderMaterial_dah0r")
|
||||
mesh = SubResource("QuadMesh_fq44b")
|
||||
skeleton = NodePath("../..")
|
||||
|
|
|
@ -12,8 +12,10 @@ const credits_scene = preload ("./credits.tscn")
|
|||
@onready var clear_save = $Content/ClearSave
|
||||
@onready var background = $Background
|
||||
@onready var voice_assist = $Content/VoiceAssist
|
||||
@onready var version_label = $Content/LabelVersion
|
||||
|
||||
func _ready():
|
||||
_load_game_version()
|
||||
var settings_store = Store.settings.state
|
||||
|
||||
background.visible = false
|
||||
|
@ -96,3 +98,9 @@ func _ready():
|
|||
|
||||
R.bind(voice_assist, "label", button_label)
|
||||
R.bind(voice_assist, "active", settings_store, "voice_assistant")
|
||||
|
||||
func _load_game_version():
|
||||
var presets = ConfigFile.new()
|
||||
presets.load("res://export_presets.cfg")
|
||||
|
||||
version_label.text = "%s (%s)" % [presets.get_value("preset.1.options", "version/name", "v0.0.0"), presets.get_value("preset.1.options", "version/code", 0)]
|
||||
|
|
|
@ -1,39 +1,52 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://c6r4higceibif"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://c6r4higceibif"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/settings/settings_menu.gd" id="1_0lte6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_faxng"]
|
||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_6lhhi"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="3_qmg6q"]
|
||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="4_q3x6k"]
|
||||
[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="5_eiwd4"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_e51x8"]
|
||||
size = Vector3(0.3, 0.01, 0.3)
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="6_mubnp"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_3qdps"]
|
||||
size = Vector3(0.08, 0.01, 0.02)
|
||||
size = Vector3(0.07, 0.02, 0.01)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3iv64"]
|
||||
render_priority = -3
|
||||
shader = ExtResource("6_mubnp")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.42, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_d0l0p"]
|
||||
size = Vector2(0.42, 0.32)
|
||||
|
||||
[node name="SettingsMenu" type="Node3D"]
|
||||
script = ExtResource("1_0lte6")
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0, 0.15)
|
||||
material_override = ExtResource("2_6lhhi")
|
||||
mesh = SubResource("BoxMesh_e51x8")
|
||||
|
||||
[node name="Content" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.007, 0)
|
||||
|
||||
[node name="ConnectionStatus" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.250698, 0, 0.151303)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.251, -0.151, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Disconnected"
|
||||
font_size = 8
|
||||
outline_size = 0
|
||||
|
||||
[node name="LabelURL" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.03)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.03, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "url:
|
||||
"
|
||||
font_size = 18
|
||||
|
@ -41,51 +54,63 @@ outline_size = 0
|
|||
horizontal_alignment = 0
|
||||
|
||||
[node name="InputURL" parent="Content" instance=ExtResource("4_q3x6k")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, 0, 0.03)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, -0.03, 0)
|
||||
text = "ws://192.168.0.1:8123"
|
||||
size = Vector3(0.2, 0.03, 0.01)
|
||||
|
||||
[node name="LabelToken" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.07)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.07, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "token:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="InputToken" parent="Content" instance=ExtResource("4_q3x6k")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, 0, 0.07)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, -0.07, 0)
|
||||
text = "..."
|
||||
size = Vector3(0.2, 0.03, 0.01)
|
||||
|
||||
[node name="LabelConnect" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.14, 0, 0.12)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.14, -0.12, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Connect"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Connect" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, 0, 0.12)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, -0.12, 0)
|
||||
label = "login"
|
||||
icon = true
|
||||
|
||||
[node name="Credits" type="StaticBody3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0102286, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.37, -0.300229, 0)
|
||||
visible = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Content/Credits"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.26, 0.005, 0.29)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.005, 0, 0)
|
||||
shape = SubResource("BoxShape3D_3qdps")
|
||||
disabled = true
|
||||
|
||||
[node name="Label" type="Label3D" parent="Content/Credits"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.0102286, 0.29)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.98023e-08, 0, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "credits"
|
||||
font_size = 12
|
||||
outline_size = 0
|
||||
|
||||
[node name="Hearth" type="Label3D" parent="Content/Credits"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.29, 0.0102286, 0.29)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
modulate = Color(0.584314, 0, 0, 1)
|
||||
text = "favorite"
|
||||
font = ExtResource("5_eiwd4")
|
||||
|
@ -96,34 +121,40 @@ outline_size = 0
|
|||
script = ExtResource("3_qmg6q")
|
||||
|
||||
[node name="SaveLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.21)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.21, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Manual Save:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Save" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.17, 0, 0.21)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.17, -0.21, 0)
|
||||
label = "save"
|
||||
icon = true
|
||||
|
||||
[node name="clearSaveLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.26)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.26, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Clear Save:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="ClearSave" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.17, 0, 0.27)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.17, -0.27, 0)
|
||||
label = "close"
|
||||
icon = true
|
||||
|
||||
[node name="clearSaveWarning" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.28)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.28, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
text = "Caution! This will delete all your rooms and placed devices."
|
||||
font_size = 8
|
||||
|
@ -133,16 +164,34 @@ autowrap_mode = 3
|
|||
width = 150.0
|
||||
|
||||
[node name="VoiceAssist" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, 0, 0.12)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, -0.12, 0)
|
||||
label = "mic_off"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="LabelVoiceAssist" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.12)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.12, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Voice-
|
||||
Assist:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="LabelVersion" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.41, -0.31, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "v0.0.0"
|
||||
font_size = 10
|
||||
outline_size = 0
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0)
|
||||
material_override = SubResource("ShaderMaterial_3iv64")
|
||||
mesh = SubResource("QuadMesh_d0l0p")
|
||||
skeleton = NodePath("../..")
|
||||
|
|
|
@ -1,108 +1,135 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://ddpxthb414unp"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://ddpxthb414unp"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/view/view_menu.gd" id="1_hxajx"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="2_qan1b"]
|
||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_se6ic"]
|
||||
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_d3xhb"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="5_cjxo5"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_qr3bi"]
|
||||
size = Vector3(0.3, 0.01, 0.3)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_e5hvo"]
|
||||
render_priority = 10
|
||||
shader = ExtResource("5_cjxo5")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.42, 0.32)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_1j6jf"]
|
||||
size = Vector2(0.42, 0.32)
|
||||
|
||||
[node name="ViewMenu" type="Node3D"]
|
||||
script = ExtResource("1_hxajx")
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0, 0.15)
|
||||
material_override = ExtResource("2_se6ic")
|
||||
mesh = SubResource("BoxMesh_qr3bi")
|
||||
|
||||
[node name="Content" type="Node3D" parent="."]
|
||||
|
||||
[node name="MiniView" parent="Content" instance=ExtResource("2_qan1b")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0.03)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, -0.04, 0)
|
||||
label = "view_comfy"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="MiniViewLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0.07, 0.01, 0.03)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.07, -0.04, 0)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Mini View"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="HeatMap" parent="Content" instance=ExtResource("2_qan1b")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0.09)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, -0.1, 0)
|
||||
label = "device_thermostat"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="HeatMapLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0.07, 0.01, 0.09)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.07, -0.1, 0)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Heat Map"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="HumidityMap" parent="Content" instance=ExtResource("2_qan1b")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0.15)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, -0.16, 0)
|
||||
label = "humidity_mid"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="HumidityMapLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0.07, 0.01, 0.15)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.07, -0.16, 0)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Humidity Map"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="MinSlider" parent="Content" instance=ExtResource("4_d3xhb")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, 0.01, 0.2)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.09, -0.21, 0)
|
||||
value = 0.0
|
||||
step = 1.0
|
||||
show_label = true
|
||||
size = Vector3(10, 0.4, 1)
|
||||
|
||||
[node name="MinValue" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0.15, 0.01, 0.2)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.21, 0)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Min Value"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="MaxSlider" parent="Content" instance=ExtResource("4_d3xhb")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, 0.01, 0.24)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.09, -0.25, 0)
|
||||
value = 0.0
|
||||
step = 1.0
|
||||
show_label = true
|
||||
size = Vector3(10, 0.4, 1)
|
||||
|
||||
[node name="MaxValue" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0.15, 0.01, 0.24)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.25, 0)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Max Value"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="OpacitySlider" parent="Content" instance=ExtResource("4_d3xhb")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, 0.01, 0.28)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.09, -0.29, 0)
|
||||
max = 100.0
|
||||
value = 30.0
|
||||
step = 10.0
|
||||
show_label = true
|
||||
label_unit = "%"
|
||||
size = Vector3(10, 0.4, 1)
|
||||
|
||||
[node name="OpacityLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0.15, 0.01, 0.28)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.29, 0)
|
||||
pixel_size = 0.001
|
||||
double_sided = false
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Opacity"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0)
|
||||
material_override = SubResource("ShaderMaterial_e5hvo")
|
||||
mesh = SubResource("QuadMesh_1j6jf")
|
||||
skeleton = NodePath("../..")
|
||||
|
|
|
@ -3,9 +3,10 @@ extends Node3D
|
|||
@onready var getting_started_button = $GettingStartedButton
|
||||
@onready var close_button = $CloseButton
|
||||
@onready var camera = $"/root/Main/XROrigin3D/XRCamera3D"
|
||||
var next_new_position = global_position
|
||||
var next_new_position = null
|
||||
|
||||
func _ready():
|
||||
next_new_position = global_position
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
|
|
|
@ -1,28 +1,43 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bhyddd1f0ry1x"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bhyddd1f0ry1x"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/onboarding/onboarding.gd" id="1_k4yvw"]
|
||||
[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_aleti"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_87aan"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_hlpow"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_nfwtf"]
|
||||
size = Vector3(0.5, 0.3, 0.01)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_yknqs"]
|
||||
size = Vector3(0.5, 0.3, 0.01)
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_d2ck8"]
|
||||
render_priority = 10
|
||||
shader = ExtResource("2_87aan")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(0.5, 0.3)
|
||||
shader_parameter/border_size = 0.001
|
||||
shader_parameter/border_fade_in = 0.005
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.02
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_ij2lj"]
|
||||
size = Vector2(0.5, 0.3)
|
||||
|
||||
[node name="Onboarding" type="StaticBody3D"]
|
||||
collision_layer = 6
|
||||
collision_mask = 6
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_k4yvw")
|
||||
|
||||
[node name="Label3D2" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23, -0.1, 0.006)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23, -0.11, 0.001)
|
||||
pixel_size = 0.001
|
||||
render_priority = 30
|
||||
outline_render_priority = 29
|
||||
text = "Getting Started"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
vertical_alignment = 0
|
||||
autowrap_mode = 3
|
||||
width = 470.0
|
||||
|
||||
|
@ -30,12 +45,14 @@ width = 470.0
|
|||
shape = SubResource("BoxShape3D_nfwtf")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
material_override = ExtResource("2_aleti")
|
||||
mesh = SubResource("BoxMesh_yknqs")
|
||||
material_override = SubResource("ShaderMaterial_d2ck8")
|
||||
mesh = SubResource("QuadMesh_ij2lj")
|
||||
|
||||
[node name="GettingStartedLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23, 0.14, 0.006)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23, 0.13, 0.001)
|
||||
pixel_size = 0.001
|
||||
render_priority = 30
|
||||
outline_render_priority = 29
|
||||
text = "Hey!
|
||||
|
||||
This app is still early in development and still has a lot of rough edges. Things might break or are sometimes difficult to use, this will improve the more polished the app becomes.
|
||||
|
@ -49,22 +66,23 @@ autowrap_mode = 3
|
|||
width = 470.0
|
||||
|
||||
[node name="GettingStartedButton" parent="." instance=ExtResource("3_hlpow")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.05, -0.11, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.06, -0.11, 0.001)
|
||||
label = "open_in_new"
|
||||
icon = true
|
||||
|
||||
[node name="CloseButton" parent="." instance=ExtResource("3_hlpow")]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.21, -0.11, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21, -0.11, 0.001)
|
||||
label = "done"
|
||||
icon = true
|
||||
|
||||
[node name="CloseLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06, -0.1, 0.006)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, -0.11, 0.001)
|
||||
pixel_size = 0.001
|
||||
render_priority = 30
|
||||
outline_render_priority = 29
|
||||
text = "Understood"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
vertical_alignment = 0
|
||||
horizontal_alignment = 2
|
||||
autowrap_mode = 3
|
||||
width = 470.0
|
||||
|
|
BIN
app/content/ui/test.material.depren
Normal file
BIN
app/content/ui/test.material.depren
Normal file
Binary file not shown.
|
@ -6,7 +6,7 @@ runnable=true
|
|||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter="*.j2,*.woff2"
|
||||
include_filter="*.j2,*.woff2,export_presets.cfg"
|
||||
exclude_filter=""
|
||||
export_path="builds/android/immersive-home-debug.apk"
|
||||
encryption_include_filters=""
|
||||
|
@ -134,6 +134,7 @@ permissions/mount_format_filesystems=false
|
|||
permissions/mount_unmount_filesystems=false
|
||||
permissions/nfc=false
|
||||
permissions/persistent_activity=false
|
||||
permissions/post_notifications=false
|
||||
permissions/process_outgoing_calls=false
|
||||
permissions/read_calendar=false
|
||||
permissions/read_call_log=false
|
||||
|
@ -229,7 +230,7 @@ runnable=false
|
|||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter="*.j2,*.woff2"
|
||||
include_filter="*.j2,*.woff2,export_presets.cfg"
|
||||
exclude_filter=""
|
||||
export_path="builds/android/immersive-home.apk"
|
||||
encryption_include_filters=""
|
||||
|
@ -244,7 +245,7 @@ custom_template/release=""
|
|||
gradle_build/use_gradle_build=true
|
||||
gradle_build/export_format=0
|
||||
gradle_build/min_sdk=""
|
||||
gradle_build/target_sdk="32"
|
||||
gradle_build/target_sdk=""
|
||||
architectures/armeabi-v7a=false
|
||||
architectures/arm64-v8a=true
|
||||
architectures/x86=false
|
||||
|
@ -357,6 +358,7 @@ permissions/mount_format_filesystems=false
|
|||
permissions/mount_unmount_filesystems=false
|
||||
permissions/nfc=false
|
||||
permissions/persistent_activity=false
|
||||
permissions/post_notifications=false
|
||||
permissions/process_outgoing_calls=false
|
||||
permissions/read_calendar=false
|
||||
permissions/read_call_log=false
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
extends Event
|
||||
extends EventBubble
|
||||
## Emitted when a Node with the `ui_focus` group is focused or unfocused.
|
||||
class_name EventFocus
|
||||
|
||||
## The Node that is being focused or unfocused.
|
||||
var target: Node
|
||||
## The Node that was previously focused or unfocused.
|
||||
var previous_target: Node
|
|
@ -96,8 +96,10 @@ func _handle_focus(target: Variant, event: EventBubble):
|
|||
var event_focus = EventFocus.new()
|
||||
event_focus.previous_target = _active_node
|
||||
event_focus.target = target
|
||||
event_focus.bubbling = false
|
||||
|
||||
if _active_node != null&&_active_node.has_method(FN_PREFIX + "focus_out"):
|
||||
emit("focus_out", event_focus)
|
||||
_active_node.call(FN_PREFIX + "focus_out", event_focus)
|
||||
on_focus_out.emit(event_focus)
|
||||
|
||||
|
|
|
@ -2,7 +2,28 @@ extends StoreClass
|
|||
const StoreClass = preload ("./store.gd")
|
||||
|
||||
func _init():
|
||||
self.state = R.state({})
|
||||
self.state = R.state({
|
||||
"devices": []
|
||||
})
|
||||
|
||||
HomeApi.on_connect.connect(func():
|
||||
var devices=await HomeApi.get_devices()
|
||||
|
||||
devices.sort_custom(func(a, b):
|
||||
return a.values()[0]["name"].to_lower() < b.values()[0]["name"].to_lower()
|
||||
)
|
||||
|
||||
for device in devices:
|
||||
device.values()[0]["entities"].sort_custom(func(a, b):
|
||||
return a.to_lower() < b.to_lower()
|
||||
)
|
||||
|
||||
self.state.devices=devices
|
||||
)
|
||||
|
||||
HomeApi.on_disconnect.connect(func():
|
||||
self.state.devices=[]
|
||||
)
|
||||
|
||||
func clear():
|
||||
pass
|
|
@ -38,4 +38,25 @@ static func create_entity(id: String, type=null):
|
|||
return null
|
||||
|
||||
entity.entity_id = id
|
||||
return entity
|
||||
return entity
|
||||
|
||||
static func get_entity_icon(type: String) -> String:
|
||||
match type:
|
||||
"switch":
|
||||
return "toggle_on"
|
||||
"light":
|
||||
return "lightbulb"
|
||||
"sensor":
|
||||
return "sensors"
|
||||
"media_player":
|
||||
return "play_circle"
|
||||
"camera":
|
||||
return "photo_camera"
|
||||
"button":
|
||||
return "radio_button_checked"
|
||||
"number":
|
||||
return "sliders"
|
||||
"line_chart":
|
||||
return "finance"
|
||||
_:
|
||||
return "question_mark"
|
|
@ -1,5 +1,5 @@
|
|||
## Returns the size of a Label3D in standard units
|
||||
static func get_font_size(label: Label3D, chars=null):
|
||||
static func get_font_size(label: Label3D, chars=null) -> Vector2:
|
||||
var font = label.font
|
||||
|
||||
if font == null:
|
||||
|
|
Loading…
Reference in New Issue
Block a user