Merge of bitmap rules and General Maps

This commit is contained in:
Rusfort 2025-05-01 19:18:58 +02:00
parent 2f8bbc3a7d
commit d5b7fb2d47
2 changed files with 41 additions and 127 deletions

View File

@ -42,14 +42,6 @@
} }
}, },
"FILE_TYPE_DEFINITIONS": { "FILE_TYPE_DEFINITIONS": {
"MAP_COL": {
"description": "Color/Albedo Map",
"color": "#FFFFE0",
"examples": [
"_col.",
"_basecolor."
]
},
"MAP_COL": { "MAP_COL": {
"description": "Color/Albedo Map", "description": "Color/Albedo Map",
"color": "#FFFFE0", "color": "#FFFFE0",
@ -57,15 +49,8 @@
"_col.", "_col.",
"_basecolor." "_basecolor."
], ],
"standard_type": "COL" "standard_type": "COL",
}, "bit_depth_rule": "force_8bit"
"MAP_NRM": {
"description": "Normal Map",
"color": "#E6E6FA",
"examples": [
"_nrm.",
"_normal."
]
}, },
"MAP_NRM": { "MAP_NRM": {
"description": "Normal Map", "description": "Normal Map",
@ -74,15 +59,8 @@
"_nrm.", "_nrm.",
"_normal." "_normal."
], ],
"standard_type": "NRM" "standard_type": "NRM",
}, "bit_depth_rule": "respect"
"MAP_METAL": {
"description": "Metalness Map",
"color": "#C0C0C0",
"examples": [
"_metal.",
"_met."
]
}, },
"MAP_METAL": { "MAP_METAL": {
"description": "Metalness Map", "description": "Metalness Map",
@ -91,15 +69,8 @@
"_metal.", "_metal.",
"_met." "_met."
], ],
"standard_type": "METAL" "standard_type": "METAL",
}, "bit_depth_rule": "force_8bit"
"MAP_ROUGH": {
"description": "Roughness Map",
"color": "#A0522D",
"examples": [
"_rough.",
"_rgh."
]
}, },
"MAP_ROUGH": { "MAP_ROUGH": {
"description": "Roughness Map", "description": "Roughness Map",
@ -108,15 +79,8 @@
"_rough.", "_rough.",
"_rgh." "_rgh."
], ],
"standard_type": "ROUGH" "standard_type": "ROUGH",
}, "bit_depth_rule": "force_8bit"
"MAP_AO": {
"description": "Ambient Occlusion Map",
"color": "#A9A9A9",
"examples": [
"_ao.",
"_ambientocclusion."
]
}, },
"MAP_AO": { "MAP_AO": {
"description": "Ambient Occlusion Map", "description": "Ambient Occlusion Map",
@ -125,15 +89,8 @@
"_ao.", "_ao.",
"_ambientocclusion." "_ambientocclusion."
], ],
"standard_type": "AO" "standard_type": "AO",
}, "bit_depth_rule": "force_8bit"
"MAP_DISP": {
"description": "Displacement/Height Map",
"color": "#FFB6C1",
"examples": [
"_disp.",
"_height."
]
}, },
"MAP_DISP": { "MAP_DISP": {
"description": "Displacement/Height Map", "description": "Displacement/Height Map",
@ -142,15 +99,8 @@
"_disp.", "_disp.",
"_height." "_height."
], ],
"standard_type": "DISP" "standard_type": "DISP",
}, "bit_depth_rule": "respect"
"MAP_REFL": {
"description": "Reflection/Specular Map",
"color": "#E0FFFF",
"examples": [
"_refl.",
"_specular."
]
}, },
"MAP_REFL": { "MAP_REFL": {
"description": "Reflection/Specular Map", "description": "Reflection/Specular Map",
@ -159,15 +109,8 @@
"_refl.", "_refl.",
"_specular." "_specular."
], ],
"standard_type": "REFL" "standard_type": "REFL",
}, "bit_depth_rule": "force_8bit"
"MAP_SSS": {
"description": "Subsurface Scattering Map",
"color": "#FFDAB9",
"examples": [
"_sss.",
"_subsurface."
]
}, },
"MAP_SSS": { "MAP_SSS": {
"description": "Subsurface Scattering Map", "description": "Subsurface Scattering Map",
@ -176,15 +119,8 @@
"_sss.", "_sss.",
"_subsurface." "_subsurface."
], ],
"standard_type": "SSS" "standard_type": "SSS",
}, "bit_depth_rule": "respect"
"MAP_FUZZ": {
"description": "Fuzz/Sheen Map",
"color": "#FFA07A",
"examples": [
"_fuzz.",
"_sheen."
]
}, },
"MAP_FUZZ": { "MAP_FUZZ": {
"description": "Fuzz/Sheen Map", "description": "Fuzz/Sheen Map",
@ -193,15 +129,8 @@
"_fuzz.", "_fuzz.",
"_sheen." "_sheen."
], ],
"standard_type": "FUZZ" "standard_type": "FUZZ",
}, "bit_depth_rule": "force_8bit"
"MAP_IDMAP": {
"description": "ID Map (for masking)",
"color": "#F08080",
"examples": [
"_id.",
"_matid."
]
}, },
"MAP_IDMAP": { "MAP_IDMAP": {
"description": "ID Map (for masking)", "description": "ID Map (for masking)",
@ -210,14 +139,8 @@
"_id.", "_id.",
"_matid." "_matid."
], ],
"standard_type": "IDMAP" "standard_type": "IDMAP",
}, "bit_depth_rule": "force_8bit"
"MAP_MASK": {
"description": "Generic Mask Map",
"color": "#FFFFFF",
"examples": [
"_mask."
]
}, },
"MAP_MASK": { "MAP_MASK": {
"description": "Generic Mask Map", "description": "Generic Mask Map",
@ -225,15 +148,8 @@
"examples": [ "examples": [
"_mask." "_mask."
], ],
"standard_type": "MASK" "standard_type": "MASK",
}, "bit_depth_rule": "force_8bit"
"MAP_IMPERFECTION": {
"description": "Imperfection Map (scratches, dust)",
"color": "#F0E68C",
"examples": [
"_imp.",
"_imperfection."
]
}, },
"MAP_IMPERFECTION": { "MAP_IMPERFECTION": {
"description": "Imperfection Map (scratches, dust)", "description": "Imperfection Map (scratches, dust)",
@ -242,7 +158,8 @@
"_imp.", "_imp.",
"_imperfection." "_imperfection."
], ],
"standard_type": "IMPERFECTION" "standard_type": "IMPERFECTION",
"bit_depth_rule": "force_8bit"
}, },
"MODEL": { "MODEL": {
"description": "3D Model File", "description": "3D Model File",
@ -250,7 +167,8 @@
"examples": [ "examples": [
".fbx", ".fbx",
".obj" ".obj"
] ],
"bit_depth_rule": "respect"
}, },
"EXTRA": { "EXTRA": {
"description": "Non-standard/Unclassified File", "description": "Non-standard/Unclassified File",
@ -258,7 +176,8 @@
"examples": [ "examples": [
".txt", ".txt",
".zip" ".zip"
] ],
"bit_depth_rule": "respect"
}, },
"FILE_IGNORE": { "FILE_IGNORE": {
"description": "File to be ignored", "description": "File to be ignored",
@ -266,7 +185,8 @@
"examples": [ "examples": [
"Thumbs.db", "Thumbs.db",
".DS_Store" ".DS_Store"
] ],
"bit_depth_rule": "respect"
} }
}, },
"TARGET_FILENAME_PATTERN": "{base_name}_{map_type}_{resolution}.{ext}", "TARGET_FILENAME_PATTERN": "{base_name}_{map_type}_{resolution}.{ext}",
@ -300,20 +220,6 @@
"1K": 1024 "1K": 1024
}, },
"ASPECT_RATIO_DECIMALS": 2, "ASPECT_RATIO_DECIMALS": 2,
"MAP_BIT_DEPTH_RULES": {
"COL": "force_8bit",
"NRM": "respect",
"ROUGH": "force_8bit",
"METAL": "force_8bit",
"AO": "force_8bit",
"DISP": "respect",
"REFL": "force_8bit",
"SSS": "respect",
"FUZZ": "force_8bit",
"IDMAP": "force_8bit",
"MASK": "force_8bit",
"DEFAULT": "respect"
},
"OUTPUT_FORMAT_16BIT_PRIMARY": "png", "OUTPUT_FORMAT_16BIT_PRIMARY": "png",
"OUTPUT_FORMAT_16BIT_FALLBACK": "png", "OUTPUT_FORMAT_16BIT_FALLBACK": "png",
"OUTPUT_FORMAT_8BIT": "png", "OUTPUT_FORMAT_8BIT": "png",

View File

@ -374,9 +374,17 @@ class Configuration:
def get_bit_depth_rule(self, map_type: str) -> str: def get_bit_depth_rule(self, map_type: str) -> str:
"""Gets the bit depth rule ('respect' or 'force_8bit') for a given standard map type.""" """Gets the bit depth rule ('respect' or 'force_8bit') for a given standard map type."""
rules = self._core_settings.get('MAP_BIT_DEPTH_RULES', {}) # Access the FILE_TYPE_DEFINITIONS from core settings
default_rule = rules.get('DEFAULT', 'respect') file_type_definitions = self._core_settings.get('FILE_TYPE_DEFINITIONS', {})
return rules.get(map_type, default_rule)
# Iterate through definitions to find the matching map type
for definition in file_type_definitions.values():
if definition.get('standard_type') == map_type:
# Found the definition, check for 'bit_depth_rule'
return definition.get('bit_depth_rule', 'respect')
# If map type definition not found, return default rule
return 'respect'
def get_16bit_output_formats(self) -> tuple[str, str]: def get_16bit_output_formats(self) -> tuple[str, str]:
"""Gets the primary and fallback format names for 16-bit output.""" """Gets the primary and fallback format names for 16-bit output."""