2025-05-01 19:16:37 +02:00

144 lines
7.3 KiB
Python

# config.py
# Core settings defining the pipeline standards and output format.
# --- Core Definitions ---
# Old definitions (commented out)
# ALLOWED_ASSET_TYPES = ["Surface", "Model", "Decal", "Atlas", "UtilityMap"]
# ALLOWED_FILE_TYPES = [
# "MAP_COL", "MAP_NRM", "MAP_METAL", "MAP_ROUGH", "MAP_AO", "MAP_DISP",
# "MAP_REFL", "MAP_SSS", "MAP_FUZZ", "MAP_IDMAP", "MAP_MASK",
# "MAP_IMPERFECTION", # Added for imperfection maps
# "MODEL", "EXTRA", "FILE_IGNORE"
# ]
# New definitions using dictionaries
ASSET_TYPE_DEFINITIONS = {
"Surface": {
"description": "Standard PBR material set for a surface.",
"color": "#87CEEB", # Light Blue
"examples": ["WoodFloor01", "MetalPlate05"]
},
"Model": {
"description": "A 3D model file.",
"color": "#FFA500", # Orange
"examples": ["Chair.fbx", "Character.obj"]
},
"Decal": {
"description": "A texture designed to be projected onto surfaces.",
"color": "#90EE90", # Light Green
"examples": ["Graffiti01", "LeakStain03"]
},
"Atlas": {
"description": "A texture sheet containing multiple smaller textures.",
"color": "#FFC0CB", # Pink
"examples": ["FoliageAtlas", "UITextureSheet"]
},
"UtilityMap": {
"description": "A map used for specific technical purposes (e.g., flow map).",
"color": "#D3D3D3", # Light Grey
"examples": ["FlowMap", "CurvatureMap"]
}
}
FILE_TYPE_DEFINITIONS = {
"MAP_COL": {"description": "Color/Albedo Map", "color": "#FFFFE0", "examples": ["_col.", "_basecolor."]},
"MAP_NRM": {"description": "Normal Map", "color": "#E6E6FA", "examples": ["_nrm.", "_normal."]},
"MAP_METAL": {"description": "Metalness Map", "color": "#C0C0C0", "examples": ["_metal.", "_met."]},
"MAP_ROUGH": {"description": "Roughness Map", "color": "#A0522D", "examples": ["_rough.", "_rgh."]},
"MAP_AO": {"description": "Ambient Occlusion Map", "color": "#A9A9A9", "examples": ["_ao.", "_ambientocclusion."]},
"MAP_DISP": {"description": "Displacement/Height Map", "color": "#FFB6C1", "examples": ["_disp.", "_height."]},
"MAP_REFL": {"description": "Reflection/Specular Map", "color": "#E0FFFF", "examples": ["_refl.", "_specular."]},
"MAP_SSS": {"description": "Subsurface Scattering Map", "color": "#FFDAB9", "examples": ["_sss.", "_subsurface."]},
"MAP_FUZZ": {"description": "Fuzz/Sheen Map", "color": "#FFA07A", "examples": ["_fuzz.", "_sheen."]},
"MAP_IDMAP": {"description": "ID Map (for masking)", "color": "#F08080", "examples": ["_id.", "_matid."]},
"MAP_MASK": {"description": "Generic Mask Map", "color": "#FFFFFF", "examples": ["_mask."]},
"MAP_IMPERFECTION": {"description": "Imperfection Map (scratches, dust)", "color": "#F0E68C", "examples": ["_imp.", "_imperfection."]},
"MODEL": {"description": "3D Model File", "color": "#FFA500", "examples": [".fbx", ".obj"]},
"EXTRA": {"description": "Non-standard/Unclassified File", "color": "#778899", "examples": [".txt", ".zip"]},
"FILE_IGNORE": {"description": "File to be ignored", "color": "#2F4F4F", "examples": ["Thumbs.db", ".DS_Store"]}
}
# --- Target Output Standards ---
TARGET_FILENAME_PATTERN = "{base_name}_{map_type}_{resolution}.{ext}"
STANDARD_MAP_TYPES = [
"COL", "NRM", "ROUGH", "METAL", "AO", "DISP", "REFL",
"SSS", "FUZZ", "IDMAP", "MASK"
]
# Map types that should always receive a numeric suffix (e.g., COL-1, COL-2)
# based on preset keyword order, even if only one variant is found.
RESPECT_VARIANT_MAP_TYPES = ["COL"]
# Subdirectory within the final set folder for non-essential/unknown files
EXTRA_FILES_SUBDIR = "Extra"
OUTPUT_BASE_DIR = "../Asset_Processor_Output" #accepts both relative and absolute paths
METADATA_FILENAME = "metadata.json"
# --- Blender Integration Settings ---
# Default paths to Blender files for node group and material creation.
# Set these to absolute or relative paths if you want defaults.
# Command-line arguments (--nodegroup-blend, --materials-blend) will override these.
DEFAULT_NODEGROUP_BLEND_PATH = r"G:/02 Content/10-19 Content/19 Catalogs/19.01 Blender Asset Catalogue/_CustomLibraries/Nodes-Linked/PBRSET-Nodes-Testing.blend" # e.g., r"G:\Blender\Libraries\NodeGroups.blend"
DEFAULT_MATERIALS_BLEND_PATH = r"G:/02 Content/10-19 Content/19 Catalogs/19.01 Blender Asset Catalogue/_CustomLibraries/Materials-Append/PBR Materials-Testing.blend" # e.g., r"G:\Blender\Libraries\Materials.blend"
# Path to the Blender executable. Required for running Blender scripts.
# Example: r"C:\Program Files\Blender Foundation\Blender 3.6\blender.exe"
BLENDER_EXECUTABLE_PATH = r"C:/Program Files/Blender Foundation/Blender 4.4/blender.exe" # <<< SET THIS PATH!
# --- Image Processing Settings ---
# Target resolutions (Largest dimension in pixels)
PNG_COMPRESSION_LEVEL = 6 # 0 (none) to 9 (max)
# Quality for JPG output (0-100)
JPG_QUALITY = 98
# Resolution dimension threshold (pixels) above which 8-bit images are forced to JPG, overriding input format logic.
RESOLUTION_THRESHOLD_FOR_JPG = 4096
IMAGE_RESOLUTIONS = {"8K": 8192,"4K": 4096, "2K": 2048, "1K": 1024}
# Aspect ratio decimals (used for metadata, could potentially be removed later)
ASPECT_RATIO_DECIMALS = 2
# Bit depth rules per standard map type ('respect' or 'force_8bit')
MAP_BIT_DEPTH_RULES = {
"COL": "force_8bit", "NRM": "respect", "ROUGH": "force_8bit", "METAL": "force_8bit",
"AO": "force_8bit", "DISP": "respect", "REFL": "force_bit", "SSS": "respect",
"FUZZ": "force_bit", "IDMAP": "force_8bit", "MASK": "force_8bit",
"DEFAULT": "respect" # Fallback for map types not listed
}
# Output format preferences for 16-bit data
OUTPUT_FORMAT_16BIT_PRIMARY = "png" # Options: exr_dwaa, exr_dwab, exr_zip, png, tif
OUTPUT_FORMAT_16BIT_FALLBACK = "png"
# Output format for 8-bit data
OUTPUT_FORMAT_8BIT = "png" # Could allow 'jpg' later with quality settings
# Map types that should always be saved in a lossless format (e.g., PNG, EXR)
# regardless of resolution threshold or input format.
#FORCE_LOSSLESS_MAP_TYPES = ["NRM", "NRMRGN"]
# --- Map Merging Rules ---
# List of dictionaries, each defining a merge operation.
MAP_MERGE_RULES = [
{
"output_map_type": "NRMRGH", # Suffix or standard name for the merged map
"inputs": { # Map target RGB channels to standard input map type names
"R": "NRM", # Use Red channel from NRM
"G": "NRM", # Use Green channel from NRM
"B": "ROUGH" # Use Red channel from ROUGH (assuming it's grayscale)
},
"defaults": { # Default values (0.0 - 1.0) if an input map is missing
"R": 0.5, "G": 0.5, "B": 0.5
},
# 'respect_inputs' (use 16bit if any input is), 'force_8bit', 'force_16bit'
"output_bit_depth": "respect_inputs"
},
# Example: Merge Metalness(R), Roughness(G), AO(B) -> "MRA" map often used in engines
# {
# "output_map_type": "MRA",
# "inputs": {"R": "METAL", "G": "ROUGH", "B": "AO"},
# "defaullllts": {"R": 0.0, "G": 1.0, "B": 1.0}, # Default Metal=0, Rough=1, AO=1
# "output_bit_depth": "force_8bit" # Usually fine as 8bit
# },
]
# --- Metadata Settings ---
CALCULATE_STATS_RESOLUTION = "1K" # Resolution suffix used for calculating stats
DEFAULT_ASSET_CATEGORY = "Surface" # If rules don't identify Asset or Decal
# --- Internal Settings ---
# Temporary directory prefix for processing folders
TEMP_DIR_PREFIX = "_PROCESS_ASSET_"