Quiet visual asset image checks

This commit is contained in:
2026-06-20 11:27:18 +09:00
parent c1e4c69eff
commit 7d9eba56b5

View File

@@ -5536,9 +5536,8 @@ func _check_alpha_cutout_path(failures: Array[String], path: String, context: St
if not FileAccess.file_exists(path):
failures.append("%s references missing image: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable image: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512:
@@ -5569,9 +5568,8 @@ func _check_toolbar_icon_path(failures: Array[String], path: String, context: St
if not FileAccess.file_exists(path):
failures.append("%s references missing icon: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable icon: %s" % [context, path])
return
if image.get_width() < 128 or image.get_height() < 128:
@@ -5613,9 +5611,8 @@ func _check_panel_texture_path(failures: Array[String], path: String, context: S
if not FileAccess.file_exists(path):
failures.append("%s references missing panel texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable panel texture: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512:
@@ -5668,9 +5665,8 @@ func _check_button_texture_path(failures: Array[String], path: String, context:
if not FileAccess.file_exists(path):
failures.append("%s references missing button texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable button texture: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 192:
@@ -5726,9 +5722,8 @@ func _check_icon_button_texture_path(failures: Array[String], path: String, cont
if not FileAccess.file_exists(path):
failures.append("%s references missing icon button texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable icon button texture: %s" % [context, path])
return
if image.get_width() < 256 or image.get_height() < 256:
@@ -5790,6 +5785,27 @@ func _image_visible_warm_bias(image: Image, sample_step: int) -> float:
return total_bias / float(visible_samples)
func _load_smoke_image(path: String) -> Image:
var bytes := FileAccess.get_file_as_bytes(path)
if bytes.is_empty():
return null
var image := Image.new()
var lower_path := path.to_lower()
var err := OK
if lower_path.ends_with(".png"):
err = image.load_png_from_buffer(bytes)
elif lower_path.ends_with(".jpg") or lower_path.ends_with(".jpeg"):
err = image.load_jpg_from_buffer(bytes)
elif lower_path.ends_with(".webp"):
err = image.load_webp_from_buffer(bytes)
else:
var disk_path := ProjectSettings.globalize_path(path) if path.begins_with("res://") or path.begins_with("user://") else path
err = image.load(disk_path)
if err != OK:
return null
return image
func _check_tile_marker_texture_path(failures: Array[String], path: String, context: String) -> void:
if path.is_empty():
failures.append("%s has an empty marker path" % context)
@@ -5800,9 +5816,8 @@ func _check_tile_marker_texture_path(failures: Array[String], path: String, cont
if not FileAccess.file_exists(path):
failures.append("%s references missing tile marker texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable tile marker texture: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512:
@@ -5855,9 +5870,8 @@ func _check_class_icon_texture_path(failures: Array[String], path: String, conte
if not FileAccess.file_exists(path):
failures.append("%s references missing class icon texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable class icon texture: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512:
@@ -5910,9 +5924,8 @@ func _check_map_badge_texture_path(failures: Array[String], path: String, contex
if not FileAccess.file_exists(path):
failures.append("%s references missing map badge texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable map badge texture: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512:
@@ -5965,9 +5978,8 @@ func _check_terrain_texture_path(failures: Array[String], path: String, context:
if not FileAccess.file_exists(path):
failures.append("%s references missing texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable texture: %s" % [context, path])
return
if image.get_width() < 128 or image.get_height() < 128:
@@ -5995,9 +6007,8 @@ func _check_terrain_feature_texture_path(failures: Array[String], path: String,
if not FileAccess.file_exists(path):
failures.append("%s references missing terrain feature texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable terrain feature texture: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512:
@@ -6046,9 +6057,8 @@ func _check_image_path(failures: Array[String], path: String, context: String) -
if not FileAccess.file_exists(path):
failures.append("%s references missing image: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
var image := _load_smoke_image(path)
if image == null:
failures.append("%s references unreadable image: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512: