Package megamek.client.ui.util
Class FluffImageHelper
java.lang.Object
megamek.client.ui.util.FluffImageHelper
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String[] -
Method Summary
Modifier and TypeMethodDescriptionstatic ImagegetFluffImage(BTObject unit) Returns a fluff image for the given unit/object to be shown e.g.static StringgetFluffImagePath(BTObject unit) static StringgetFluffPath(BTObject unit) Returns the subdirectory in the fluff images directory suitable for the given unit, i.e.getFluffPaths(BTObject unit) Returns the ordered list of fluff image subdirectories to search for the given unit.static ImageReturns 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.
-
Field Details
-
DIR_NAME_BA
- See Also:
-
DIR_NAME_ASSET
- See Also:
-
DIR_NAME_CONV_FIGHTER
- See Also:
-
DIR_NAME_DROPSHIP
- See Also:
-
DIR_NAME_FIGHTER
- See Also:
-
DIR_NAME_INFANTRY
- See Also:
-
DIR_NAME_JUMPSHIP
- See Also:
-
DIR_NAME_MEK
- See Also:
-
DIR_NAME_PROTOMEK
- See Also:
-
DIR_NAME_SMALLCRAFT
- See Also:
-
DIR_NAME_SPACE_STATION
- See Also:
-
DIR_NAME_VEHICLE
- See Also:
-
DIR_NAME_WARSHIP
- See Also:
-
EXTENSIONS_FLUFF_IMAGE_FORMATS
-
-
Method Details
-
getFluffImage
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
-
getRecordSheetFluffImage
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. SeegetFluffImage(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
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
Returns the ordered list of fluff image subdirectories to search for the given unit. Most units search a single folder (seegetFluffPath(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
-