32 lines
1.3 KiB
GDScript
32 lines
1.3 KiB
GDScript
extends SceneTree
|
|
func _initialize() -> void:
|
|
for path in ["res://assets/weapons/v_9mmar", "res://assets/zombies/zombie_textured",
|
|
"res://assets/weapons/grenade", "res://assets/boss/agrunt_textured",
|
|
"res://assets/boss/hornet_textured"]:
|
|
var scene: PackedScene = load(path + ".mdl")
|
|
assert(scene != null)
|
|
var node := scene.instantiate()
|
|
var textured := 0
|
|
for mesh in node.find_children("*", "MeshInstance3D", true, false):
|
|
for i in mesh.mesh.get_surface_count():
|
|
var material = mesh.mesh.surface_get_material(i)
|
|
assert(material is StandardMaterial3D and material.albedo_texture != null)
|
|
textured += 1
|
|
assert(textured > 0)
|
|
if path.contains("/boss/"):
|
|
var anim := node.get_node_or_null("AnimationPlayer") as AnimationPlayer
|
|
if anim != null:
|
|
for label in anim.get_animation_list():
|
|
anim.get_animation(label).loop_mode = Animation.LOOP_LINEAR if label in [
|
|
"idle1", "idle", "walk", "run"] else Animation.LOOP_NONE
|
|
if path.contains("/boss/"):
|
|
var packed := PackedScene.new()
|
|
assert(packed.pack(node) == OK)
|
|
assert(ResourceSaver.save(packed, path + ".scn") == OK)
|
|
else:
|
|
# Preserve the established export of unchanged weapons/zombie scenes.
|
|
assert(ResourceSaver.save(scene, path + ".scn") == OK)
|
|
print("NATIVE SCENE VERIFIED ", path, " surfaces=", textured)
|
|
node.free()
|
|
quit()
|