Skip to content

Commit

Permalink
Merge pull request #138 from Nitwel/improvements
Browse files Browse the repository at this point in the history
Improvements
  • Loading branch information
Nitwel committed May 3, 2024
2 parents e6dcb94 + b37b682 commit a86b560
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/assets/design.afdesign
Git LFS file not shown
2 changes: 1 addition & 1 deletion app/assets/environment.tres
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/content/entities/entity.gd
Original file line number Diff line number Diff line change
@@ -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))

Expand Down
5 changes: 4 additions & 1 deletion app/content/entities/light/light.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
8 changes: 4 additions & 4 deletions app/content/entities/timer/timer.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"]]
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/content/entities/weather/weather.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
29 changes: 29 additions & 0 deletions app/content/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand All @@ -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
2 changes: 2 additions & 0 deletions app/content/system/dot/dot.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/content/system/house/mini/mini_wall.tres
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/content/system/house/mini/miniature.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions app/export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions app/lib/stores/store.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a86b560

Please sign in to comment.