7bc241bbe6
Group all raw art by role under art/ (characters, levels, weapons, fx, anim, textures, ui, icons, fonts, hdri, materials), matching the earlier code reorg. Files are snake_case; asset uids are preserved so uid:// refs still resolve, and every res:// path reference is rewritten across scenes, scripts and project.godot. - Move the used assets out of Assets/ Animations/ fonts/ HUD/ HDRI/ Materials/ into art/; remove those dirs. - Materials snake_cased: barrel_metal, barrel_wood, bear_claw_fx, fire. - Delete unreferenced assets: alternate models, empty stub scripts, superseded BEAR_*.tres, marketing/spare PNGs, a spare font weight and the orphan M_Barrel_wood.gdshader. - Blender: drop .blend auto-backups and matador_v01/v02 (+ stale v02 fbx); keep matador_v03 and repoint create_matador_anims.py to it. .gitignore now blocks all Blender/*.blend[0-9] backups. - GLB Extract-Textures siblings (art/levels/*.png) kept and tracked. - Document the art/ layout in CLAUDE.md. Headless suite green; menu and gameplay shell boot clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FBbGXbzg3SD6ZBSadPPF5H
94 lines
3.2 KiB
GDScript
94 lines
3.2 KiB
GDScript
extends SceneTree
|
|
## Guard for the web/mobile rigid-skin conversion (rigid_skin.gd). The bug it protects against:
|
|
## the converter used to key geometry by destination bone only, so every surface funnelled to a
|
|
## bone collapsed onto one material — matadors came out bald with the wrong uniform colour on the
|
|
## web build. It now keys per (bone, surface), so all source materials survive. This asserts the
|
|
## matador keeps every distinct material after conversion, produces bone-attached pieces, and
|
|
## hides the original skinned meshes (so they never hit the invisible-on-Mali skinning path).
|
|
## Run: godot --headless --script res://tests/rigid_skin_test.gd
|
|
|
|
const RigidSkin = preload("res://systems/render/rigid_skin.gd")
|
|
|
|
var _pass := 0
|
|
var _fail := 0
|
|
|
|
|
|
func _init() -> void:
|
|
_run.call_deferred()
|
|
|
|
|
|
func _ok(c: bool, m: String) -> void:
|
|
if c:
|
|
_pass += 1
|
|
print(" PASS: ", m)
|
|
else:
|
|
_fail += 1
|
|
print(" FAIL: ", m)
|
|
|
|
|
|
func _surface_mats(mi: MeshInstance3D) -> Array:
|
|
var out: Array = []
|
|
var mesh := mi.mesh
|
|
if mesh == null:
|
|
return out
|
|
for s: int in mesh.get_surface_count():
|
|
var mat: Material = mi.material_override
|
|
if mat == null:
|
|
mat = mi.get_surface_override_material(s)
|
|
if mat == null:
|
|
mat = mesh.surface_get_material(s)
|
|
if mat != null and not out.has(mat):
|
|
out.append(mat)
|
|
return out
|
|
|
|
|
|
func _run() -> void:
|
|
var inst: Node = (load("res://art/characters/matador.glb") as PackedScene).instantiate()
|
|
root.add_child(inst)
|
|
|
|
# Distinct materials on the skinned source meshes, before conversion.
|
|
var source: Array = []
|
|
var skinned: Array = []
|
|
for mi: MeshInstance3D in inst.find_children("*", "MeshInstance3D", true, false):
|
|
if mi.skin != null:
|
|
skinned.append(mi)
|
|
for mat: Material in _surface_mats(mi):
|
|
if not source.has(mat):
|
|
source.append(mat)
|
|
_ok(source.size() >= 2, "matador source has multiple distinct materials (%d)" % source.size())
|
|
|
|
var converted := RigidSkin.convert_tree(inst)
|
|
_ok(converted > 0, "convert_tree rebuilt %d skinned mesh(es)" % converted)
|
|
|
|
# Distinct materials on the generated bone-attached pieces.
|
|
var pieces := 0
|
|
var piece_mats: Array = []
|
|
for att: BoneAttachment3D in inst.find_children("*", "BoneAttachment3D", true, false):
|
|
for mi: MeshInstance3D in att.find_children("*", "MeshInstance3D", true, false):
|
|
pieces += 1
|
|
var mesh := mi.mesh
|
|
if mesh == null:
|
|
continue
|
|
# Pieces are multi-surface now (a bone's materials each stay their own surface), so
|
|
# scan every surface — not just surface 0 — to confirm none were dropped.
|
|
for s: int in mesh.get_surface_count():
|
|
var mat := mesh.surface_get_material(s)
|
|
if mat != null and not piece_mats.has(mat):
|
|
piece_mats.append(mat)
|
|
_ok(pieces > 0, "conversion produced bone-attached pieces (%d)" % pieces)
|
|
_ok(piece_mats.size() >= source.size(),
|
|
"every source material survives conversion (%d of %d kept)" % [piece_mats.size(), source.size()])
|
|
|
|
var all_hidden := true
|
|
for mi: MeshInstance3D in skinned:
|
|
if mi.visible:
|
|
all_hidden = false
|
|
_ok(all_hidden, "original skinned meshes are hidden (never drawn on the failing path)")
|
|
|
|
_finish()
|
|
|
|
|
|
func _finish() -> void:
|
|
print("Results: %d passed, %d failed" % [_pass, _fail])
|
|
quit(1 if _fail > 0 else 0)
|