Asset-Frameworker/Project Notes/MAP_VARIANT_HANDLING_PLAN.md
2025-04-29 18:26:13 +02:00

3.4 KiB

Map Variant Handling Plan (Revised)

Goal:

  1. Ensure map types listed in a new RESPECT_VARIANT_MAP_TYPES config setting (initially just "COL") always receive a numeric suffix (-1, -2, etc.), based on their order determined by preset keywords and alphabetical sorting within keywords.
  2. Ensure all other map types never receive a numeric suffix.
  3. Correctly prioritize 16-bit map variants (identified by bit_depth_variants in presets) over their 8-bit counterparts, ensuring the 8-bit version is ignored/marked as extra and the 16-bit version is correctly classified ("Mapped") in the GUI preview.

Affected Files:

  • config.py: To define the RESPECT_VARIANT_MAP_TYPES list.
  • asset_processor.py: To modify the classification and suffix assignment logic according to the new rule.
  • Presets/Poliigon.json: To remove the conflicting pattern.

Plan Details:

graph TD
    A[Start] --> B(Modify config.py);
    B --> C(Modify asset_processor.py);
    C --> D(Modify Presets/Poliigon.json);
    D --> E{Review Revised Plan};
    E -- Approve --> F(Optional: Write Plan to MD);
    F --> G(Switch to Code Mode);
    E -- Request Changes --> B;
    G --> H[End Plan];

    subgraph Modifications
        B[1. Add RESPECT_VARIANT_MAP_TYPES list to config.py]
        C[2. Update suffix logic in asset_processor.py (_inventory_and_classify_files)]
        D[3. Remove "*_16BIT*" pattern from move_to_extra_patterns in Presets/Poliigon.json]
    end
  1. Modify config.py:

    • Action: Introduce a new configuration list named RESPECT_VARIANT_MAP_TYPES.
    • Value: Initialize it as RESPECT_VARIANT_MAP_TYPES = ["COL"].
    • Location: Add this near other map-related settings like STANDARD_MAP_TYPES.
    • Purpose: To explicitly define which map types should always respect variant numbering via suffixes.
  2. Modify asset_processor.py:

    • File: asset_processor.py
    • Method: _inventory_and_classify_files
    • Location: Within Step 5, replacing the suffix assignment logic (currently lines ~470-474).
    • Action: Implement the new conditional logic for assigning the final_map_type.
    • New Logic: Inside the loop iterating through final_ordered_candidates (for each base_map_type):
      # Determine final map type based on the new rule
      if base_map_type in self.config.respect_variant_map_types: # Check the new config list
          # Always assign suffix for types in the list
          final_map_type = f"{base_map_type}-{i + 1}" 
      else:
          # Never assign suffix for types NOT in the list
          final_map_type = base_map_type 
      
      # Assign to the final map list entry
      final_map_list.append({
          "map_type": final_map_type, 
          # ... rest of the dictionary assignment ...
      })
      
    • Purpose: To implement the strict rule: only types in RESPECT_VARIANT_MAP_TYPES get a suffix; all others do not.
  3. Modify Presets/Poliigon.json:

    • File: Presets/Poliigon.json
    • Location: Within the move_to_extra_patterns list (currently line ~28).
    • Action: Remove the string "*_16BIT*".
    • Purpose: To prevent premature classification of 16-bit variants as "Extra", allowing the specific 16-bit prioritization logic to function correctly.