From 24b053793fa28b78fc72c85a840593cc013784b8 Mon Sep 17 00:00:00 2001 From: Ochman Date: Sun, 14 Jan 2024 23:54:37 +0100 Subject: [PATCH] Add material for generated SpriteMesh --- demo/addons/sprite_mesh/sprite_mesh_instance.gd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/addons/sprite_mesh/sprite_mesh_instance.gd b/demo/addons/sprite_mesh/sprite_mesh_instance.gd index 8803e43..3973edd 100644 --- a/demo/addons/sprite_mesh/sprite_mesh_instance.gd +++ b/demo/addons/sprite_mesh/sprite_mesh_instance.gd @@ -114,13 +114,13 @@ func _generate_sprite_mesh() -> SpriteMesh: if texture == null: return sprite_mesh - sprite_mesh.meshes = _generate_meshes() sprite_mesh.material = _generate_material() + sprite_mesh.meshes = _generate_meshes(sprite_mesh.material) return sprite_mesh -func _generate_meshes() -> Array[ArrayMesh]: +func _generate_meshes(material: StandardMaterial3D) -> Array[ArrayMesh]: var meshes: Array[ArrayMesh] = [] var st := SurfaceTool.new() @@ -148,7 +148,7 @@ func _generate_meshes() -> Array[ArrayMesh]: st.generate_tangents() st.optimize_indices_for_cache() - + st.set_material(material) meshes.append(st.commit()) st.clear()