Class FluffImageHelper

java.lang.Object
megamek.client.ui.util.FluffImageHelper

public final class FluffImageHelper extends Object
This class provides methods for retrieving fluff images, for use in MM, MML and MHQ; also for record sheets (where the fallback image "hud.png" is used).
  • Field Details

  • Method Details

    • getFluffImage

      @Nullable public static Image getFluffImage(@Nullable BTObject unit)
      Returns a fluff image for the given unit/object to be shown e.g. in the unit summary.

      If a fluff image is stored in the unit/object itself, e.g. if it was part of the unit's file or is created by the unit itself, this is returned. Note that this is not used for canon units, but may be used in custom ones by adding a fluff image to the unit in MML.

      Otherwise, the fluff images directories are searched. First searches the user dir, then the internal dir. Tries to match the image by chassis + model or chassis alone. Chassis and model names are cleaned from " and / characters before matching. For Meks with clan names, both names and the combinations are searched. The model alone is not used to search.

      Returns null if no fluff image can be found.

      Parameters:
      unit - The unit
      Returns:
      a fluff image or null, if no match is found
    • getFluffImagePath

      @Nullable public static String getFluffImagePath(@Nullable BTObject unit)
    • getRecordSheetFluffImage

      @Nullable public static Image getRecordSheetFluffImage(@Nullable BTObject unit)
      Returns a fluff image for the given unit for the record sheet, with a fallback file named "hud.png" if that is present in the right fluff directory, or null if nothing can be found. See getFluffImage(BTObject) for further comments on how the fluff image is searched.
      Parameters:
      unit - The unit
      Returns:
      a fluff image or null, if no match is found
    • getFluffPath

      public static String getFluffPath(BTObject unit)
      Returns the subdirectory in the fluff images directory suitable for the given unit, i.e. "ConvFighter" for CF and FWS units.
      Parameters:
      unit - The unit
      Returns:
      The unit type subdirectory for fluff images
    • getFluffPaths

      public static List<String> getFluffPaths(BTObject unit)
      Returns the ordered list of fluff image subdirectories to search for the given unit. Most units search a single folder (see getFluffPath(BTObject)). Battlefield Support Assets rarely have their own art, so they search the "Asset" folder first (for asset-specific art such as Emplacements, which have no standard-unit folder) and then fall back to the folder of the corresponding TW unit type, letting a linked asset share its base unit's art by chassis/model.
      Parameters:
      unit - The unit
      Returns:
      the ordered fluff image subdirectories to search