-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_combine.gd
More file actions
36 lines (33 loc) · 1.45 KB
/
Copy pathdebug_combine.gd
File metadata and controls
36 lines (33 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Debug: inspect blend shape array layouts of imported part meshes.
extends SceneTree
func _init() -> void:
var scene: PackedScene = load("res://synty_assets/meshes/Species/Humans/SK_HUMN_BASE_01_01HEAD_HU01.fbx")
var instance := scene.instantiate()
var mesh_instance: MeshInstance3D = null
var stack := [instance]
while not stack.is_empty():
var node: Node = stack.pop_back()
if node is MeshInstance3D and (node as MeshInstance3D).mesh != null:
mesh_instance = node
break
stack.append_array(node.get_children())
var mesh := mesh_instance.mesh as ArrayMesh
print("mesh: %s, surfaces=%d, blend shapes=%d, mode=%d" % [
mesh.resource_name, mesh.get_surface_count(), mesh.get_blend_shape_count(), mesh.blend_shape_mode])
var arrays := mesh.surface_get_arrays(0)
var vcount := (arrays[Mesh.ARRAY_VERTEX] as PackedVector3Array).size()
print("base: vcount=%d" % vcount)
for k in Mesh.ARRAY_MAX:
if arrays[k] != null:
print(" base array[%d]: %s size=%s" % [k, typeof(arrays[k]), arrays[k].size() if arrays[k] is Array or "size" in ["x"] else str(arrays[k].size())])
var blends := mesh.surface_get_blend_shape_arrays(0)
print("blend entries: %d" % blends.size())
for b in mini(3, blends.size()):
var entry: Array = blends[b]
var sizes := []
for k in Mesh.ARRAY_MAX:
if entry[k] != null:
sizes.append("[%d]=%d" % [k, entry[k].size()])
print(" shape %d (%s): %s" % [b, mesh.get_blend_shape_name(b), ", ".join(sizes)])
instance.free()
quit(0)