extends SceneTree ## Persist native scenes: both native simulation and future Web exports need no MDL plugin. func _initialize() -> void: for stem in ["agrunt", "hornet"]: var path := "res://assets/boss/%s_textured" % stem var scene: PackedScene = load(path + ".mdl") assert(scene != null) var model := scene.instantiate() var surfaces := 0 var bounds := AABB() for mesh in model.find_children("*", "MeshInstance3D", true, false): bounds = bounds.merge(mesh.transform * mesh.get_aabb()) 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) surfaces += 1 assert(surfaces > 0) var anim: AnimationPlayer = model.get_node_or_null("AnimationPlayer") if anim != null: for label in anim.get_animation_list(): var clip := anim.get_animation(label) clip.loop_mode = Animation.LOOP_LINEAR if label in ["idle1", "idle", "walk", "run"] else Animation.LOOP_NONE print(stem, " animations=", anim.get_animation_list()) var packed := PackedScene.new() assert(packed.pack(model) == OK) assert(ResourceSaver.save(packed, path + ".scn") == OK) print("NATIVE BOSS VERIFIED ", stem, " surfaces=", surfaces, " bounds=", bounds) model.free() quit()