Merge pull request #138 from Nitwel/improvements

Improvements
This commit is contained in:
Nitwel 2024-05-03 12:53:56 +02:00 committed by GitHub
commit a86b560773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 70 additions and 16 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b117dc5a7537a60ff341010636802131c9aa3b80982130e63d5d94902c002d07
size 13505995
oid sha256:2b7e5cb00328c9b9d8076a826c368d012628edadf108d078167620945c4742b0
size 32849426

View File

@ -7,7 +7,7 @@ sky_material = SubResource("ProceduralSkyMaterial_i4xao")
[resource]
background_mode = 1
background_color = Color(1, 1, 1, 1)
background_color = Color(0.441, 0.962033, 0.98, 1)
sky = SubResource("Sky_vhymk")
ambient_light_source = 2
ambient_light_color = Color(1, 1, 1, 1)

View File

@ -1,6 +1,6 @@
extends StaticBody3D
var entity_id: String
@export var entity_id: String
var icon = R.state("question_mark")
var icon_color = R.state(Color(1, 1, 1, 1))

View File

@ -23,6 +23,9 @@ var color_supported = false
# Called when the node enters the scene tree for the first time.
func _ready():
super()
if HomeApi.has_connected() == false:
await HomeApi.on_connect
icon.value = "lightbulb"
var stateInfo = await HomeApi.get_state(entity_id)
@ -126,4 +129,4 @@ func quick_action():
_toggle()
func _toggle():
HomeApi.set_state(entity_id, "off" if active.value else "on")
HomeApi.set_state(entity_id, "off" if active.value else "on")

View File

@ -10,7 +10,7 @@
[sub_resource type="BoxShape3D" id="BoxShape3D_3qyo4"]
size = Vector3(0.32, 0.16, 0.02)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mq5r1"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h0yvw"]
resource_local_to_scene = true
render_priority = 10
shader = ExtResource("6_40cd1")
@ -25,7 +25,7 @@ shader_parameter/corner_radius = 0.8
shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_x7s0p"]
[sub_resource type="QuadMesh" id="QuadMesh_a23j8"]
size = Vector2(0.32, 0.16)
[node name="Timer" type="StaticBody3D" groups=["entity"]]
@ -78,7 +78,7 @@ label = "stop"
icon = true
[node name="Panel" parent="." instance=ExtResource("5_j3gsb")]
material_override = SubResource("ShaderMaterial_mq5r1")
mesh = SubResource("QuadMesh_x7s0p")
material_override = SubResource("ShaderMaterial_h0yvw")
mesh = SubResource("QuadMesh_a23j8")
size = Vector2(0.32, 0.16)
corner_radius = 0.8

View File

@ -30427,7 +30427,7 @@ pixel_size = 0.001
render_priority = 15
sprite_frames = SubResource("SpriteFrames_71wxj")
animation = &"sleet"
frame_progress = 0.23404
frame_progress = 0.689981
[node name="WeatherLabel" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.05, 0.02, 0)

View File

@ -47,6 +47,9 @@ func _ready():
toggle_menu()
elif action.name == "by_button":
House.body.mini_view.small.value=!House.body.mini_view.small.value
elif action.name == "ax_button":
if take_screenshot():
EventSystem.notify("Screenshot taken", EventNotify.Type.INFO)
)
EventSystem.on_focus_in.connect(func(event):
@ -115,6 +118,9 @@ func _input(event):
if event is InputEventKey and Input.is_key_pressed(KEY_F10):
var vp = get_viewport()
vp.debug_draw = (vp.debug_draw + 1) % 5
if event is InputEventKey and Input.is_key_pressed(KEY_F2):
take_screenshot()
if event is InputEventKey and Input.is_key_pressed(KEY_M):
toggle_menu()
@ -138,3 +144,26 @@ func vector_key_mapping(key_positive_x: int, key_negative_x: int, key_positive_y
vec = vec.normalized()
return vec
func take_screenshot():
var vp = get_viewport()
var texture = vp.get_texture()
var image = texture.get_image()
var file_name = "%s.png" % Time.get_datetime_string_from_system().replace(":", "-")
if image == null:
return false
if OS.get_name() == "Android":
var path = OS.get_system_dir(OS.SYSTEM_DIR_PICTURES, false) + "/immersive-home/" + file_name
if not FileAccess.file_exists(path):
var dir = path.get_base_dir()
DirAccess.open("user://").make_dir_recursive(dir)
image.save_png(path)
else:
image.save_png("user://screenshots/%s.png" % Time.get_datetime_string_from_system().replace(":", "-"))
return true

View File

@ -20,6 +20,8 @@ shape = SubResource("SphereShape3D_3wgjq")
[node name="Label3D" type="Label3D" parent="."]
pixel_size = 0.002
billboard = 1
render_priority = 15
outline_render_priority = 14
text = "lightbulb"
font = ExtResource("4_504vw")
font_size = 100

View File

@ -4,7 +4,7 @@
[ext_resource type="Texture2D" uid="uid://bbuq4wn7e5o2q" path="res://content/system/house/mini/temp_gradient.tres" id="2_3lwi8"]
[resource]
render_priority = 10
render_priority = 9
shader = ExtResource("1_sbr3e")
shader_parameter/data = PackedFloat32Array()
shader_parameter/data_size = 0

View File

@ -31,7 +31,7 @@ var base_scale = {
HeatmapType.HUMIDITY: Vector2(0.0, 100.0)
}
var selected_scale = R.state(Vector2(0.0, 1.0))
var opacity = R.state(30)
var opacity = R.state(70)
var heatmap_type = R.state(HeatmapType.NONE)
var small = R.state(false)
@ -106,7 +106,7 @@ func _ready():
camera_position.y *= 0.5
camera_direction.y=0
var target_position=camera_position + camera_direction.normalized() * 0.2
var target_position=camera_position + camera_direction.normalized() * 0.5
var new_position=target_position - center * 0.1
tween.tween_property(small_node, "scale", Vector3(0.1, 0.1, 0.1), 0.5)

View File

@ -245,13 +245,13 @@ custom_template/release=""
gradle_build/use_gradle_build=true
gradle_build/export_format=0
gradle_build/min_sdk=""
gradle_build/target_sdk=""
gradle_build/target_sdk="32"
architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
version/code=15
version/name="v0.5.0"
version/code=16
version/name="v0.6.0"
package/unique_name="de.nitwel.$genname"
package/name="Immersive Home"
package/signed=true

View File

@ -66,6 +66,22 @@ func save_local(path=_save_path):
var json_text = JSON.stringify(data)
save_file.store_line(json_text)
# var path2 = OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS, false) + "/immersive-home/" + path.split("/")[- 1]
# path2 = path2.replace("/Android/data/org.godotengine.immersivehome/files", "")
# print(path2)
# if not FileAccess.file_exists(path2):
# var dir = path2.get_base_dir()
# DirAccess.open("user://").make_dir_recursive(dir)
# var save_file2 = FileAccess.open(path2, FileAccess.WRITE)
# if save_file2 == null:
# return false
# save_file2.store_line(json_text)
on_saved.emit()
return true

View File

@ -29,6 +29,10 @@ EventSystem="*res://lib/globals/event_system.gd"
House="*res://lib/globals/house_body.gd"
Request="*res://lib/globals/request.gd"
[display]
window/vsync/vsync_mode=0
[editor_plugins]
enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg")