-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_combine2.gd
More file actions
49 lines (45 loc) · 1.86 KB
/
Copy pathdebug_combine2.gd
File metadata and controls
49 lines (45 loc) · 1.86 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
37
38
39
40
41
42
43
44
45
46
47
48
49
## Debug: validate all combined array sizes before add_surface_from_arrays.
extends SceneTree
func _init() -> void:
var recipe := SKRecipe.load_from_file("res://synty_assets/characters/Starter_01.sk")
var library := SKPartLibrary.new()
library.scan()
var builder := SKCharacterBuilder.new(library, null)
builder.combine_meshes = false
var character := builder.build(recipe)
var parts: Array = character.find_children("*", "MeshInstance3D", true, false)
# Per-part structure survey.
var total_vertices := 0
var modes := {}
var influence_counts := {}
var indexless := 0
var tangentless := 0
for mesh_instance: MeshInstance3D in parts:
var mesh := mesh_instance.mesh as ArrayMesh
modes[mesh.blend_shape_mode] = modes.get(mesh.blend_shape_mode, 0) + 1
for s in mesh.get_surface_count():
var arrays := mesh.surface_get_arrays(s)
var vcount := (arrays[Mesh.ARRAY_VERTEX] as PackedVector3Array).size()
total_vertices += vcount
if arrays[Mesh.ARRAY_INDEX] == null:
indexless += 1
if arrays[Mesh.ARRAY_TANGENT] == null:
tangentless += 1
var bones = arrays[Mesh.ARRAY_BONES]
if bones != null and vcount > 0:
var inf := int(bones.size() / float(vcount))
influence_counts[inf] = influence_counts.get(inf, 0) + 1
print("parts=%d verts=%d modes=%s influences=%s indexless=%d tangentless=%d" % [
parts.size(), total_vertices, modes, influence_counts, indexless, tangentless])
# Union sizes of blend names (full vs suffix).
var full := {}
var suffix := {}
for mesh_instance: MeshInstance3D in parts:
var mesh := mesh_instance.mesh as ArrayMesh
for b in mesh.get_blend_shape_count():
var shape_name := String(mesh.get_blend_shape_name(b))
full[shape_name] = true
suffix[shape_name.get_slice(".", shape_name.get_slice_count(".") - 1)] = true
print("blend union: full=%d suffix=%d" % [full.size(), suffix.size()])
character.free()
quit(0)