adding text label on 3D environment

This commit is contained in:
AleaJactaEst 2022-03-30 00:30:32 +02:00
parent dfc52c1857
commit 1c115ac66e
9 changed files with 128 additions and 21 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=3 uid="uid://b8p2h0rmwy7qn"]
[gd_scene load_steps=20 format=3 uid="uid://b8p2h0rmwy7qn"]
[ext_resource type="Material" uid="uid://dpegsmygxcfmv" path="res://maps/materials/basic_ground.material" id="1_lodye"]
[ext_resource type="PackedScene" uid="uid://cveshwnu272vf" path="res://maps/objects/ramp-complex.tscn" id="2_4eueh"]
@ -11,6 +11,7 @@
[ext_resource type="PackedScene" uid="uid://c7sga2ipka52x" path="res://maps/waypoint/waypoint.tscn" id="7_5rpqq"]
[ext_resource type="PackedScene" uid="uid://dxghflr1tlhai" path="res://maps/objects/panel_dummy.tscn" id="11_gb0sk"]
[ext_resource type="PackedScene" uid="uid://damn2u4n5ien" path="res://maps/objects/panel.tscn" id="11_vd4qp"]
[ext_resource type="PackedScene" uid="uid://b2vv2knvetbwf" path="res://maps/objects/panel-mega.tscn" id="11_y1j8d"]
[ext_resource type="PackedScene" uid="uid://bfo13c5k8xu0x" path="res://maps/natural_ground.tscn" id="12_r7x73"]
[ext_resource type="PackedScene" uid="uid://mdsxnqsijdqv" path="res://maps/dispensaire_01.tscn" id="13_ald41"]
@ -126,6 +127,9 @@ transform = Transform3D(-0.947718, 0, 0.319108, 0, 1, 0, -0.319108, 0, -0.947718
[node name="panel_dummy" parent="." instance=ExtResource( "11_gb0sk" )]
transform = Transform3D(-0.755122, 0, 0.655585, 0, 1, 0, -0.655585, 0, -0.755122, -16, 0, -2)
[node name="panel_mega" parent="." instance=ExtResource( "11_y1j8d" )]
transform = Transform3D(-0.998917, 0, 0.0465135, 0, 1, 0, -0.0465135, 0, -0.998917, -11.5643, 0, -0.999999)
[node name="natural_ground" parent="." instance=ExtResource( "12_r7x73" )]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 65, 0.05, -15)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,13 @@
extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
$panel2/Node3D/SubViewport/VBoxContainer/Label.text = str(Common.get_time_only_text())
func _on_button_pressed():
Common.msg_debug("Button Panel Meta pressed")

View file

@ -0,0 +1,56 @@
[gd_scene load_steps=4 format=3 uid="uid://b2vv2knvetbwf"]
[ext_resource type="PackedScene" uid="uid://dwk6kjtpu1w07" path="res://maps/imports/panel.gltf" id="1_2vsan"]
[ext_resource type="Script" path="res://maps/objects/panel-mega.gd" id="2_xmls6"]
[sub_resource type="ViewportTexture" id="ViewportTexture_mq4m0"]
viewport_path = NodePath("panel2/Node3D/SubViewport")
[node name="panel_meta" instance=ExtResource( "1_2vsan" )]
script = ExtResource( "2_xmls6" )
[node name="Node3D" type="Node3D" parent="panel2" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.82178, 0)
[node name="SubViewport" type="SubViewport" parent="panel2/Node3D" index="0"]
own_world_3d = true
transparent_bg = true
gui_embed_subwindows = true
size = Vector2i(140, 60)
size_2d_override_stretch = true
render_target_update_mode = 3
[node name="VBoxContainer" type="VBoxContainer" parent="panel2/Node3D/SubViewport" index="0"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
__meta__ = {
"_edit_use_custom_anchors": false
}
[node name="Label" type="Label" parent="panel2/Node3D/SubViewport/VBoxContainer" index="0"]
offset_right = 1024.0
offset_bottom = 26.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_color = Color(0.858824, 0.619608, 0.12549, 1)
theme_override_colors/font_shadow_color = Color(0.933333, 0, 0, 1)
text = "Ceci est un texte"
horizontal_alignment = 1
vertical_alignment = 1
__meta__ = {
"_edit_use_custom_anchors": false
}
[node name="Button" type="Button" parent="panel2/Node3D/SubViewport/VBoxContainer" index="1"]
offset_top = 30.0
offset_right = 1024.0
offset_bottom = 61.0
text = "Button ?"
[node name="Sprite3D" type="Sprite3D" parent="panel2/Node3D" index="1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.722021, 0.1028)
texture = SubResource( "ViewportTexture_mq4m0" )
[connection signal="pressed" from="panel2/Node3D/SubViewport/VBoxContainer/Button" to="." method="_on_button_pressed"]

View file

@ -1,5 +1,33 @@
[gd_scene load_steps=2 format=3 uid="uid://damn2u4n5ien"]
[gd_scene load_steps=3 format=3 uid="uid://damn2u4n5ien"]
[ext_resource type="PackedScene" uid="uid://dwk6kjtpu1w07" path="res://maps/imports/panel.gltf" id="1_2vsan"]
[sub_resource type="ViewportTexture" id="ViewportTexture_mq4m0"]
viewport_path = NodePath("panel2/Node3D/SubViewport")
[node name="panel" instance=ExtResource( "1_2vsan" )]
[node name="Node3D" type="Node3D" parent="panel2" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.82178, 0)
[node name="SubViewport" type="SubViewport" parent="panel2/Node3D" index="0"]
own_world_3d = true
size = Vector2i(140, 60)
size_2d_override_stretch = true
render_target_update_mode = 3
[node name="Label" type="Label" parent="panel2/Node3D/SubViewport" index="0"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "Ceci est un texte"
horizontal_alignment = 1
vertical_alignment = 1
__meta__ = {
"_edit_use_custom_anchors": false
}
[node name="Sprite3D" type="Sprite3D" parent="panel2/Node3D" index="1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.722021, 0.036835)
texture = SubResource( "ViewportTexture_mq4m0" )

View file

@ -9,7 +9,7 @@
script = ExtResource( "1_ld2xt" )
[node name="player" parent="." instance=ExtResource( "1_btdsd" )]
transform = Transform3D(-0.513017, 0, -0.858378, 0, 1, 0, 0.858378, 0, -0.513017, -3.68624, 0.045102, -16.5122)
transform = Transform3D(0.677723, 0, -0.735317, 0, 1, 0, 0.735317, 0, 0.677723, -12.779, 0.045102, -3.80041)
[node name="terrain_basic_setup" parent="." instance=ExtResource( "2_jj4oa" )]

View file

@ -10,6 +10,12 @@ func get_time_text() -> String:
time['hour'], time['minute'], time['second'],
]
func get_time_only_text() -> String:
var time = Time.get_datetime_dict_from_system()
return "%02d:%02d:%02d" % [
time['hour'], time['minute'], time['second'],
]
func msg_debug(text):
if debug:
var frame = get_stack()[1]