diff --git a/config/app_settings.json b/config/app_settings.json index fc4d9ee..5eecb19 100644 --- a/config/app_settings.json +++ b/config/app_settings.json @@ -42,14 +42,6 @@ } }, "FILE_TYPE_DEFINITIONS": { - "MAP_COL": { - "description": "Color/Albedo Map", - "color": "#FFFFE0", - "examples": [ - "_col.", - "_basecolor." - ] - }, "MAP_COL": { "description": "Color/Albedo Map", "color": "#FFFFE0", @@ -57,15 +49,8 @@ "_col.", "_basecolor." ], - "standard_type": "COL" - }, - "MAP_NRM": { - "description": "Normal Map", - "color": "#E6E6FA", - "examples": [ - "_nrm.", - "_normal." - ] + "standard_type": "COL", + "bit_depth_rule": "force_8bit" }, "MAP_NRM": { "description": "Normal Map", @@ -74,15 +59,8 @@ "_nrm.", "_normal." ], - "standard_type": "NRM" - }, - "MAP_METAL": { - "description": "Metalness Map", - "color": "#C0C0C0", - "examples": [ - "_metal.", - "_met." - ] + "standard_type": "NRM", + "bit_depth_rule": "respect" }, "MAP_METAL": { "description": "Metalness Map", @@ -91,15 +69,8 @@ "_metal.", "_met." ], - "standard_type": "METAL" - }, - "MAP_ROUGH": { - "description": "Roughness Map", - "color": "#A0522D", - "examples": [ - "_rough.", - "_rgh." - ] + "standard_type": "METAL", + "bit_depth_rule": "force_8bit" }, "MAP_ROUGH": { "description": "Roughness Map", @@ -108,15 +79,8 @@ "_rough.", "_rgh." ], - "standard_type": "ROUGH" - }, - "MAP_AO": { - "description": "Ambient Occlusion Map", - "color": "#A9A9A9", - "examples": [ - "_ao.", - "_ambientocclusion." - ] + "standard_type": "ROUGH", + "bit_depth_rule": "force_8bit" }, "MAP_AO": { "description": "Ambient Occlusion Map", @@ -125,15 +89,8 @@ "_ao.", "_ambientocclusion." ], - "standard_type": "AO" - }, - "MAP_DISP": { - "description": "Displacement/Height Map", - "color": "#FFB6C1", - "examples": [ - "_disp.", - "_height." - ] + "standard_type": "AO", + "bit_depth_rule": "force_8bit" }, "MAP_DISP": { "description": "Displacement/Height Map", @@ -142,15 +99,8 @@ "_disp.", "_height." ], - "standard_type": "DISP" - }, - "MAP_REFL": { - "description": "Reflection/Specular Map", - "color": "#E0FFFF", - "examples": [ - "_refl.", - "_specular." - ] + "standard_type": "DISP", + "bit_depth_rule": "respect" }, "MAP_REFL": { "description": "Reflection/Specular Map", @@ -159,15 +109,8 @@ "_refl.", "_specular." ], - "standard_type": "REFL" - }, - "MAP_SSS": { - "description": "Subsurface Scattering Map", - "color": "#FFDAB9", - "examples": [ - "_sss.", - "_subsurface." - ] + "standard_type": "REFL", + "bit_depth_rule": "force_8bit" }, "MAP_SSS": { "description": "Subsurface Scattering Map", @@ -176,15 +119,8 @@ "_sss.", "_subsurface." ], - "standard_type": "SSS" - }, - "MAP_FUZZ": { - "description": "Fuzz/Sheen Map", - "color": "#FFA07A", - "examples": [ - "_fuzz.", - "_sheen." - ] + "standard_type": "SSS", + "bit_depth_rule": "respect" }, "MAP_FUZZ": { "description": "Fuzz/Sheen Map", @@ -193,15 +129,8 @@ "_fuzz.", "_sheen." ], - "standard_type": "FUZZ" - }, - "MAP_IDMAP": { - "description": "ID Map (for masking)", - "color": "#F08080", - "examples": [ - "_id.", - "_matid." - ] + "standard_type": "FUZZ", + "bit_depth_rule": "force_8bit" }, "MAP_IDMAP": { "description": "ID Map (for masking)", @@ -210,14 +139,8 @@ "_id.", "_matid." ], - "standard_type": "IDMAP" - }, - "MAP_MASK": { - "description": "Generic Mask Map", - "color": "#FFFFFF", - "examples": [ - "_mask." - ] + "standard_type": "IDMAP", + "bit_depth_rule": "force_8bit" }, "MAP_MASK": { "description": "Generic Mask Map", @@ -225,15 +148,8 @@ "examples": [ "_mask." ], - "standard_type": "MASK" - }, - "MAP_IMPERFECTION": { - "description": "Imperfection Map (scratches, dust)", - "color": "#F0E68C", - "examples": [ - "_imp.", - "_imperfection." - ] + "standard_type": "MASK", + "bit_depth_rule": "force_8bit" }, "MAP_IMPERFECTION": { "description": "Imperfection Map (scratches, dust)", @@ -242,7 +158,8 @@ "_imp.", "_imperfection." ], - "standard_type": "IMPERFECTION" + "standard_type": "IMPERFECTION", + "bit_depth_rule": "force_8bit" }, "MODEL": { "description": "3D Model File", @@ -250,7 +167,8 @@ "examples": [ ".fbx", ".obj" - ] + ], + "bit_depth_rule": "respect" }, "EXTRA": { "description": "Non-standard/Unclassified File", @@ -258,7 +176,8 @@ "examples": [ ".txt", ".zip" - ] + ], + "bit_depth_rule": "respect" }, "FILE_IGNORE": { "description": "File to be ignored", @@ -266,7 +185,8 @@ "examples": [ "Thumbs.db", ".DS_Store" - ] + ], + "bit_depth_rule": "respect" } }, "TARGET_FILENAME_PATTERN": "{base_name}_{map_type}_{resolution}.{ext}", @@ -300,20 +220,6 @@ "1K": 1024 }, "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_FALLBACK": "png", "OUTPUT_FORMAT_8BIT": "png", diff --git a/configuration.py b/configuration.py index 048a218..ef88c1d 100644 --- a/configuration.py +++ b/configuration.py @@ -374,9 +374,17 @@ class Configuration: 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.""" - rules = self._core_settings.get('MAP_BIT_DEPTH_RULES', {}) - default_rule = rules.get('DEFAULT', 'respect') - return rules.get(map_type, default_rule) + # Access the FILE_TYPE_DEFINITIONS from core settings + file_type_definitions = self._core_settings.get('FILE_TYPE_DEFINITIONS', {}) + + # 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]: """Gets the primary and fallback format names for 16-bit output."""