@@ -3,6 +3,7 @@ class_name VMTLoader extends RefCounted
33
44static var texture_sizes_cache : Dictionary = {};
55static var cached_materials : Dictionary = {};
6+ static var logged_materials : Array [String ] = [];
67
78static func is_file_valid (path : String ):
89 var import_path = path + ".import" ;
@@ -94,6 +95,7 @@ static func normalize_path(path: String) -> String:
9495static func clear_cache ():
9596 cached_materials = {};
9697 texture_sizes_cache = {};
98+ logged_materials = [];
9799
98100static func has_material (material : String ) -> bool :
99101 var material_path = normalize_path (VMFConfig .materials .target_folder + "/" + material + ".tres" ).to_lower ();
@@ -108,6 +110,7 @@ static func has_material(material: String) -> bool:
108110
109111static func get_material (material : String ):
110112 cached_materials = cached_materials if cached_materials else {};
113+ logged_materials = logged_materials if logged_materials else [];
111114
112115 if material in cached_materials :
113116 return cached_materials [material ];
@@ -118,7 +121,10 @@ static func get_material(material: String):
118121 material_path = material_path .replace (".tres" , ".vmt" );
119122
120123 if not ResourceLoader .exists (material_path ):
121- VMFLogger .warn ("Material not found: " + material_path );
124+ if not logged_materials .has (material_path ):
125+ VMFLogger .warn ("Material not found: " + material_path );
126+ logged_materials .append (material_path );
127+
122128 material_path = VMFConfig .materials .fallback_material
123129
124130 if not material_path or not ResourceLoader .exists (material_path ): return null ;
0 commit comments