Island modelling rework with vertex fixes
This commit is contained in:
parent
9557989d7c
commit
2f30691808
30 changed files with 652 additions and 71 deletions
26
README.md
26
README.md
|
|
@ -38,6 +38,32 @@ scripts/run_validations.sh quick
|
|||
Additional suites and individual commands are documented in
|
||||
[`docs/TESTING.md`](docs/TESTING.md).
|
||||
|
||||
## Texture import normalization
|
||||
|
||||
Texture import settings are cached in `.import` sidecars. To keep new textures
|
||||
consistent by default, normalize imported textures before committing:
|
||||
|
||||
```sh
|
||||
./scripts/normalize_texture_profiles.sh
|
||||
```
|
||||
|
||||
To normalize only a specific directory (for example environment textures):
|
||||
|
||||
```sh
|
||||
./scripts/normalize_texture_profiles.sh res://art/exported/environment/textures
|
||||
```
|
||||
|
||||
The script enforces a single baseline texture profile by default and sets
|
||||
`import_profile = "managed_default"` in `[params]`. If any texture needs
|
||||
custom settings, set:
|
||||
|
||||
```ini
|
||||
[params]
|
||||
import_profile="custom"
|
||||
```
|
||||
|
||||
in its `.import` file to opt it out.
|
||||
|
||||
## Building
|
||||
|
||||
Export presets are maintained for Linux, Windows, and Android. Repository
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -15,7 +15,7 @@ dest_files=["res://.godot/imported/cliff_wall.png-7ce756d49c24c7b8fdda307d68086d
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
|
|
@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0
|
|||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
|
@ -37,4 +37,5 @@ process/normal_map_invert_y=false
|
|||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
|
|||
BIN
art/exported/environment/textures/dirt.png
Normal file
BIN
art/exported/environment/textures/dirt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
41
art/exported/environment/textures/dirt.png.import
Normal file
41
art/exported/environment/textures/dirt.png.import
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b2ce1ikmnbktx"
|
||||
path="res://.godot/imported/dirt.png-ca5bf3f3fbf583edaa719ac8c686549d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/exported/environment/textures/dirt.png"
|
||||
dest_files=["res://.godot/imported/dirt.png-ca5bf3f3fbf583edaa719ac8c686549d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
BIN
art/exported/environment/textures/dirt_light_wall.png
Normal file
BIN
art/exported/environment/textures/dirt_light_wall.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
41
art/exported/environment/textures/dirt_light_wall.png.import
Normal file
41
art/exported/environment/textures/dirt_light_wall.png.import
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dtv2k327higrb"
|
||||
path="res://.godot/imported/dirt_light_wall.png-40336902aac8516f68e99f8e8988d86f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/exported/environment/textures/dirt_light_wall.png"
|
||||
dest_files=["res://.godot/imported/dirt_light_wall.png-40336902aac8516f68e99f8e8988d86f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
@ -15,7 +15,7 @@ dest_files=["res://.godot/imported/dirt_wall.png-8ba7bb24831d83f929bfa44b53af928
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
|
|
@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0
|
|||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
|
@ -37,4 +37,5 @@ process/normal_map_invert_y=false
|
|||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ dest_files=["res://.godot/imported/grass.png-4d1108b11a421d9c16bd72fb0bc993d3.ct
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
|
|
@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0
|
|||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
|
@ -37,4 +37,5 @@ process/normal_map_invert_y=false
|
|||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ dest_files=["res://.godot/imported/grass_heavy.png-ba7f679d1bc5402f8b0a3465ac6a4
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
|
|
@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0
|
|||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
|
@ -37,4 +37,5 @@ process/normal_map_invert_y=false
|
|||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
|
|||
|
|
@ -40,3 +40,4 @@ process/hdr_as_srgb=false
|
|||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
|
|||
|
|
@ -40,3 +40,4 @@ process/hdr_as_srgb=false
|
|||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
|
|||
|
|
@ -40,3 +40,4 @@ process/hdr_as_srgb=false
|
|||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
|
|
|
|||
BIN
art/exported/environment/textures/sand_dark.png
Normal file
BIN
art/exported/environment/textures/sand_dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
41
art/exported/environment/textures/sand_dark.png.import
Normal file
41
art/exported/environment/textures/sand_dark.png.import
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cyukfgkghrigk"
|
||||
path="res://.godot/imported/sand_dark.png-ab4ec28097312f566fe7b882978a5858.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/exported/environment/textures/sand_dark.png"
|
||||
dest_files=["res://.godot/imported/sand_dark.png-ab4ec28097312f566fe7b882978a5858.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
BIN
art/exported/environment/textures/sand_lite.png
Normal file
BIN
art/exported/environment/textures/sand_lite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
41
art/exported/environment/textures/sand_lite.png.import
Normal file
41
art/exported/environment/textures/sand_lite.png.import
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://whknttjshvv1"
|
||||
path="res://.godot/imported/sand_lite.png-6962f2117f97a265a7074c81ef2370fa.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/exported/environment/textures/sand_lite.png"
|
||||
dest_files=["res://.godot/imported/sand_lite.png-6962f2117f97a265a7074c81ef2370fa.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
BIN
art/exported/environment/textures/sandstone_heavy.png
Normal file
BIN
art/exported/environment/textures/sandstone_heavy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
43
art/exported/environment/textures/sandstone_heavy.png.import
Normal file
43
art/exported/environment/textures/sandstone_heavy.png.import
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ctll4fbskvat8"
|
||||
path.s3tc="res://.godot/imported/sandstone_heavy.png-c324c68e8c28417ecd3506dbd5f24ef5.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/sandstone_heavy.png-c324c68e8c28417ecd3506dbd5f24ef5.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/exported/environment/textures/sandstone_heavy.png"
|
||||
dest_files=["res://.godot/imported/sandstone_heavy.png-c324c68e8c28417ecd3506dbd5f24ef5.s3tc.ctex", "res://.godot/imported/sandstone_heavy.png-c324c68e8c28417ecd3506dbd5f24ef5.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
BIN
art/exported/environment/textures/sandstone_lite.png
Normal file
BIN
art/exported/environment/textures/sandstone_lite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
41
art/exported/environment/textures/sandstone_lite.png.import
Normal file
41
art/exported/environment/textures/sandstone_lite.png.import
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bgbaiuts1c4sb"
|
||||
path="res://.godot/imported/sandstone_lite.png-8d5c0c5c4e3a227e0e487db42a418aba.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/exported/environment/textures/sandstone_lite.png"
|
||||
dest_files=["res://.godot/imported/sandstone_lite.png-8d5c0c5c4e3a227e0e487db42a418aba.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
import_profile="managed_default"
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
212
scripts/normalize_texture_imports.gd
Normal file
212
scripts/normalize_texture_imports.gd
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
extends SceneTree
|
||||
|
||||
const DEFAULT_PROFILE: Dictionary = {
|
||||
"params": {
|
||||
"compress/mode": 2,
|
||||
"compress/high_quality": false,
|
||||
"compress/lossy_quality": 0.7,
|
||||
"compress/uastc_level": 0,
|
||||
"compress/rdo_quality_loss": 0.0,
|
||||
"compress/hdr_compression": 1,
|
||||
"compress/normal_map": 0,
|
||||
"compress/channel_pack": 0,
|
||||
"mipmaps/generate": true,
|
||||
"mipmaps/limit": -1,
|
||||
"roughness/mode": 0,
|
||||
"roughness/src_normal": "",
|
||||
"process/channel_remap/red": 0,
|
||||
"process/channel_remap/green": 1,
|
||||
"process/channel_remap/blue": 2,
|
||||
"process/channel_remap/alpha": 3,
|
||||
"process/fix_alpha_border": true,
|
||||
"process/premult_alpha": false,
|
||||
"process/normal_map_invert_y": false,
|
||||
"process/hdr_as_srgb": false,
|
||||
"process/hdr_clamp_exposure": false,
|
||||
"process/size_limit": 0,
|
||||
"detect_3d/compress_to": 0,
|
||||
"import_profile": "managed_default",
|
||||
},
|
||||
}
|
||||
|
||||
const CUSTOM_PROFILE_KEY := "custom"
|
||||
|
||||
var apply_changes := false
|
||||
var verbose := false
|
||||
var roots: PackedStringArray = PackedStringArray()
|
||||
var user_root_overrides := false
|
||||
var should_exit := false
|
||||
|
||||
var skipped_custom := 0
|
||||
var skipped_non_texture := 0
|
||||
var skipped_unreadable := 0
|
||||
var updated := 0
|
||||
var unchanged := 0
|
||||
|
||||
func _initialize() -> void:
|
||||
_parse_args()
|
||||
if should_exit:
|
||||
return
|
||||
if roots.is_empty() and not user_root_overrides:
|
||||
roots.append("res://")
|
||||
|
||||
for root: String in roots:
|
||||
var normalized_root := root
|
||||
if not normalized_root.ends_with("/"):
|
||||
normalized_root += "/"
|
||||
if not normalized_root.begins_with("res://") and not normalized_root.is_absolute_path():
|
||||
if normalized_root.begins_with("./"):
|
||||
normalized_root = "res://%s" % normalized_root.trim_prefix("./")
|
||||
else:
|
||||
normalized_root = "res://%s" % normalized_root
|
||||
_print("Scanning %s" % normalized_root)
|
||||
_scan_directory(normalized_root)
|
||||
|
||||
print_summary()
|
||||
quit(0)
|
||||
|
||||
|
||||
func _parse_args() -> void:
|
||||
var args := OS.get_cmdline_user_args()
|
||||
var i := 0
|
||||
while i < args.size():
|
||||
var arg := args[i]
|
||||
if arg == "--help" or arg == "-h":
|
||||
_print_usage()
|
||||
should_exit = true
|
||||
quit(0)
|
||||
return
|
||||
elif arg == "--apply":
|
||||
apply_changes = true
|
||||
i += 1
|
||||
elif arg == "--verbose" or arg == "-v":
|
||||
verbose = true
|
||||
i += 1
|
||||
elif arg == "--root":
|
||||
if i + 1 >= args.size():
|
||||
printerr("--root requires a path value")
|
||||
should_exit = true
|
||||
quit(1)
|
||||
return
|
||||
i += 1
|
||||
roots.append(args[i])
|
||||
i += 1
|
||||
user_root_overrides = true
|
||||
elif arg.begins_with("--root="):
|
||||
roots.append(arg.trim_prefix("--root="))
|
||||
i += 1
|
||||
user_root_overrides = true
|
||||
else:
|
||||
if arg.begins_with("-"):
|
||||
_print("Ignoring unknown option: %s" % arg)
|
||||
i += 1
|
||||
continue
|
||||
|
||||
|
||||
func _scan_directory(path: String) -> void:
|
||||
var dir := DirAccess.open(path)
|
||||
if dir == null:
|
||||
printerr("Failed to open root: ", path)
|
||||
skipped_non_texture += 1
|
||||
return
|
||||
|
||||
dir.list_dir_begin()
|
||||
while true:
|
||||
var name := dir.get_next()
|
||||
if name.is_empty():
|
||||
break
|
||||
if name == "." or name == "..":
|
||||
continue
|
||||
if name == ".godot":
|
||||
continue
|
||||
|
||||
var candidate := path.path_join(name)
|
||||
if dir.current_is_dir():
|
||||
_scan_directory(candidate)
|
||||
continue
|
||||
|
||||
if name.get_extension().to_lower() != "import":
|
||||
continue
|
||||
|
||||
_handle_import_file(candidate)
|
||||
|
||||
|
||||
func _handle_import_file(import_path: String) -> void:
|
||||
var cfg := ConfigFile.new()
|
||||
var err := cfg.load(import_path)
|
||||
if err != OK:
|
||||
printerr("Could not load import settings: ", import_path, " (", err, ")")
|
||||
skipped_unreadable += 1
|
||||
return
|
||||
|
||||
if not cfg.has_section("remap") or not cfg.has_section_key("remap", "importer"):
|
||||
skipped_non_texture += 1
|
||||
return
|
||||
|
||||
if str(cfg.get_value("remap", "importer")) != "texture":
|
||||
skipped_non_texture += 1
|
||||
return
|
||||
|
||||
var current_profile := ""
|
||||
if cfg.has_section("params") and cfg.has_section_key("params", "import_profile"):
|
||||
current_profile = str(cfg.get_value("params", "import_profile"))
|
||||
if current_profile == CUSTOM_PROFILE_KEY:
|
||||
skipped_custom += 1
|
||||
if verbose:
|
||||
_print("Skipping custom profile: %s" % import_path)
|
||||
return
|
||||
|
||||
var changed := false
|
||||
for section_name: String in DEFAULT_PROFILE.keys():
|
||||
var section_data: Dictionary = DEFAULT_PROFILE[section_name]
|
||||
for section_key: String in section_data.keys():
|
||||
var desired: Variant = section_data[section_key]
|
||||
var existing: Variant = null
|
||||
if cfg.has_section(section_name) and cfg.has_section_key(section_name, section_key):
|
||||
existing = cfg.get_value(section_name, section_key)
|
||||
if existing != desired:
|
||||
cfg.set_value(section_name, section_key, desired)
|
||||
changed = true
|
||||
|
||||
if not changed:
|
||||
unchanged += 1
|
||||
if verbose:
|
||||
_print("Unchanged: %s" % import_path)
|
||||
return
|
||||
|
||||
if apply_changes:
|
||||
err = cfg.save(import_path)
|
||||
if err != OK:
|
||||
printerr("Could not save import settings: ", import_path, " (", err, ")")
|
||||
skipped_unreadable += 1
|
||||
return
|
||||
if verbose:
|
||||
_print("Updated: %s" % import_path)
|
||||
else:
|
||||
_print("Would update: %s" % import_path)
|
||||
|
||||
updated += 1
|
||||
|
||||
|
||||
func print_summary() -> void:
|
||||
if apply_changes:
|
||||
_print("Texture import normalization complete: updated=%d unchanged=%d skipped_custom=%d skipped_non_texture=%d skipped_unreadable=%d" % [updated, unchanged, skipped_custom, skipped_non_texture, skipped_unreadable])
|
||||
else:
|
||||
_print("Dry-run complete: would-update=%d unchanged=%d skipped_custom=%d skipped_non_texture=%d skipped_unreadable=%d" % [updated, unchanged, skipped_custom, skipped_non_texture, skipped_unreadable])
|
||||
_print("Pass --apply to write normalized settings into .import files.")
|
||||
_print("Set [params] import_profile = \"custom\" to opt a texture out of default normalization.")
|
||||
|
||||
|
||||
func _print(msg: String) -> void:
|
||||
print(msg)
|
||||
|
||||
|
||||
func _print_usage() -> void:
|
||||
print("Usage:")
|
||||
print(" godot --headless --path . --script scripts/normalize_texture_imports.gd [--apply] [--verbose] [--root <path>] [--root=<path>] [--help]")
|
||||
print()
|
||||
print("Defaults:")
|
||||
print("- Dry-run only unless --apply is provided")
|
||||
print("- Scans all .import files under each root")
|
||||
print("- Skips .godot")
|
||||
print("- Skips textures marked with [params] import_profile = \"custom\"")
|
||||
1
scripts/normalize_texture_imports.gd.uid
Normal file
1
scripts/normalize_texture_imports.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b24mlapvqxj5a
|
||||
19
scripts/normalize_texture_profiles.sh
Executable file
19
scripts/normalize_texture_profiles.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly PROJECT_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
|
||||
readonly GODOT_BIN="${GODOT_BIN:-godot}"
|
||||
readonly ROOT_PATH="${1:-res://}"
|
||||
|
||||
readonly WORK_ROOT="$(mktemp -d -t netfishing-godot-data.XXXXXX)"
|
||||
trap 'rm -rf -- "${WORK_ROOT}"' EXIT
|
||||
|
||||
cd "${PROJECT_ROOT}"
|
||||
|
||||
XDG_DATA_HOME="${WORK_ROOT}/data" \
|
||||
XDG_CONFIG_HOME="${WORK_ROOT}/config" \
|
||||
XDG_CACHE_HOME="${WORK_ROOT}/cache" \
|
||||
${GODOT_BIN} --headless --path . \
|
||||
--script scripts/normalize_texture_imports.gd -- --apply --root "${ROOT_PATH}"
|
||||
15
world/materials/starter_island_sandstone.tres
Normal file
15
world/materials/starter_island_sandstone.tres
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://art/exported/environment/textures/sandstone_heavy.png" id="1_texture"]
|
||||
[ext_resource type="Shader" path="res://world/materials/terrain_surface_projection.gdshader" id="2_shader"]
|
||||
|
||||
[resource]
|
||||
resource_name = "Starter Island Sandstone"
|
||||
shader = ExtResource("2_shader")
|
||||
shader_parameter/albedo_texture = ExtResource("1_texture")
|
||||
shader_parameter/albedo_tint = Color(1, 1, 1, 1)
|
||||
shader_parameter/tile_world_size = 2.5
|
||||
shader_parameter/blend_sharpness = 6.0
|
||||
shader_parameter/top_projection_bias = 2.0
|
||||
shader_parameter/roughness = 1.0
|
||||
shader_parameter/specular = 0.0
|
||||
|
|
@ -7,6 +7,7 @@ const FishingShopInteractionType = preload(
|
|||
)
|
||||
const GRASS_SURFACE_NAME: String = "grass_lite"
|
||||
const SAND_SURFACE_NAME: String = "sand"
|
||||
const SANDSTONE_SURFACE_NAME: String = "sandstone_heavy"
|
||||
|
||||
@export_group("Owned Nodes")
|
||||
@export_node_path("MeshInstance3D")
|
||||
|
|
@ -31,17 +32,24 @@ var pelican_landmark_path: NodePath = (
|
|||
)
|
||||
|
||||
@export_group("Grass Surface")
|
||||
@export var apply_surface_overrides: bool = true
|
||||
@export var grass_material: Material
|
||||
@export_range(0, 16, 1) var grass_surface_index: int = 0
|
||||
|
||||
@export_group("Sand Surface")
|
||||
@export var sand_material: Material
|
||||
@export_range(0, 16, 1) var sand_surface_index: int = 2
|
||||
@export_range(0, 16, 1) var sand_surface_index: int = 4
|
||||
|
||||
@export_group("Sandstone Surface")
|
||||
@export var sandstone_material: Material
|
||||
@export_range(0, 16, 1) var sandstone_surface_index: int = 5
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_apply_grass_material()
|
||||
_apply_sand_material()
|
||||
if apply_surface_overrides:
|
||||
_apply_grass_material()
|
||||
_apply_sand_material()
|
||||
_apply_sandstone_material()
|
||||
_build_terrain_collision()
|
||||
if Engine.is_editor_hint():
|
||||
update_configuration_warnings()
|
||||
|
|
@ -121,6 +129,31 @@ func _apply_sand_material() -> void:
|
|||
)
|
||||
|
||||
|
||||
func _apply_sandstone_material() -> void:
|
||||
var visual_mesh: MeshInstance3D = (
|
||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||
)
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
push_error("Starter island visual mesh is unavailable.")
|
||||
return
|
||||
if sandstone_material == null:
|
||||
push_error("Starter island sandstone material is unavailable.")
|
||||
return
|
||||
if sandstone_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
push_error("Starter island sandstone surface index is invalid.")
|
||||
return
|
||||
if (
|
||||
visual_mesh.mesh.surface_get_name(sandstone_surface_index)
|
||||
!= SANDSTONE_SURFACE_NAME
|
||||
):
|
||||
push_error("Starter island sandstone surface name does not match.")
|
||||
return
|
||||
visual_mesh.set_surface_override_material(
|
||||
sandstone_surface_index,
|
||||
sandstone_material
|
||||
)
|
||||
|
||||
|
||||
func _build_terrain_collision() -> void:
|
||||
var terrain_root: Node = get_node_or_null(terrain_visual_root_path)
|
||||
if terrain_root == null:
|
||||
|
|
@ -183,16 +216,19 @@ func _get_configuration_warnings() -> PackedStringArray:
|
|||
return warnings
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
warnings.append("Terrain/Visual must provide the island mesh.")
|
||||
elif grass_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Grass surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(grass_surface_index)
|
||||
!= GRASS_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Grass surface index must identify the grass surface.")
|
||||
if grass_material == null:
|
||||
warnings.append("Assign the starter-island grass material.")
|
||||
if visual_mesh != null and visual_mesh.mesh != null:
|
||||
return warnings
|
||||
|
||||
if apply_surface_overrides:
|
||||
if grass_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Grass surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(grass_surface_index)
|
||||
!= GRASS_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Grass surface index must identify the grass surface.")
|
||||
if grass_material == null:
|
||||
warnings.append("Assign the starter-island grass material.")
|
||||
|
||||
if sand_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Sand surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
|
|
@ -200,8 +236,21 @@ func _get_configuration_warnings() -> PackedStringArray:
|
|||
!= SAND_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Sand surface index must identify the sand surface.")
|
||||
if sand_material == null:
|
||||
warnings.append("Assign the starter-island sand material.")
|
||||
if sand_material == null:
|
||||
warnings.append("Assign the starter-island sand material.")
|
||||
if sandstone_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append(
|
||||
"Sandstone surface index is outside the terrain mesh."
|
||||
)
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(sandstone_surface_index)
|
||||
!= SANDSTONE_SURFACE_NAME
|
||||
):
|
||||
warnings.append(
|
||||
"Sandstone surface index must identify the sandstone surface."
|
||||
)
|
||||
if sandstone_material == null:
|
||||
warnings.append("Assign the starter-island sandstone material.")
|
||||
if get_node_or_null(terrain_collision_shape_path) == null:
|
||||
warnings.append("Terrain/Collision must provide a collision shape.")
|
||||
if get_node_or_null(terrain_visual_root_path) == null:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
[ext_resource type="Material" path="res://world/materials/starter_island_grass.tres" id="9_grass"]
|
||||
[ext_resource type="Script" uid="uid://dtcgnxl1kmdu1" path="res://world/water_body_authoring.gd" id="10_water_body"]
|
||||
[ext_resource type="Material" path="res://world/materials/starter_island_sand.tres" id="11_sand"]
|
||||
[ext_resource type="Material" path="res://world/materials/starter_island_sandstone.tres" id="20_sandstone"]
|
||||
[ext_resource type="Material" path="res://world/materials/stylized_water.tres" id="13_water"]
|
||||
[ext_resource type="Script" path="res://world/water/shoreline_ribbon_baker.gd" id="14_shoreline_baker"]
|
||||
[ext_resource type="Script" path="res://world/water/shoreline_ribbon_config.gd" id="15_shoreline_config"]
|
||||
|
|
@ -91,8 +92,12 @@ output_resource_path = "res://world/generated/shorelines/starter_ocean_shoreline
|
|||
|
||||
[node name="StarterIslandRegion" type="Node3D" unique_id=1830415700]
|
||||
script = ExtResource("1_region")
|
||||
apply_surface_overrides = true
|
||||
grass_material = ExtResource("9_grass")
|
||||
sand_surface_index = 4
|
||||
sand_material = ExtResource("11_sand")
|
||||
sandstone_material = ExtResource("20_sandstone")
|
||||
sandstone_surface_index = 5
|
||||
region_id = &"starter_island"
|
||||
fishable_water_root = NodePath("WaterBodies")
|
||||
water_recovery_root = NodePath("WaterBodies")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue