From a2e2e0f18cd96a361fe3593335c33f8c887ea66c Mon Sep 17 00:00:00 2001 From: teatov Date: Fri, 8 Aug 2025 15:34:09 +1000 Subject: [PATCH] make key material local to scene --- assets/models/key.bin | 2 +- assets/models/key.gltf | 272 +++++++++++++++---------------- resources/materials/key_mat.tres | 1 + scenes/game_key.tscn | 18 +- 4 files changed, 143 insertions(+), 150 deletions(-) diff --git a/assets/models/key.bin b/assets/models/key.bin index d004b65..c5c46cd 100644 --- a/assets/models/key.bin +++ b/assets/models/key.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d99c0544c1faf02e851893649df34d36233f0bf679e31c385e8ec594cb83d6e +oid sha256:48990d2e8f47b8fe80b625fcc772f04cf53617c4ff1cfd08c0536fe40b0024e5 size 8344 diff --git a/assets/models/key.gltf b/assets/models/key.gltf index 1c477a8..93b91f0 100644 --- a/assets/models/key.gltf +++ b/assets/models/key.gltf @@ -8,12 +8,21 @@ { "name":"Collection", "nodes":[ - 5, + 0, 6 ] } ], "nodes":[ + { + "mesh":0, + "name":"NubMesh", + "translation":[ + 0, + 0.25, + 0.42500001192092896 + ] + }, { "name":"TopLeft", "translation":[ @@ -47,86 +56,59 @@ ] }, { - "mesh":0, + "mesh":1, "name":"KeyMesh", "skin":0 }, { "children":[ - 4, - 0, + 5, 1, 2, - 3 + 3, + 4 ], "name":"KeyArmature" - }, - { - "mesh":1, - "name":"NubMesh", - "translation":[ - 0, - 0.25, - 0.42500001192092896 - ] - } - ], - "materials":[ - { - "doubleSided":true, - "name":"key_mat", - "pbrMetallicRoughness":{ - "baseColorFactor":[ - 0.800000011920929, - 0.800000011920929, - 0.800000011920929, - 1 - ], - "metallicFactor":0, - "roughnessFactor":0.5 - } } ], "meshes":[ { - "name":"KeyMesh", + "name":"NubMesh", "primitives":[ { "attributes":{ "POSITION":0, "NORMAL":1, - "TEXCOORD_0":2, - "JOINTS_0":3, - "WEIGHTS_0":4 + "TEXCOORD_0":2 }, - "indices":5, - "material":0 + "indices":3 } ] }, { - "name":"NubMesh", + "name":"KeyMesh", "primitives":[ { "attributes":{ - "POSITION":7, - "NORMAL":8, - "TEXCOORD_0":9 + "POSITION":4, + "NORMAL":5, + "TEXCOORD_0":6, + "JOINTS_0":7, + "WEIGHTS_0":8 }, - "indices":10, - "material":0 + "indices":9 } ] } ], "skins":[ { - "inverseBindMatrices":6, + "inverseBindMatrices":10, "joints":[ - 0, 1, 2, - 3 + 3, + 4 ], "name":"KeyArmature" } @@ -135,58 +117,6 @@ { "bufferView":0, "componentType":5126, - "count":115, - "max":[ - 0.5, - 0.2500000596046448, - 0.5 - ], - "min":[ - -0.5, - -0.25000008940696716, - -0.5 - ], - "type":"VEC3" - }, - { - "bufferView":1, - "componentType":5126, - "count":115, - "type":"VEC3" - }, - { - "bufferView":2, - "componentType":5126, - "count":115, - "type":"VEC2" - }, - { - "bufferView":3, - "componentType":5121, - "count":115, - "type":"VEC4" - }, - { - "bufferView":4, - "componentType":5126, - "count":115, - "type":"VEC4" - }, - { - "bufferView":5, - "componentType":5123, - "count":564, - "type":"SCALAR" - }, - { - "bufferView":6, - "componentType":5126, - "count":4, - "type":"MAT4" - }, - { - "bufferView":7, - "componentType":5126, "count":25, "max":[ 0.15000000596046448, @@ -201,89 +131,141 @@ "type":"VEC3" }, { - "bufferView":8, + "bufferView":1, "componentType":5126, "count":25, "type":"VEC3" }, { - "bufferView":9, + "bufferView":2, "componentType":5126, "count":25, "type":"VEC2" }, { - "bufferView":10, + "bufferView":3, "componentType":5123, "count":90, "type":"SCALAR" + }, + { + "bufferView":4, + "componentType":5126, + "count":115, + "max":[ + 0.5, + 0.2500000596046448, + 0.5 + ], + "min":[ + -0.5, + -0.25000008940696716, + -0.5 + ], + "type":"VEC3" + }, + { + "bufferView":5, + "componentType":5126, + "count":115, + "type":"VEC3" + }, + { + "bufferView":6, + "componentType":5126, + "count":115, + "type":"VEC2" + }, + { + "bufferView":7, + "componentType":5121, + "count":115, + "type":"VEC4" + }, + { + "bufferView":8, + "componentType":5126, + "count":115, + "type":"VEC4" + }, + { + "bufferView":9, + "componentType":5123, + "count":564, + "type":"SCALAR" + }, + { + "bufferView":10, + "componentType":5126, + "count":4, + "type":"MAT4" } ], "bufferViews":[ { "buffer":0, - "byteLength":1380, + "byteLength":300, "byteOffset":0, "target":34962 }, - { - "buffer":0, - "byteLength":1380, - "byteOffset":1380, - "target":34962 - }, - { - "buffer":0, - "byteLength":920, - "byteOffset":2760, - "target":34962 - }, - { - "buffer":0, - "byteLength":460, - "byteOffset":3680, - "target":34962 - }, - { - "buffer":0, - "byteLength":1840, - "byteOffset":4140, - "target":34962 - }, - { - "buffer":0, - "byteLength":1128, - "byteOffset":5980, - "target":34963 - }, - { - "buffer":0, - "byteLength":256, - "byteOffset":7108 - }, { "buffer":0, "byteLength":300, - "byteOffset":7364, - "target":34962 - }, - { - "buffer":0, - "byteLength":300, - "byteOffset":7664, + "byteOffset":300, "target":34962 }, { "buffer":0, "byteLength":200, - "byteOffset":7964, + "byteOffset":600, "target":34962 }, { "buffer":0, "byteLength":180, - "byteOffset":8164, + "byteOffset":800, "target":34963 + }, + { + "buffer":0, + "byteLength":1380, + "byteOffset":980, + "target":34962 + }, + { + "buffer":0, + "byteLength":1380, + "byteOffset":2360, + "target":34962 + }, + { + "buffer":0, + "byteLength":920, + "byteOffset":3740, + "target":34962 + }, + { + "buffer":0, + "byteLength":460, + "byteOffset":4660, + "target":34962 + }, + { + "buffer":0, + "byteLength":1840, + "byteOffset":5120, + "target":34962 + }, + { + "buffer":0, + "byteLength":1128, + "byteOffset":6960, + "target":34963 + }, + { + "buffer":0, + "byteLength":256, + "byteOffset":8088 } ], "buffers":[ diff --git a/resources/materials/key_mat.tres b/resources/materials/key_mat.tres index 534966b..faff731 100644 --- a/resources/materials/key_mat.tres +++ b/resources/materials/key_mat.tres @@ -1,5 +1,6 @@ [gd_resource type="StandardMaterial3D" format=3 uid="uid://dkydluksv2ry0"] [resource] +resource_local_to_scene = true albedo_color = Color(0.125911, 0.125911, 0.125911, 1) roughness = 0.6 diff --git a/scenes/game_key.tscn b/scenes/game_key.tscn index 1e50a14..48fdc98 100644 --- a/scenes/game_key.tscn +++ b/scenes/game_key.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://bryima34hc3yp"] +[gd_scene load_steps=21 format=3 uid="uid://bryima34hc3yp"] [ext_resource type="Script" uid="uid://cl0asbgqd3anu" path="res://scripts/game_key.gd" id="1_sypr4"] [ext_resource type="AudioStream" uid="uid://bq0ikue882kg6" path="res://assets/sfx/keyboard/typing/press_01.wav" id="2_cqjrw"] @@ -16,6 +16,7 @@ [ext_resource type="AudioStream" uid="uid://41d8y11au44e" path="res://assets/sfx/keyboard/typing/release_06.wav" id="14_kt0yx"] [ext_resource type="AudioStream" uid="uid://8rgf5ic4w1r3" path="res://assets/sfx/keyboard/typing/release_07.wav" id="15_w7o33"] [ext_resource type="PackedScene" uid="uid://d4ffyk6iou3ns" path="res://assets/models/key.gltf" id="16_cqjrw"] +[ext_resource type="Material" uid="uid://dkydluksv2ry0" path="res://resources/materials/key_mat.tres" id="17_p6qfn"] [sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_agrko"] random_pitch = 1.1 @@ -60,13 +61,23 @@ _release_sfx = SubResource("AudioStreamRandomizer_ch32x") [node name="Model" parent="." instance=ExtResource("16_cqjrw")] +[node name="NubMesh" parent="Model" index="0"] +surface_material_override/0 = ExtResource("17_p6qfn") + +[node name="KeyMesh" parent="Model/KeyArmature/Skeleton3D" index="0"] +surface_material_override/0 = ExtResource("17_p6qfn") + [node name="ModelSecondary" parent="." instance=ExtResource("16_cqjrw")] +[node name="NubMesh" parent="ModelSecondary" index="0"] +visible = false +surface_material_override/0 = ExtResource("17_p6qfn") + [node name="Skeleton3D" parent="ModelSecondary/KeyArmature" index="0"] visible = false -[node name="NubMesh" parent="ModelSecondary" index="1"] -visible = false +[node name="KeyMesh" parent="ModelSecondary/KeyArmature/Skeleton3D" index="0"] +surface_material_override/0 = ExtResource("17_p6qfn") [node name="Labels" type="Node3D" parent="."] @@ -161,7 +172,6 @@ outline_size = 0 [node name="Effects" type="Node3D" parent="."] [node name="PressLight" type="OmniLight3D" parent="Effects"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0) visible = false light_color = Color(1, 0.687333, 0.33, 1) light_energy = 6.0