API Reference
Mod Fix
RemapService
- def_fix
- def_printModsToFix
- def_setupDefaultModType
- def_setupLogPath
- def_setupModPath
- def_setupModTypes
- def_setupRemappedTypes
- def_setupVersion
- defaddTips
- defclear
- defcreateLog
- defcreateMod
- deffix
- deffixIni
- deffixMod
- defreportSkippedAsset
- defreportSkippedMods
- defwarnSkippedIniResource
- class RemapService(path: Optional[str] = None, keepBackups: bool = True, fixOnly: bool = False, undoOnly: bool = False, readAllInis: bool = False, types: Optional[List[str]] = None, defaultType: Optional[str] = None, log: Optional[str] = None, verbose: bool = True, handleExceptions: bool = False, version: Optional[str] = None, remappedTypes: Optional[List[str]] = None)
The overall class for remapping modss
- Parameters
path (Optional[
str]) –The file location of where to run the fix.
If this attribute is set to
None, then will run the fix from wherever this class is called
Default:
NonekeepBackups (
bool) –Whether to keep backup versions of any .ini files that the script fixes
Default:
TruefixOnly (
bool) –Whether to only fix the mods without removing any previous changes this fix script may have made
Warning
if this is set to
TrueandundoOnlyis also set toTrue, then the fix will not run and will throw aConflictingOptionsexceptionDefault:
FalseundoOnly (
bool) –Whether to only undo the fixes previously made by the fix
Warning
if this is set to
TrueandfixOnlyis also set toTrue, then the fix will not run and will throw aConflictingOptionsexceptionDefault:
TruereadAllInis (
bool) –Whether to read all the .ini files that the fix encounters
Default:
Falsetypes (Optional[List[
str]]) –The names for all the types of mods to fix.
If this argument is an empty list or this argument is
None, then will fix all the types of mods supported by this fix
Default:
NoneremappedTypes (Optional[List[
str]]) –The names for the types of mods to be remapped based from the types of mods specified at
RemapService.types.
For a mod specified at
RemapService.types, if none of its corresponding mods to remap are specified in this attribute, then will remap the mod specified atRemapService.typesto all its corresponding mods to remap.If this argument is an empty list or this argument is
None, then will fix the mods specified atRemapService.typesto all of their corresponding remapped mods
eg. if
RemapService.typesis["Kequeen", "jean"]and this attribute is["jeanSea"], then this class will perform the following remaps:Keqing –> KeqingOpulent
Jean –> JeanSea
**Note: ** Jean –> JeanCN will not be remapped for the above example
Default:
NonedefaultType (Optional[
str]) –The name for the type to use if a mod has an unidentified type
If this value is
None, then mods with unidentified types will be skipped
Default:
Nonelog (Optional[
str]) –The folder location to log the run of the fix into a seperate text file
If this value is
None, then will not log the fix
Default:
Noneverbose (
bool) –Whether to print the progress for fixing mods
Default:
TruehandleExceptions (
bool) –When an exception is caught, whether to silently stop running the fix
Default:
Falseversion (Optional[
str]) –The game version we want the fix to be compatible with
If This value is
None, then will retrieve the hashes/indices of the latest version.
Default:
None
- _loggerBasePrefix
The prefix string for the logger used when the fix returns back to the original directory that it started to run
- Type
- fixOnly
Whether to only fix the mods without removing any previous changes this fix script may have made
- Type
- remappedTypes
The names for the types of mods to be remapped based from the types of mods specified at
RemapService.types.
For a mod specified at
RemapService.types, if none of its corresponding mods to remap are specified in this attribute, then will remap the mod specified atRemapService.typesto all its corresponding mods to remap.If this argument is an empty list or this argument is
None, then will fix the mods specified atRemapService.typesto all of their corresponding remapped mods
eg. if
RemapService.typesis["Kequeen", "jean"]and this attribute is["jeanSea"], then this class will perform the following remaps:Keqing –> KeqingOpulent
Jean –> JeanSea
**Note: ** Jean –> JeanCN will not be remapped for the above example
- Type
Set[
str]
- version
The game version we want the fix to be compatible with
If This value is
None, then will retrieve the hashes/indices of the latest version.- Type
Optional[
float]
- _pathIsCWD
Whether the filepath that the program runs from is the current directory where this module is loaded
- Type
- blendStats
Stats about whether some Blend.buf files got fixed/skipped/removed
Note
removed Blend.buf files refer to RemapBlend.buf files that were previously made by this software on a previous run
- Type
- iniStats
Stats about whether some .ini files got fixed/skipped/undoed
Note
The skipped .ini files may or may not have been previously fixed. A path to some .ini file in this attribute DOES NOT imply that the .ini file previously had a fix
- Type
- texEditStats
Stats about whether some brand new texture file created by this software has been created/removed
- Type
- _fix()
The overall logic for fixing a bunch of mods
- For finding out which folders may contain mods, this function:
recursively searches all folders from where the
RemapService.pathis locatedfor every .ini file in a valid mod and every Blend.buf file encountered that is encountered, recursively search all the folders from where the .ini file or Blend.buf file is located
Tip
For more info about how we define a ‘mod’, go to
Mod
- _printModsToFix()
Prints out the types of mods that will be fixed
- _setupDefaultModType()
Sets the default mod type to be used for an unidentified mod
- _setupLogPath()
Sets the folder path for where the log file will be stored
- _setupModPath()
Sets the filepath of where the fix will run from
- _setupModTypes(attr: str)
Sets the types of mods that will be fixed / fix to
- Parameters
attr (
str) – The name of the attribute within this class set the mods for
- _setupRemappedTypes()
Sets the names for the types of mods that will be fixed to
- _setupVersion()
Sets the game version to fix to
- addTips()
Prints out any useful tips for the user to know
- clear(clearLog: bool = True)
Clears up all the saved data
Paramters
- clearLog:
bool Whether to also clear out any saved data in the logger
- clearLog:
- createLog()
Creates a log text file that contains all the text printed on the command line
- createMod(path: Optional[str] = None, files: Optional[List[str]] = None) Mod
Creates a mod
Tip
For more info about how we define a ‘mod’, go to
Mod- Parameters
path (Optional[
str]) –The absolute path to the mod folder.
If this argument is set to
None, then will use the current directory of where this module is loadedfiles (Optional[List[
str]]) –The direct children files to the mod folder (does not include files located in a folder within the mod folder).
If this parameter is set to
None, then the module will search the folders for you
- Returns
The mod that has been created
- Return type
- fixIni(ini: IniFile, mod: Mod) bool
Fixes an individual .ini file for a particular mod
Tip
For more info about how we define a ‘mod’, go to
Mod
- fixMod(mod: Mod) bool
Fixes a particular mod
Tip
For more info about how we define a ‘mod’, go to
Mod
- property log: str
The folder location to log the run of the fix into a seperate text file
- Getter
Returns the file path to the log
- Setter
Sets the path for the log
- Type
- property path: str
The filepath of where the fix is running from
- Getter
Returns the path of where the fix is running
- Setter
Sets the path for where the fix runs
- Type
- property pathIsCwd
Whether the filepath that the program runs from is the current directory where this module is loaded
- Getter
Returns whether the filepath that the program runs from is the current directory of where the module is loaded
- Type
- reportSkippedAsset(assetName: str, assetDict: Dict[str, Exception], warnStrFunc: Callable[[str], str])
Prints out the exception message for why a particular .ini file or Blend.buf file has been skipped
- Parameters
assetName (
str) – The name for the type of asset (files, folders, mods, etc…) that was skippedassetDict (Dict[
str,Exception]) –Locations of where exceptions have occured for the particular asset
The keys are the absolute folder paths to where the exception occured
wantStrFunc (Callable[[
str],str]) –Function for how we want to print out the warning for each exception
Takes in the folder location of where the exception occured as a parameter
Mod
- clsMod.blendCorrection
- clsMod.isBackupIni
- clsMod.isBlend
- clsMod.isIni
- clsMod.isRemapBlend
- clsMod.isRemapCopyIni
- clsMod.isRemapTexture
- clsMod.isSrcIni
- clsMod.texCorrection
- def_removeIniResources
- def_setupFiles
- defcorrectBlend
- defcorrectResource
- defcorrectTex
- defgetOptionalFiles
- defprint
- defremoveBackupInis
- defremoveFix
- defremoveRemapCopies
- class Mod(path: Optional[str] = None, files: Optional[List[str]] = None, logger: Optional[Logger] = None, types: Optional[Set[ModType]] = None, defaultType: Optional[ModType] = None, version: Optional[float] = None, remappedTypes: Optional[Set[str]] = None)
This Class inherits from
ModelUsed for handling a mod
Note
We define a mod based off the following criteria:
A folder that contains at least 1 .ini file
At least 1 of the .ini files in the folder contains:
a section with the regex
[TextureOverride.*Blend]ifRemapService.readAllInisis set toTrueor the script is ran with the--allflag
OR
a section that meets the criteria of one of the mod types defined
Mod._typesby running the mod types’ModType.isType()function
SeeModTypesfor some predefined types of mods- Parameters
path (Optional[
str]) –The file location to the mod folder.
If this value is set to
None, then will use the current directory of where this module is loaded.
Default:
Nonefiles (Optional[List[
str]]) –The direct children files to the mod folder (does not include files located in a folder within the mod folder).
If this parameter is set to
None, then the class will search the files for you when the class initializes
Default:
Nonelogger (Optional[
Logger]) –The logger used to pretty print messages
Default:
Nonetypes (Optional[Set[
ModType]]) –The types of mods this mod should be.
If this argument is empty or isNone, then all the .ini files in this mod will be parsed
Default:
NoneremappedTypes (Optional[Set[
ModType]]) –The types of mods to the mods specified at
Mod._typeswill be fixed to.Note
For more details, see
RemapService.remappedTypesDefault:
NonedefaultType (Optional[
ModType]) –The type of mod to use if a mod has an unidentified type
If this argument isNone, then will skip the mod with an identified type
Default:
Noneversion (Optional[
float]) –The game version we want the fixed mod
If This value is
None, then will fix the mod to using the latest hashes/indices.
- _files
The direct children files to the mod folder (does not include files located in a folder within the mod folder).
- Type
List[
str]
- _remappedType
The types of mods to the mods specified at
Mod.typeswill be fixed to.Note
For more details, see
RemapService.remappedTypes- Type
Set[
str]
- inis
The .ini files found for the mod
The keys are the file paths to the .ini file
- _removeIniResources(ini: IniFile, result: Set[str], resourceName: str, resourceStats: FileStats, getIniResources: Callable[[IniFile], List[IniResourceModel]]) bool
Removes a particular type of resource from a .ini file
- Parameters
ini (
IniFile) – The particular .ini file to be processedresult (Set[
str]) – The resultant paths to the resources that got removedresourceName (
str) – The name of the type of resourceresourceStats (
FileStats) – The associated statistical data for the resource typegetIniResource (Callable[[
IniFile], List[IniResourceModel]]) – The function to retrieve the data related to the resource from the .ini file
- Returns
Whether there was a file that was attempted to be removed
- Return type
- classmethod blendCorrection(blendFile: Union[str, bytes], modType: ModType, modToFix: str, fixedBlendFile: Optional[str] = None, version: Optional[float] = None) Union[str, None, bytearray]
Fixes a Blend.buf file
See
BlendFile.correct()for more info- Parameters
blendFile (Union[
str,bytes]) – The file path to the Blend.buf file to fixmodType (
ModType) – The type of mod to fix frommodToFix (
str) – The name of the mod to fix tofixedBlendFile (Optional[
str]) –The file path for the fixed Blend.buf file
Default:
Noneversion (Optional[float]) –
The game version to fix to
If this value is
None, then will fix to the latest game version
Default:
None
- Raises
BlendFileNotRecognized – If the original Blend.buf file provided by the parameter
blendFilecannot be readBadBlendData – If the bytes passed into this function do not correspond to the format defined for a Blend.buf file
- Returns
If the argument
fixedBlendFileisNone, then will return an array of bytes for the fixed Blend.buf file
Otherwise will return the filename to the fixed RemapBlend.buf file if the provided Blend.buf file got corrected- Return type
- correctBlend(blendStats: FileStats, iniPaths: Optional[List[str]] = None, fixOnly: bool = False) List[Union[Set[str], Dict[str, Exception]]]
Fixes all the Blend.buf files reference by the mod
Requires all the .ini files in the mod to have ran their
IniFile.parse()function- Parameters
blendStats (
FileStats) – The stats to keep track of whether the particular the blend.buf files have been fixed or skippediniPaths (Optional[List[
str]]) –The file paths to the .ini file to have their blend.buf files corrected. If this value is
None, then will correct all the .ini file in the mod
Default:
NonefixOnly (
bool) –Whether to not correct some Blend.buf file if its corresponding RemapBlend.buf already exists
Default:
True
- Returns
The absolute file paths of the RemapBlend.buf files that were fixed
The exceptions encountered when trying to fix some RemapBlend.buf files
The keys are absolute filepath to the RemapBlend.buf file and the values are the exception encountered
- Return type
- correctResource(resourceStats: FileStats, getResourceModels: Callable[[IniFile], List[IniResourceModel]], correctFile: Callable[[str, str, ModType, str, int, IniResourceModel], str], iniPaths: Optional[List[str]] = None, fileTypeName: str = '', needsSrcFile: bool = True, fixOnly: bool = False) List[Union[Set[str], Dict[str, Exception]]]
Fixes all the files for a particular type of resource referenced by the mod
Requires all the .ini files in the mod to have ran their
IniFile.parse()function- Parameters
resourceStats (
FileStats) – The stats to keep track of whether the particular resource has been fixed or skippedgetResourceModels (Callable[[
IniFile], List[IniResourceModel]]) – Function to retrieve all of the neededIniResourceModelfrom some .ini filecorrectFile (Callable[[
str,str,ModType,str,int,IniResourceModel],str]) –Function to fix up the resource file
The parameters for the function are as follows:
The full file path to the original resource
The fixed file path to the resource
The type of mod being fixed within the .ini file
The name of the mod to fix to
The index of the part within the
IfTemplateThe index of the path within the particular part of the
IfTemplateThe version of the game to fix to
The current
IniResourceModelbeing processed
The function returns a
strwith the fixed file path to the resourceiniPaths (Optional[List[
str]]) –The file paths to the .ini file to have their resources corrected. If this value is
None, then will correct all the .ini file in the mod
Default:
NonefileTypeName (
str) – The name of the file resourcefixOnly (
bool) –Whether to not correct some Blend.buf file if its corresponding RemapBlend.buf already exists
Default:
True
- Returns
The absolute file paths of the RemapBlend.buf files that were fixed
The exceptions encountered when trying to fix some RemapBlend.buf files
The keys are absolute filepath to the RemapBlend.buf file and the values are the exception encountered
- Return type
- correctTex(texAddStats: FileStats, texEditStats: FileStats, iniPaths: Optional[List[str]] = None, fixOnly: bool = False) List[Union[Set[str], Dict[str, Exception]]]
Fixes all the texture .dds files reference by the mods
Requires all the .ini files in the mod to have ran their
IniFile.fix()function- Parameters
texAddStats (
FileStats) – The stats to keep track of whether the particular .dds file have been newly created or skippedtexEditStats (
FileStats) – The stats to keep track of whether the particular .dds file has been editted or skippediniPaths (Optional[List[
str]]) –The file paths to the .ini file to have their .dds files corrected. If this value is
None, then will correct all the .ini file in the mod
Default:
NonefixOnly (
bool) –Whether to not correct some .dds file if its corresponding RemapTex.dds already exists
Default:
True
- Returns
The absolute file paths of the .dds files that were added
The exceptions encountered when trying to created some .dds files
The absolute file paths of the .dds files that were editted
The exceptions encountered when trying to edit some .dds files
For the exceptions, the keys are absolute filepath to the .dds file and the values are the exception encountered
- Return type
[Set[
str], Dict[str,Exception], Set[str], Dict[str,Exception]]
- property files
The direct children files to the mod folder (does not include files located in a folder within the mod folder).
- Getter
Returns the files to the mod
- Setter
Sets up the files for the mod
- Type
Optional[List[
str]]
- getOptionalFiles() List[Optional[str]]
Retrieves a list of each type of files that are not mandatory for the mod
- Returns
The resultant files found for the following file categories (listed in the same order as the return type):
.ini files not created by this fix
.RemapBlend.buf files
DISABLED_RemapBackup.txt files
RemapFix.ini files
Note
See
Mod.isIni(),Mod.isRemapBlend(),Mod.isBackupIni(),Mod.isRemapCopyIni()for the specifics of each type of file- Return type
- classmethod isBackupIni(file: str) bool
Determines whether the file is a DISABLED_RemapBackup.txt file that is used to make backup copies of .ini files
- classmethod isBlend(file: str) bool
Determines whether the file is a Blend.buf file which is the original blend file provided in the mod
- classmethod isIni(file: str) bool
Determines whether the file is a .ini file which is the file used to control how a mod behaves
- classmethod isRemapBlend(file: str) bool
Determines whether the file is a RemapBlend.buf file which is the fixed Blend.buf file created by this fix
- classmethod isRemapCopyIni(file: str) bool
Determines whether the file is RemapFix.ini file which are .ini files generated by this fix to remap specific type of mods
*eg. mods such as Keqing or Jean that are fixed by
GIMIObjMergeFixer*
- classmethod isRemapTexture(file: str) bool
Determines whether the file is a RemapTex.dds file which are texture .dds files generated by this fix to edit a particular texture file for some specific type of mods
*eg. mods such as Kirara or Nilou that are fixed by
GIMIRegEditFixer*
- classmethod isSrcIni(file: str) bool
Determines whether the file is a .ini file that is not created by this fix
- print(funcName: str, *args, **kwargs)
Prints out output
- Parameters
- Returns
The return value from running the corresponding function in the logger
- Return type
Any
- removeBackupInis()
Removes all DISABLED_RemapBackup.txt contained in the mod
- removeFix(blendStats: FileStats, iniStats: FileStats, texStats: FileStats, keepBackups: bool = True, fixOnly: bool = False, readAllInis: bool = False) List[Set[str]]
Removes any previous changes done by this module’s fix
- Parameters
blendStats (
FileStats) – The data about Blend.buf filesiniStats (
FileStats) – The data about .ini filestexStats (
FileStats) – The data about .dds fileskeepBackups (
bool) –Whether to create or keep DISABLED_RemapBackup.txt files in the mod
Default:
TruefixOnly (
bool) –Whether to not undo any changes created in the .ini files
Default:
FalsereadAllInis (
bool) –Whether to remove the .ini fix from all the .ini files encountered
Default:
False
- Returns
The removed files that have their fix removed, where the types of files for the return value is based on the list below:
.ini files with their fix removed
RemapBlend.buf files that got deleted
RemapTex.dds files that got deleted
- Return type
- removeRemapCopies()
Removes all RemapFix.ini files contained in the mod
- classmethod texCorrection(fixedTexFile: str, texEditor: BaseTexEditor, texFile: Optional[str] = None) Optional[str]
Fixes a .dds file
- Parameters
fixedTexFile (
str) – The name of the file path to the fixed RemapTex.dds filetexEditor (
BaseTexEditor) – The texture editor to change the texture file
:param texFile Optional[
str]: The file path to the original texture .dds file
If this value is
None, then will use ‘fixedTexFile’ as the original file path to the texture .dds file (usually this case for creating a brand new .dds file by also passing in object of typeTexCreatorinto the ‘texEditor’ argument)
Default:
None
ModType
- deffixIni
- defgetModsToFix
- defgetVGRemap
- defisName
- defisType
- class ModType(name: str, check: Union[str, Pattern, Callable[[str], bool]], hashes: Optional[Hashes], indices: Optional[Indices] = None, aliases: Optional[List[str]] = None, vgRemaps: Optional[VGRemaps] = None, iniParseBuilder: Optional[IniParseBuilder] = None, iniFixBuilder: Optional[IniFixBuilder] = None, iniRemoveBuilder: Optional[IniRemoveBuilder] = None)
Class for defining a generic type of mod
- Parameters
name (
str) – The default name for the type of modcheck (Union[
str, Pattern, Callable[[str],bool]]) –The specific check used to identify the .ini file belongs to the specific type of mod when checking arbitrary line in a .ini file
If this argument is a string, then will check if a line in the .ini file equals to this argument
If this argument is a regex pattern, then will check if a line in the .ini file matches this regex pattern
If this argument is a function, then will check if a line in the .ini file will make the function for this argument return True
hashes (Optional[
Hashes]) –The hashes related to the mod and its fix
If this value is
None, then will create a new, emptyHashes
Default:
Noneindices (Optional[
Indices]) –The indices related to the mod and its fix
If this
None, then will create a new, emtpyIndices
Default:
Nonealiases (Optional[List[
str]]) –Other alternative names for the type of mod
Default:
NonevgRemaps (Optional[
VGRemaps]) –Maps the blend indices from the vertex group of one mod to another mod
If this value is
None, then will create a new, emptyVGRemaps
Default:
NoneiniParseBuilder (Optional[
IniParseBuilder]) –The builder to build the parser used for .ini files
If this value is
None, then by default this attribute will be set to IniParseBuilder(:class:`GIMIParser`)
Default:
NoneiniFixBuilder (Optional[
IniFixBuilder]) –The builder to build the fixer used for .ini files
If this value is
None, then by default this attribute will be set to IniFixBuilder(:class:`GIMIFixer`)
Default:
NoneiniRemoveBuilder (Optional[
IniRemoveBuilder]) –The builder to build the remover used for .ini files
If this value is
None, then by default this attribute will be set to IniRemoveBuilder(:class:`IniRemover`)
Default:
None
- check
The specific check used to identify the .ini file belongs to the specific type of mod when checking arbitrary line in a .ini file
- vgRemaps
The repository that stores the mapping for remapping vertex group blend indices of the mod to the vertex group blend indices of another mod
- Type
- iniParseBuilder
The builder to build the parser used for .ini files
- Type
- iniFixBuilder
the builder to build the fixer used for .ini files
- Type
- iniRemoveBuilder
the builder to build the remover used for .ini files
- Type
- fixIni(iniFile: IniFile, keepBackup: bool = True, fixOnly: bool = False)
Fixes the .ini file associated to this type of mod
- getModsToFix() Set[str]
Retrieves the names of the mods this mod type will fix to
- Returns
The names of the mods to fix to
- Return type
Set[
str]
- getVGRemap(modName: str, version: Optional[float] = None) VGRemap
Retrieves the corresponding Vertex Group Remap
Attention
This function assumes that the specified map
ModType.vgRemaps(VGRemaps.map) containsModType.name(the name of this mod type) as a mod to map from
ModTypeBuilder
GIBuilder
- clsGIBuilder.amber
- clsGIBuilder.amberCN
- clsGIBuilder.arlecchino
- clsGIBuilder.barbara
- clsGIBuilder.barbaraSummerTime
- clsGIBuilder.fischl
- clsGIBuilder.fischlHighness
- clsGIBuilder.ganyu
- clsGIBuilder.ganyuTwilight
- clsGIBuilder.jean
- clsGIBuilder.jeanCN
- clsGIBuilder.jeanSea
- clsGIBuilder.keqing
- clsGIBuilder.keqingOpulent
- clsGIBuilder.kirara
- clsGIBuilder.kiraraBoots
- clsGIBuilder.mona
- clsGIBuilder.monaCN
- clsGIBuilder.nilou
- clsGIBuilder.nilouBreeze
- clsGIBuilder.ningguang
- clsGIBuilder.ningguangOrchid
- clsGIBuilder.raiden
- clsGIBuilder.rosaria
- clsGIBuilder.rosariaCN
- clsGIBuilder.shenhe
- clsGIBuilder.shenheFrostFlower
- class GIBuilder
This Class inherits from
ModTypeBuilderCreates new
ModTypeobjects for some anime game
ModAssets
- clsModAssets.updateMap
- def_addVersion
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- deffindClosestVersion
- defloadFromPreset
- defupdateRepo
- class ModAssets(repo: Dict[float, Dict[str, T]], map: Optional[Dict[str, Set[str]]] = None)
Class to handle assets of any type for a mod
Note
This is a bipartite graph that maps assets to fix from to assets to fix to
- Parameters
repo (Dict[
str, Dict[str, T]]) –The original source for any preset assets
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value is the content for the asset
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods
Default:
None
- repo
The original source for any preset assets
The outer key is the game version number for the assets
The inner key is the name of the asset
The inner value is the content for the asset
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type
- _updateAssetContent(srcAsset: T, newAsset: T) T
Combines the content of 2 assets
- Parameters
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns
The updated asset
- Return type
T
- _updateVersions(assets: Dict[float, Dict[str, T]])
Updates the versioning of the assets
- Parameters
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Optional[Dict[float, Dict[str, T]]] = None)
Adds a new map to the existing map on how to retrieve the assets
- Parameters
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)
Adds a new mapping of how to fix the assets
- findClosestVersion(name: str, version: Optional[float] = None, fromCache: bool = True) float
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters
- Raises
KeyError – The name for the particular asset is not found
- Returns
The latest game version from the assets that corresponds to the desired version
- Return type
- property fixFrom: Set[str]
The names of the assets to fix from using the predefined mods
- Getter
Retrieves the names of assets used to fix from
- Type
Set[
str]
- property fixTo: Set[str]
The names of the assets to fix to using the predefined mods
- Getter
Retrives the names of assets to fix to
- Type
Set[
str]
- loadFromPreset()
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]
The adjacency list used to map assets to fix from to assets to fix to
- Getter
Retrieves the adjacency list
- Setter
Sets a new adjacency list
- Type
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]
Combines 2 maps together
ModIdAssets
- clsModIdAssets._getFromAssets
- clsModIdAssets.updateMap
- def_addVersion
- def_getToAssets
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- deffindClosestVersion
- defget
- defloadFromPreset
- defreplace
- defupdateRepo
- class ModIdAssets(repo: Dict[float, Dict[str, Dict[str, str]]], map: Optional[Dict[str, Set[str]]] = None)
This class inherits from
ModAssetsClass to handle hashes, indices, and other string id type assets for a mod
- Parameters
repo (Dict[
float, Dict[str, Dict[str,str]]]) –The original source for any preset assets
The outer key is the game version of the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset
Note
The id value for each asset should be unique
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods
Default:
None
- classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]
Retrieves the assets to fix from
- Parameters
map (Dict[str, Set[str]]) – The mapping for fixing the assets
assets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- Return type
- _getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]
Retrieves the assets to fix to
- Parameters
assetNames (Set[
str]) – The names of the assets to fix toassets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The assets to fix to
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Return type
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type
- _updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]
Combines the content of 2 assets
- Parameters
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns
The updated asset
- Return type
T
- _updateVersions(assets: Dict[float, Dict[str, T]])
Updates the versioning of the assets
- Parameters
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Optional[Dict[float, Dict[str, Dict[str, str]]]] = None)
Adds a new map to the existing map on how to retrieve the assets
- Parameters
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)
Adds a new mapping of how to fix the assets
- findClosestVersion(name: str, version: Optional[float] = None, fromCache: bool = True) float
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters
- Raises
KeyError – The name for the particular asset is not found
- Returns
The latest game version from the assets that corresponds to the desired version
- Return type
- property fixFrom: Set[str]
The names of the assets to fix from using the predefined mods
- Getter
Retrieves the names of assets used to fix from
- Type
Set[
str]
- property fixTo: Set[str]
The names of the assets to fix to using the predefined mods
- Getter
Retrives the names of assets to fix to
- Type
Set[
str]
- property fromAssets: Dict[str, Tuple[Set[str], str]]
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- get(assetName: str, assetType: str, version: Optional[float] = None) str
Retrieves the corresponding id asset from
ModStrAssets._toAssets- Parameters
- Raises
KeyError – If the corresponding asset based on the search parameters is not found
- Returns
The found asset
- Return type
- loadFromPreset()
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]
The adjacency list used to map assets to fix from to assets to fix to
- Getter
Retrieves the adjacency list
- Setter
Sets a new adjacency list
- Type
- replace(fromAsset: str, version: Optional[float] = None, toAssets: Optional[Union[str, Set[str]]] = None) Union[str, None, Dict[str, str]]
Retrieves the corresponding asset to replace ‘fromAsset’
- Parameters
- Returns
The corresponding assets for the fix to replace, if available
The result is a string if the passed in parameter ‘toAssets’ is also a string
Otherwise, the result is a dictionary such that:
The keys are the names of the assets
The values are the corresponding asset ids to replace
- Return type
- property toAssets: Dict[float, Dict[str, Dict[str, str]]]
The outer key is the game version number for the assets
The first inner key is the name of the assets
The most inner key is the type of asset
The most inner value is the id for the asset
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]
Combines 2 maps together
VGRemap
- class VGRemap(vgRemap: Dict[int, int])
Class for handling the vertex group remaps for mods
- property maxIndex
The maximum index in the vertex group remap
- Getter
Retrieves the max index
- Type
VGRemaps
- clsVGRemaps.updateMap
- def_addVersion
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- deffindClosestVersion
- defget
- defloadFromPreset
- defupdateRepo
- class VGRemaps(map: Optional[Dict[str, Set[str]]] = None)
This class inherits from
ModAssetsClass to handle Vertex Group Remaps fsor a mod
- Parameters
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods
Default:
None
- _addVersion(fromAsset: str, toAsset: str, version: float)
Adds a new version for a particular asset
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type
- _updateAssetContent(asset1: Dict[str, VGRemap], asset2: Dict[str, VGRemap]) T
Combines the content of 2 assets
- Parameters
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns
The updated asset
- Return type
T
- _updateVersions(assets: Dict[float, Dict[str, Dict[str, VGRemap]]])
Updates the versioning of the assets
- Parameters
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Optional[Dict[float, Dict[str, T]]] = None)
Adds a new map to the existing map on how to retrieve the assets
- Parameters
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)
Adds a new mapping of how to fix the assets
- findClosestVersion(fromAsset: str, toAsset: str, version: Optional[float] = None, fromCache: bool = True) float
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters
fromAsset (
str) – The name of the asset to map fromtoAsset (
str) – The name of the asset to map toversion (Optional[
float]) –The game version to be searched
If This value is
None, then will assume we want the latest version
Default:
NonefromCache (
bool) –Whether to use the result from the cache
Default:
None
- Raises
KeyError – The name for the particular asset is not found
- Returns
The latest game version from the assets that corresponds to the desired version
- Return type
- property fixFrom: Set[str]
The names of the assets to fix from using the predefined mods
- Getter
Retrieves the names of assets used to fix from
- Type
Set[
str]
- property fixTo: Set[str]
The names of the assets to fix to using the predefined mods
- Getter
Retrives the names of assets to fix to
- Type
Set[
str]
- get(fromAsset: str, toAsset: str, version: Optional[float] = None) str
Retrieves the corresponding vertex group remap
- Parameters
- Raises
KeyError – If the corresponding asset based on the search parameters is not found
- Returns
The found asset
- Return type
- loadFromPreset()
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]
The adjacency list used to map assets to fix from to assets to fix to
- Getter
Retrieves the adjacency list
- Setter
Sets a new adjacency list
- Type
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]
Combines 2 maps together
- updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]
Updates the values in
srcRepo
Hashes
- clsHashes._getFromAssets
- clsHashes.updateMap
- def_addVersion
- def_getToAssets
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- deffindClosestVersion
- defget
- defloadFromPreset
- defreplace
- defupdateRepo
- class Hashes(map: Optional[Dict[str, Set[str]]] = None)
This class inherits from
ModDictStrAssetsClass for managing hashes for a mod
- Parameters
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the hashes to fix from to the hashes to fix to using the predefined mods
Default:
None
- classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]
Retrieves the assets to fix from
- Parameters
map (Dict[str, Set[str]]) – The mapping for fixing the assets
assets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- Return type
- _getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]
Retrieves the assets to fix to
- Parameters
assetNames (Set[
str]) – The names of the assets to fix toassets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The assets to fix to
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Return type
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type
- _updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]
Combines the content of 2 assets
- Parameters
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns
The updated asset
- Return type
T
- _updateVersions(assets: Dict[float, Dict[str, T]])
Updates the versioning of the assets
- Parameters
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Optional[Dict[float, Dict[str, Dict[str, str]]]] = None)
Adds a new map to the existing map on how to retrieve the assets
- Parameters
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)
Adds a new mapping of how to fix the assets
- findClosestVersion(name: str, version: Optional[float] = None, fromCache: bool = True) float
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters
- Raises
KeyError – The name for the particular asset is not found
- Returns
The latest game version from the assets that corresponds to the desired version
- Return type
- property fixFrom: Set[str]
The names of the assets to fix from using the predefined mods
- Getter
Retrieves the names of assets used to fix from
- Type
Set[
str]
- property fixTo: Set[str]
The names of the assets to fix to using the predefined mods
- Getter
Retrives the names of assets to fix to
- Type
Set[
str]
- property fromAssets: Dict[str, Tuple[Set[str], str]]
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- get(assetName: str, assetType: str, version: Optional[float] = None) str
Retrieves the corresponding id asset from
ModStrAssets._toAssets- Parameters
- Raises
KeyError – If the corresponding asset based on the search parameters is not found
- Returns
The found asset
- Return type
- loadFromPreset()
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]
The adjacency list used to map assets to fix from to assets to fix to
- Getter
Retrieves the adjacency list
- Setter
Sets a new adjacency list
- Type
- replace(fromAsset: str, version: Optional[float] = None, toAssets: Optional[Union[str, Set[str]]] = None) Union[str, None, Dict[str, str]]
Retrieves the corresponding asset to replace ‘fromAsset’
- Parameters
- Returns
The corresponding assets for the fix to replace, if available
The result is a string if the passed in parameter ‘toAssets’ is also a string
Otherwise, the result is a dictionary such that:
The keys are the names of the assets
The values are the corresponding asset ids to replace
- Return type
- property toAssets: Dict[float, Dict[str, Dict[str, str]]]
The outer key is the game version number for the assets
The first inner key is the name of the assets
The most inner key is the type of asset
The most inner value is the id for the asset
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]
Combines 2 maps together
Indices
- clsIndices._getFromAssets
- clsIndices.updateMap
- def_addVersion
- def_getToAssets
- def_partition
- def_updateAssetContent
- def_updateVersions
- defaddMap
- defaddMapping
- defclear
- deffindClosestVersion
- defget
- defloadFromPreset
- defreplace
- defupdateRepo
- class Indices(map: Optional[Dict[str, Set[str]]] = None)
This class inherits from
ModDictStrAssetsClass for managing indices for a mod
- Parameters
map (Optional[Dict[
str, Set[str]]]) –The adjacency list that maps the indices to fix from to the indices to fix to using the predefined mods
Default:
None
- classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]
Retrieves the assets to fix from
- Parameters
map (Dict[str, Set[str]]) – The mapping for fixing the assets
assets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- Return type
- _getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]
Retrieves the assets to fix to
- Parameters
assetNames (Set[
str]) – The names of the assets to fix toassets (Dict[
float, Dict[str, Dict[str,str]]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The assets to fix to
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Return type
- _partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
Creates the bipartition for the assets to fix from vs the assets to fix to
Filters the mapping such that all the asset names in the new mapping exist in assets
- Parameters
map (Dict[
str, Set[str]]) – The desired mapping for the assets for fixingassets (Dict[
float, Dict[str, Any]]) –The source for all the assets
The outer key is the game version number for the assets
The first inner key is the name of the asset
The second inner key is the type of asset
The most inner value is the id for the asset (must be unique)
- Returns
The following output is in the same order as listed below:
The new mapping with all asset names being in assets
The names of the assets to fix from
The names of the assets to fix to
- Return type
- _updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]
Combines the content of 2 assets
- Parameters
srcAsset (T) – The content of the asset to be updates
newAsset (T) – The new asset to update into
srcAsset
- Returns
The updated asset
- Return type
T
- _updateVersions(assets: Dict[float, Dict[str, T]])
Updates the versioning of the assets
- Parameters
assets (T) – The assets for checking the versioning
- addMap(assetMap: Dict[str, Set[str]], assets: Optional[Dict[float, Dict[str, Dict[str, str]]]] = None)
Adds a new map to the existing map on how to retrieve the assets
- Parameters
assetMap (Dict[
str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix toassets (Optional[T]) –
Any new assets that needs to be added/updated to the existing assets to support the given map
Default:
None
- addMapping(fromAsset: str, toAssets: Set[str], assets: Any)
Adds a new mapping of how to fix the assets
- findClosestVersion(name: str, version: Optional[float] = None, fromCache: bool = True) float
Finds the closest available game version from
ModStrAssets._toAssetsfor a particular asset- Parameters
- Raises
KeyError – The name for the particular asset is not found
- Returns
The latest game version from the assets that corresponds to the desired version
- Return type
- property fixFrom: Set[str]
The names of the assets to fix from using the predefined mods
- Getter
Retrieves the names of assets used to fix from
- Type
Set[
str]
- property fixTo: Set[str]
The names of the assets to fix to using the predefined mods
- Getter
Retrives the names of assets to fix to
- Type
Set[
str]
- property fromAssets: Dict[str, Tuple[Set[str], str]]
The assets to fix from
The keys are the ids for the asset
The values contains metadata about the assets to fix to where each tuple contains:
# The names of the assets # The type of asset
- get(assetName: str, assetType: str, version: Optional[float] = None) str
Retrieves the corresponding id asset from
ModStrAssets._toAssets- Parameters
- Raises
KeyError – If the corresponding asset based on the search parameters is not found
- Returns
The found asset
- Return type
- loadFromPreset()
Reinitializes to load the predefined mods
- property map: Dict[str, Set[str]]
The adjacency list used to map assets to fix from to assets to fix to
- Getter
Retrieves the adjacency list
- Setter
Sets a new adjacency list
- Type
- replace(fromAsset: str, version: Optional[float] = None, toAssets: Optional[Union[str, Set[str]]] = None) Union[str, None, Dict[str, str]]
Retrieves the corresponding asset to replace ‘fromAsset’
- Parameters
- Returns
The corresponding assets for the fix to replace, if available
The result is a string if the passed in parameter ‘toAssets’ is also a string
Otherwise, the result is a dictionary such that:
The keys are the names of the assets
The values are the corresponding asset ids to replace
- Return type
- property toAssets: Dict[float, Dict[str, Dict[str, str]]]
The outer key is the game version number for the assets
The first inner key is the name of the assets
The most inner key is the type of asset
The most inner value is the id for the asset
- classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]
Combines 2 maps together
Mod Files
Entities for representing some common used files in mods.
File
- class File(logger: Optional[Logger] = None)
Base class for a file
IniFile
- clsIniFile.compareResources
- clsIniFile.getFixedBlendFile
- clsIniFile.getFixedTexFile
- clsIniFile.getMergedResourceIndex
- clsIniFile.getModSuffixedName
- clsIniFile.getRemapBlendName
- clsIniFile.getRemapBlendResourceName
- clsIniFile.getRemapFixName
- clsIniFile.getRemapFixResourceName
- clsIniFile.getRemapTexName
- clsIniFile.getRemapTexResourceName
- clsIniFile.getResourceName
- clsIniFile.getResources
- clsIniFile.removeResourceName
- def_checkFixed
- def_checkModType
- def_getCommandIfTemplate
- def_getCommands
- def_getFixer
- def_getIfTemplateResourceName
- def_getParser
- def_getRemover
- def_isIfTemplateDraw
- def_isIfTemplateResource
- def_parseSection
- def_processIfTemplate
- def_readLines
- def_removeFix
- def_removeSection
- def_setToFix
- defaddFixBoilerPlate
- defcheckIsMod
- defclear
- defclearRead
- defdisIni
- deffillIfTemplate
- deffix
- deffixBoilerPlate
- defgetFixCredit
- defgetFixFooter
- defgetFixHeader
- defgetFixModTypeHeadingname
- defgetFixModTypeName
- defgetFixStr
- defgetHeadingName
- defgetIfTemplates
- defgetTexAddModels
- defgetTexEditModels
- defmakeResourceModel
- defmakeTexModel
- defparse
- defprint
- defread
- defreadFileLines
- defreadIfTemplates
- defremoveSectionOptions
- defwrite
- class IniFile(file: Optional[str] = None, logger: Optional[Logger] = None, txt: str = '', modTypes: Optional[Set[ModType]] = None, defaultModType: Optional[ModType] = None, version: Optional[float] = None, modsToFix: Optional[Set[str]] = None)
This class inherits from
FileClass for handling .ini files
Note
We analyse the .ini file using Regex which is NOT the right way to do things since the modified .ini language that GIMI interprets is a CFG (context free grammer) and NOT a regular language.
But since we are lazy and don’t want make our own compiler with tokenizers, parsing algorithms (eg. SLR(1)), type checking, etc… this module should handle regular cases of .ini files generated using existing scripts (assuming the user does not do anything funny…)
- Parameters
file (Optional[
str]) –The file path to the .ini file
Default:
Nonelogger (Optional[
Logger]) – The logger to print messages if necessarytxt (
str) –Used as the text content of the .ini file if
IniFile.fileis set toNone
Default: “”
modTypes (Optional[Set[
ModType]]) –The types of mods that the .ini file should belong to
Default:
NonemodsToFix (Optional[Set[
str]]) –The names of the mods we want to fix to
Default:
NonedefaultModType (Optional[
ModType]) –The type of mod to use if the .ini file has an unidentified mod type
If this value isNone, then will skip the .ini file with an unidentified mod type
Default:
Noneversion (Optional[
float]) –The game version we want the .ini file to be compatible with
If This value is
None, then will retrieve the hashes/indices of the latest version.
Default:
None
- version
The game version we want the .ini file to be compatible with
If This value is
None, then will retrieve the hashes/indices of the latest version.- Type
Optional[
float]
- _parser
Parser used to parse very basic cases in a .ini file
- Type
- defaultModType
The type of mod to use if the .ini file has an unidentified mod type
- Type
Optional[
ModType]
- _textureOverrideBlendRoot
The name for the section containing the keywords:
[.*TextureOverride.*Blend.*]- Type
Optional[
str]
- sectionIfTemplates
All the sections in the .ini file that can be parsed into an
IfTemplateFor more info see
IfTemplateAttention
The modified .ini language that GIMI uses introduces keywords that can be used before the key of a key-value pair
eg. defining constants
1[Constants] 2global persist $swapvar = 0 3global persist $swapscarf = 0 4global $active 5global $creditinfo = 0
Sections containing this type of pattern will not be parsed. But generally, these sections are irrelevant to fixing the Raiden Boss
- Type
Dict[
str,IfTemplate]
- _resourceBlends
Sections that are linked to 1 or more Blend.buf files.
The keys are the name of the sections.
- Type
Dict[
str,IfTemplate]
- remapBlendModels
The data for the
[Resource.*RemapBlend.*]sections used in the fixThe keys are the original names of the resource with the pattern
[Resource.*Blend.*]- Type
Dict[
str,IniResourceModel]
- texEditModels
The data for the
[Resource.*]sections that belong to some texture file that got editted
The outer keys are the names for the type of texture files eg. MyBrandNewLightMap
The inner keys are the original names of the resource with the pattern
[Resource.*]
- Type
Dict[
str, Dict[str,IniTexModel]]
- texAddModels
The data for the
[Resource.*]sections that belong to some texture file that got added
The outer keys are the names for the type of texture files eg. MyBrandNewLightMap
The inner keys are the names of the mod object eg. Head
- Type
Dict[
str, Dict[str,IniTexModel]]
- _checkFixed(line: str)
Checks if a line of text matches the regex,
[.*TextureOverride.*RemapBlend.*],to identify whether the .ini file has been fixed- Parameters
line (
str) – The line of text to check
- _checkModType(line: str)
Checks if a line of text contains the keywords to identify whether the .ini file belongs to the types of mods in
IniFile.modTypes
If
IniFile.modTypesis not empty, then will find the firstModTypethat where the line makesModType.isType()returnTrueOtherwise, will see if the line matches with the regex,
[.*TextureOverride.*Blend.*]
- Parameters
line (
str) – The text to check
- _getCommandIfTemplate(sectionName: str, raiseException: bool = True) Optional[IfTemplate]
Retrieves the
IfTemplatefor a certain section from IniFile._sectionIfTemplate- Parameters
raiseException (
bool) – Whether to raise an exception when the section’sIfTemplateis not found
- Raises
KeyError – If the
IfTemplatefor the section is not found andraiseExceptionis set to True- Returns
The corresponding
IfTemplatefor the section- Return type
Optional[
IfTemplate]
- _getCommands(sectionName: str, subCommands: Set[str], subCommandLst: List[str])
Low level function for retrieving all the commands/sections that are called from a certain section in the .ini file
- Parameters
- Raises
KeyError – If the
IfTemplateis not found for some section
- _getFixer()
Retrieves the fixer for fixing the .ini file
- Returns
The resultant fixer
- Return type
Optional[
BaseIniFixer]
- _getIfTemplateResourceName(ifTemplatePart: Dict[str, Any]) Any
Retrieves the value from the key, ‘vb1’, for some part of a section
- _getParser() Optional[BaseIniParser]
Retrieves the parser for parsing the .ini file
- Returns
The resultant parser
- Return type
Optional[
BaseIniParser]
- _getRemover() BaseIniRemover
Retrieves the remover for removing fixes from the .ini file
- Returns
The resultant parser
- Return type
- _isIfTemplateDraw(ifTemplatePart: Dict[str, Any]) bool
Whether the content for some part of a section contains the key ‘draw’
- _isIfTemplateResource(ifTemplatePart: Dict[str, Any]) bool
Whether the content for some part of a section contains the key ‘vb1’
- _parseSection(sectionName: str, srcTxt: str, save: Optional[Dict[str, Any]] = None) Optional[Dict[str, str]]
Regularly parses the key-value pairs of a certain section
The function parses uses ConfigParser to parse the section.
- Parameters
- Returns
The result from parsing the section
Note
If ConfigParser is unable to parse the section, then
Noneis returned- Return type
- _processIfTemplate(startInd: int, endInd: int, fileLines: List[str], sectionName: str, srcTxt: str) IfTemplate
Parses a section in the .ini file as an
IfTemplateNote
See
IfTemplateto see how we define an ‘IfTemplate’- Parameters
- Returns
The generated
IfTemplatefrom the section- Return type
- _readLines()
Decorator to read all the lines in the .ini file first before running a certain function
All the file lines will be saved in
IniFile._fileLinesExamples
1@_readLines 2def printLines(self): 3 for line in self._fileLines: 4 print(f"LINE: {line}")
- _removeFix(parse: bool = False) str
Removes any previous changes that were probably made by this script
For the .ini file will remove:
All code surrounded by the ‘—…— . Fix —…—-’* header/footer
All sections containing the keywords
RemapBlend
- _removeSection(startInd: int, endInd: int, fileLines: List[str], sectionName: str, srcTxt: str) Tuple[int, int]
Retrieves the starting line index and ending line index of where to remove a certain section from the read lines of the .ini file
- Parameters
- Returns
The starting line index and the ending line index of the section to remove
- Return type
- _setToFix() Set[str]
Sets the names for the types of mods that will used in the fix
- Returns
The names of the mods that will be used in the fix
- Return type
Set[
str]
- addFixBoilerPlate(fix: str = '') str
Adds the boilerplate code to identify the .ini sections have been changed by this fix
- property availableType: Optional[ModType]
Retrieves the type of mod identified for this .ini file
Note
This function is the same as
IniFile.type(), but will returnIniFile.defaultModTypeifIniFile.type()isNone- Returns
The type of mod identified
- Return type
Optional[
ModType]
- checkIsMod() bool
Reads the entire .ini file and checks whether the .ini file belongs to a mod
Note
If the .ini file has already been parsed (eg. calling
IniFile.checkModType()orIniFile.parse()), thenyou only need to read
IniFile.isModIni()- Returns
Whether the .ini file is a .ini file that belongs to some mod
- Return type
- clear(eraseSourceTxt: bool = False)
Clears all the saved data for the .ini file
Note
Please see the note at
IniFile.clearRead()- Parameters
eraseSourceTxt (
bool) –Whether to erase the only data source for this class if
IniFile.fileis set toNone, see the note atIniFile.clearRead()for more info
Default:
False
- clearRead(eraseSourceTxt: bool = False)
Clears the saved text read in from the .ini file
Note
If
IniFile.fileis set toNone, then the default run of this function with the argumenteraseSourceTxtset toFalsewill have no effect since the provided text fromIniFile._fileTxtis the only source of data for theIniFileIf you also want to clear the above source text data, then run this function with the
eraseSourceTxtargument set toTrue- Parameters
eraseSourceTxt (
bool) –Whether to erase the only data source for this class if
IniFile.fileis set toNone, see the note above for more info
Default:
False
- classmethod compareResources(resourceTuple1: Tuple[str, Optional[int]], resourceTuple2: Tuple[str, Optional[int]]) int
Compare function used for sorting resources
The order for sorting is the resources is:
Resources that do are not suffixed by an index number
Resource that are suffixed by an index number (see
IniFile.getMergedResourceIndex()for more info)
- Parameters
resourceTuple1 (Tuple[
str, Optional[int]]) –Data for the first resource in the compare function, contains:
Name of the resource
The index for the resource
resourceTuple2 (Tuple[
str, Optional[int]]) –Data for the second resource in the compare function, contains:
Name of the resource
The index for the resource
- Returns
The result for a typical compare function used in sorting
returns -1 if
resourceTuple1should come beforeresourceTuple2returns 1 if
resourceTuple1should come afterresourceTuple2returns 0 if
resourceTuple1is equal toresourceTuple2
- Return type
- disIni(makeCopy: bool = False)
Disables the .ini file
Note
For more info, see
FileService.disableFile()- Parameters
makeCopy (
bool) –Whether to make a copy of the disabled .ini file
Default:
False
- property file: Optional[str]
The file path to the .ini file
- Getter
Returns the path to the file
- Setter
Sets the new path for the file
- Type
Optional[
str]
- property fileLines: List[str]
The text lines of the .ini file
Note
For the setter, each line must end with a newline character (same behaviour as readLines)
- Getter
Returns the text lines of the .ini file
- Setter
Reads the new value for both the text lines of the .ini file and the text content of the .ini file
- Type
List[
str]
- property fileLinesRead: bool
Whether the .ini file has been read
- Getter
Determines whether the .ini file has been read
- Type
- property filePath: Optional[FilePath]
The path to the .ini file
- Getter
Returns the path to the file
- Type
Optional[
FilePath]
- property fileTxt: str
The text content of the .ini file
- Getter
Returns the content of the .ini file
- Setter
Reads the new value for both the text content of the .ini file and the text lines of the .ini file
- Type
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, Union[str, Dict[str, Any]], int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str, Union[str, Dict[str, Any],int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
- fixBoilerPlate()
Decorator used to add the boilerplate code to identify a code section has been changed by this fix in the .ini file
Examples
1@fixBoilerPlate 2def helloWorld(self) -> str: 3 return "Hello World"
- property folder: str
The folder where this .ini file resides
If
IniFile.fileis set toNone, then will return the folder where this script is ran- Getter
Retrieves the folder
- Type
- getFixCredit() str
Retrieves the credit text for the code generated in the .ini file
- Returns
The credits to be displayed in the .ini file
- Return type
Retrieves the footer text used to identify a code section has been changed by this fix in the .ini file
- Returns
The footer section comment to be used in the .ini file
- Return type
- getFixHeader() str
Retrieves the header text used to identify a code section has been changed by this fix in the .ini file
- Returns
The header section comment to be used in the .ini file
- Return type
- getFixModTypeHeadingname()
Retrieves the name of the type of mod corresponding to the .ini file to be used in the header/footer divider comment of the fix
- Returns
The name for the type of mod to be displayed in the header/footer divider comment
- Return type
Optional[
str]
- getFixModTypeName() Optional[str]
Retrieves the name of the type of mod corresponding to the .ini file to be used for the comment of the fix
- Returns
The name for the type of mod corresponding to the .ini file
- Return type
Optional[
str]
- classmethod getFixedBlendFile(blendFile: str, modName: str = '') str
Retrieves the file path for the fixed RemapBlend.buf file
- classmethod getFixedTexFile(texFile: str, modName: str = '') str
Retrieves the file path for the fixed RemapTex.dds file
- getHeadingName()
Retrieves the title for the header of the divider comment of the fix
- Returns
The title for the header of the divider comment
- Return type
- getIfTemplates(flush: bool = False) Dict[str, IfTemplate]
Retrieves all the :class:`IfTemplate`s for the .ini file
Note
This is the same as
IniFile.readIfTemplates(), but uses caching- Parameters
flush (
bool) – Whether to re-parse the :class:`IfTemplates`s instead of using the saved cached values- Returns
The parsed
IfTemplate`s :raw-html:`The keys are the name of the
IfTemplateThe values are the corresponding
IfTemplate
- Return type
Dict[
str,IfTempalte]
- classmethod getMergedResourceIndex(mergedResourceName: str) Optional[int]
Retrieves the index number of a resource created by GIMI’s
genshin_merge_mods.pyscriptExamples
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.8") 8
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.Score.-100") -100
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.UnitTests") None
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend") None
- classmethod getModSuffixedName(name: str, suffix: str = '', modName: str = '')
Changes a section name to have the suffix of ‘modName’ followed by ‘suffix’
- classmethod getRemapBlendName(name: str, modName: str = '') str
Changes a section name to have the keyword ‘RemapBlend’ to identify that the section is created by this fix
Examples
>>> IniFile.getRemapBlendName("EiTriesToUseBlenderAndFails", "Raiden") "EiTriesToUseRaidenRemapBlenderAndFails"
>>> IniFile.getRemapBlendName("EiBlendsTheBlender", "Yae") "EiBlendsTheYaeRemapBlender"
>>> IniFile.getRemapBlendName("ResourceCuteLittleEi", "Raiden") "ResourceCuteLittleEiRaidenRemapBlend"
>>> IniFile.getRemapBlendName("ResourceCuteLittleEiRemapBlend", "Raiden") "ResourceCuteLittleEiRemapRaidenRemapBlend"
- classmethod getRemapBlendResourceName(name: str, modName: str = '') str
Changes the name of a section to be a new resource that this fix will create
Note
See
IniFile.getResourceName()andIniFile.getRemapBlendName()for more info
- classmethod getRemapFixName(name: str, modName: str = '') str
Changes a section name to have the suffix RemapFix to identify that the section is created by this fix
Examples
>>> IniFile.getRemapFixName("EiIsDoneWithRemapFix", "Raiden") "EiIsDoneWithRaidenRemapFix"
>>> IniFile.getRemapFixName("EiIsHappy", "Raiden") "EiIsHappyRaidenRemapFix"
- classmethod getRemapFixResourceName(name: str, modName: str = '')
Changes a section name to be a new non-blend resource created by this fix
Note
See
IniFile.getResourceName()andIniFile.getRemapFix()for more info
- classmethod getRemapTexName(name: str, modName: str = '')
Changes a section name to have the suffix RemapFix to identify that the section is created by this fix
Examples
>>> IniFile.getRemapTexName("EiIsDoneWithRemapTex", "Raiden") "EiIsDoneWithRaidenRemapTex"
>>> IniFile.getRemapTexName("EiIsHappy", "Raiden") "EiIsHappyRaidenRemapTex"
- classmethod getRemapTexResourceName(name: str, modName: str = '')
Changes a section name to be a texture resource created by this fix
Note
See
IniFile.getResourceName()andIniFile.getRemapTexName()for more info
- classmethod getResourceName(name: str) str
Makes the name of a section to be used for the resource sections of a .ini file
Examples
>>> IniFile.getResourceName("CuteLittleEi") "ResourceCuteLittleEi"
>>> IniFile.getResourceName("ResourceCuteLittleEi") "ResourceCuteLittleEi"
- classmethod getResources(commandsGraph: IniSectionGraph, isIfTemplateResource: Callable[[IfContentPart], Any], getIfTemplateResource: Callable[[IfContentPart], str], addResource: Callable[[Any, IfContentPart], Any])
Retrieves all the referenced resources that were called by sections related to the
[TextureOverride.*Blend.*]sections- Parameters
resources (Set[
str]) – The result for all the resource sections that were referencedcommandsGraph (
IniSectionGraph) – The subgraph for all the sections related to the resourceisIfTemplateResource (Callable[[
IfContentPart],bool]) – Checks whether a part in theIfTemplateof a section contains the key that reference the target resourcegetIfTemplateResource (Callable[[
IfContentPart], Any]) – Function to retrieve the target resource from a part in theIfTemplateof a sectionaddResource (Callable[[Any,
IfContentPart], Any]) –Function to add in the result of the found resource section
The parameter order for the function is:the retrieved resource section
the part in the
IfTemplatewhere the resource is found
- getTexAddModels() List[IniTexModel]
Retrieves all the file path data needed for creating new texture .dds file (transforms
IniFile.texAddModelsto a list)- Returns
The data models needed for editting a texture .dds file
- Return type
List[
IniTexModel]
- getTexEditModels() List[IniTexModel]
Retrieves all the file path data needed for editing a texture .dds file (transforms
IniFile.texEditModelsto a list)- Returns
The data models needed for editting a texture .dds file
- Return type
List[
IniTexModel]
- property isFixed: bool
Whether the .ini file has already been fixed
- Getter
Returns whether the .ini file has already been fixed
- Type
- property isModIni: bool
Whether the .ini file belongs to a mod
- Getter
Returns whether the .ini file belongs to a mod
- Type
- makeResourceModel(ifTemplate: ~FixRaidenBoss2.model.iftemplate.IfTemplate.IfTemplate, toFix: ~typing.Set[str], getFixedFile: ~typing.Optional[~typing.Callable[[str, str], str]] = None, iniResourceModelCls: ~typing.Type[~FixRaidenBoss2.model.iniresources.IniResourceModel.IniResourceModel] = <class 'FixRaidenBoss2.model.iniresources.IniResourceModel.IniResourceModel'>, iniResModelArgs: ~typing.Optional[~typing.List[~typing.Any]] = None, iniResModelKwargs: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None) IniResourceModel
Creates the data needed for fixing a particular
[Resource.*]section in the .ini file- Parameters
ifTemplate (
IfTemplate) – The particular section to extract datatoFix (Set[
str]) – The names of the mods to fixgetFixedFile (Optional[Callable[[
str,str],str]]) –The function for transforming the file path of a found resource file into a new file path for the fixed resources file
If this value is
None, then will useIniFile.getFixedBlendFile()
The parameters for the function are:
# The path to the original file # The type of mod to fix to
Default:
NoneiniResourceModelCls (Type[
IniResourceModel]) –A subclass of
IniResourceModelfor constructing the required dataAttention
The constructor of this subclass must at least have the same arguments and keyword arguments as the constructor for
IniResourceModelsDefault:
IniResourceModeliniResModelArgs (Optional[List[Any]]) –
Any arguments to add onto the contructor for creating the subclass of a
IniResourceModel
Default:
NoneiniResModelKwargs (Optional[Dict[
str, Any]]) –Any keyword arguments to add onto the constructor for creating the subclass of a
IniResourceModel
Default:
None
- Returns
The data for fixing the particular resource
- Return type
- makeTexModel(ifTemplate: IfTemplate, toFix: Set[str], texEditors: Union[BaseTexEditor, Dict[int, Dict[str, List[BaseTexEditor]]]], getFixedFile: Optional[Callable[[str, str], str]] = None) IniTexModel
Creates the data needed for fixing a particular
[Resource.*]section for some .dds texture file in the .ini file- Parameters
ifTemplate (
IfTemplate) – The particular section to extract datatoFix (Set[
str]) – The names of the mods to fixtexEditors (Union[
BaseTexEditor, Dict[int, Dict[str, List[BaseTexEditor]]]]) –The texture editors for editting the found .dds files
If this argument is of type
BaseTexEditor, then all .dds files encountered within the parsed section will use the same texture editorIf this argument is a dictionary, then the structure of the dictionary is follows the same structure as
IniTexModel.texEdits
getFixedFile (Optional[Callable[[
str,str],str]]) –The function for transforming the file path of a found .dds file into a new file path to the fixed .dds file
If this value is
None, then will useIniFile.getFixedBlendFile()
The parameters for the function are:
# The path to the original file # The type of mod to fix to
Default:
None
- Returns
The data for fixing the particular texture
- Return type
- parse()
Parses the .ini file
- print(funcName: str, *args, **kwargs)
Prints out output
- Parameters
- Returns
The return value from running the corresponding function in the logger
- Return type
Any
- read() str
Reads the .ini file
If
IniFile.fileis set toNone, then will read the existing value fromIniFile.fileTxt- Returns
The text content of the .ini file
- Return type
- readFileLines() List[str]
Reads each line in the .ini file
If
IniFile.fileis set toNone, then will read the existing value fromIniFile.fileLines- Returns
All the lines read from the .ini file
- Return type
List[
str]
- readIfTemplates() Dict[str, IfTemplate]
Parses all the :class:`IfTemplate`s for the .ini file
- Returns
The parsed
IfTemplate`s :raw-html:`The keys are the name of the
IfTemplateThe values are the corresponding
IfTemplate
- Return type
Dict[
str,IfTempalte]
- classmethod removeResourceName(name: str) str
Removes the ‘Resource’ prefix from a section’s name
Examples
>>> IniFile.removeResourceName("ResourceCuteLittleEi") "CuteLittleEi"
>>> IniFile.removeResourceName("LittleMissGanyu") "LittleMissGanyu"
- removeSectionOptions(section: Union[str, Pattern, Callable[[str], bool]])
Removes a certain type of section from the .ini file
- property type: Optional[ModType]
The type of mod the .ini file belongs to
- Getter
Returns the type of mod the .ini file belongs to
- Type
Optional[
ModType]
- write(txt: Optional[str] = None) str
Writes back into the .ini files based off the content in
IniFile._fileLines- Parameters
txt (Optional[
str]) –The text to write back into the .ini file
If this argument is
None, then will use theIniFile.fileTxtDefault:
none- Returns
The text that is written to the .ini file
- Return type
BlendFile
- class BlendFile(src: Union[str, bytes])
This Class inherits from
FileUsed for handling blend.buf files
Note
We observe that a Blend.buf file is a binary file defined as:
each line contains 32 bytes (256 bits)
each line uses little-endian mode (MSB is to the right while LSB is to the left)
the first 16 bytes of a line are for the blend weights, each weight is 4 bytes or 32 bits (4 weights/line)
the last 16 bytes of a line are for the corresponding indices for the blend weights, each index is 4 bytes or 32 bits (4 indices/line)
the blend weights are floating points while the blend indices are unsigned integers
- correct(vgRemap: VGRemap, fixedBlendFile: Optional[str] = None) Union[str, None, bytearray]
Fixes a Blend.buf file
- Parameters
- Raises
BlendFileNotRecognized – If the original Blend.buf file provided by the parameter
blendFilecannot be readBadBlendData – If the bytes passed into this function do not correspond to the format defined for a Blend.buf file
- Returns
If the argument
fixedBlendFileisNone, then will return an array of bytes for the fixed Blend.buf file
Otherwise will return the filename to the fixed RemapBlend.buf file if the provided Blend.buf file got corrected- Return type
TextureFile
- class TextureFile(src: str)
This Class inherits from
FileUsed for handling .dds files
- open(format: str = 'RGBA') Image
Opens the texture file
- Parameters
format (
str) –What format the image of the texture file should be opened as
Default: “RGBA”
- Returns
The image for the texture file
- Return type
PIL.Image
- print(funcName: str, *args, **kwargs)
Prints out output
- Parameters
- Returns
The return value from running the corresponding function in the logger
- Return type
Any
Ini Parts
The different parts that are within a .ini file.
IfTemplate
- class IfTemplate(parts: List[IfTemplatePart], name: str = '')
Data for storing information about a section in a .ini file
Note
Assuming every if/else clause must be on its own line, we have that an
IfTemplatehave a form looking similar to this:1...(does stuff)... 2...(does stuff)... 3if ...(bool)... 4 if ...(bool)... 5 ...(does stuff)... 6 else if ...(bool)... 7 ...(does stuff)... 8 endif 9else ...(bool)... 10 if ...(bool)... 11 if ...(bool)... 12 ...(does stuff)... 13 endif 14 endif 15endif 16...(does stuff)... 17...(does stuff)...
We split the above structure into parts (
IfTemplatePart) where each part is either:An If Predicate Part (:class:`IfPredPart`): a single line containing the keywords “if”, “else” or “endif”
ORA Content Part (:class:`IfContentPart`): a group of lines that “does stuff”
Note that: an
ifTemplatedoes not need to contain any parts containing the keywords “if”, “else” or “endif”. This case covers the scenario when the user does not use if..else statements for a particular sectionBased on the above assumptions, we can assume that every
[section]in a .ini file contains thisIfTemplateSupported Operations:
- for element in x
Iterates over all the parts of the
IfTemplate,x
- x[num]
Retrieves the part from the
IfTemplate,x, at indexnum
- x[num] = newPart
Sets the part at index
numof theIfTemplate,x, to have the value ofnewPart
- Parameters
parts (List[
IfTemplatePart]) – The individual parts of how we divided anIfTemplatedescribed abovename (
str) –The name of the section for this
IfTemplateDefault:
""
- parts
The individual parts of how we divided an
IfTemplatedescribed above- Type
List[
IfTemplatePart]
- calledSubCommands
Any other sections that this
IfTemplatereferences
The keys are the indices to the
IfContentPartin theIfTemplatethat the section is calledThe values are the referenced sections within the
IfContentPart
- hashes
The hashes this
IfTemplatereferences- Type
Set[
str]
- indices
The indices this
IfTemplatereferences- Type
Set[
str]
- add(part: Union[str, Dict[str, Any]])
Adds a part to the
ifTemplate- Parameters
part (Union[
str, Dict[str, Any]]) – The part to add to theIfTemplate
- find(pred: Optional[Callable[[int, IfTemplatePart], bool]] = None, postProcessor: Optional[Callable[[int, IfTemplatePart], Any]] = None) Dict[int, Any]
Searches the
IfTemplatefor parts that meet a certain condition- Parameters
pred (Optional[Callable[[
IfTemplate,int,IfTemplatePart],bool]]) –The predicate used to filter the parts
If this value is
None, then this function will return all the parts
The order of arguments passed into the predicate will be:
The
IfTemplatethat this method is calling fromThe index for the part in the
IfTemplateThe current part of the
IfTemplate
Default:
NonepostProcessor (Optional[Callable[[
IfTemplate,int,IfTemplatePart], Any]]) –A function that performs any post-processing on the found part that meets the required condition
The order of arguments passed into the post-processor will be:
The
IfTemplatethat this method is calling fromThe index for the part in the
IfTemplateThe current part of the
IfTemplate
Default:
None
- Returns
The filtered parts that meet the search condition
The keys are the index locations of the parts and the values are the found parts
- Return type
Dict[
int, Any]
- getMods(hashRepo: Hashes, indexRepo: Indices, version: Optional[float] = None) Set[str]
Retrieves the corresponding mods the
IfTemplatewill fix to- Parameters
- Returns
Names of all the types of mods the
IfTemplatewill fix to- Return type
Set[
str]
IfTemplatePart
- deftoStr
- class IfTemplatePart
Base class for some part in an
IfTemplates
IfPredPart
- class IfPredPart(pred: str, type: IfPredPartType)
This class inherits from
IfTemplatePartClass for defining the predicate part of an
IfTemplateNote
see
IfTemplatefor more details- Parameters
pred (
str) – The predicate string within theIfTemplatetype (
IfPredPartType) – The type of predicate encountered
- pred
The predicate string within the
IfTemplate- Type
- type
The type of predicate encountered
- Type
IfContentPart
- defaddKVP
- defgetVals
- defremapKeys
- defremoveKey
- defremoveKeys
- defreplaceVals
- deftoStr
- class IfContentPart(src: Dict[str, List[Tuple[int, str]]], depth: int)
This class inherits from
IfTemplatePartClass for defining the content part of an
IfTemplateNote
see
IfTemplatefor more detailsSupported Operations:
- key in x
Determines if ‘key’ exists in the content part of the
IfContentPart
- x[key]
Retrieves the corresponding data value from the
IfContentPartbased off ‘key’
If ‘key’ is an
int, then will retrieve a tuple containing:Otherwise, will retrieve the corresponding value from
IfContentPart.src()
- for key, val, keyInd, orderInd in x
Iterates over all the key/value initializations and updates within the
IfContentPart,x
The tuples to iterate over are as follows:
key: (
str) A particular key in theIfContentPartval: (
str) The corresponding value to the keykeyInd: (
int) The occurence index of the same key within theIfContentPartorderInd: (:class:``int) The order index the KVP appears in the overall
IfContentPart
- Parameters
src (Dict[
str, List[Tuple[int,str]]]) –The source for the part in the
IfTemplate
The keys are the name of the keys in the part
The values are the coresponding values for the keys for all instances where the particular key got instantiated/updated. Each element in the list contains:
depth (
int) – The depth the part is within theIfTemplate
- src
The source for the part in the
IfTemplate
The keys are the name of the keys in the part
- depth
The depth the part is within the
IfTemplate- Type
- _order
- remapKeys(keyRemap: Dict[str, List[str]])
Remaps the keys in the `KVP`_s of the parts
- Parameters
keyRemap (Dict[
str, List[str]]) –The remap for the keys
The keys are the old names of the keys to be remapped and the values are the new names of the keys to be remapped to
Warning
Recommeded that the new names in each list to be unique. Otherwise, this function will make each list to have unique values.
- removeKey(key: str)
Removes a key from the part
Attention
The runtime of this operation is O(n), where ‘n’ is the # of KVP`_s in this part. If you want to remove multiple keys, please use :meth:`IfContentPart.removeKeys which also has O(n) runtime. (faster than using a for loop to run this function, which will be O(n^2) runtime)
- Parameters
key (
str) – The key to remove
- removeKeys(keys: Set[str])
Removes multiple keys from the part
- Parameters
keys (Set[
str]) – The keys to remove
- replaceVals(newVals: Dict[str, Union[str, List[str]]], addNewKVPs: bool = True)
Replaces the values in the `KVP`_s of the parts or adds in new `KVP`_s if the original key did not exist
- Parameters
newVals (Dict[
str, Union[str, List[str]]]) –The new values for the KVP`_s in the parts :raw-html:`<br />
The keys are the corresponding keys for the `KVP`_s and the values are the new values of the `KVP`_s
addNewKVPs (
bool) –Whether to add new KVPs if the corresponding key in ‘newVals’ does not exist
Default:
None
- property src
The raw content of the part
The keys are the names of the keys in the content part of the
IfTemplate. Note that the same key can appear multiple times in a particular content part.- The values consists of:
The order index the KVP appeared in the
IfContentPartThe corresponding value for the key
IniSectionGraph
- def_dfsExplore
- defbuild
- defconstruct
- defgetCommonMods
- defgetRemapBlendNames
- defgetSection
- class IniSectionGraph(targetSections: Union[Set[str], List[str]], allSections: Dict[str, IfTemplate], remapNameFunc: Optional[Callable[[str, str], str]] = None, modsToFix: Optional[Set[str]] = None)
Class for constructing a directed subgraph for how the sections in the .ini file are ran
Note
- Parameters
sections (Set[
str]) – Names of the desired sections we want our subgraph to have from the sections of the .ini fileallSections (Dict[
str,IfTemplate]) –All the sections for the .ini file
Note
You can think of this as the adjacency list for the directed graph of all sections in the .ini file
remapNameFunc (Optional[Callable[[
str,str],str]]) –Function to get the corresponding remap names for the section names
If this value is
None, then will not get the remap names for the sections
The parameters for the function are:
Name of the section
Name fo the type of mod to fix
Default:
FalsemodsToFix (Optional[Set[
str]]) –The names of the mods that will be fixed by the .ini file
Default:
None
- remapNameFunc
Function to get the corresponding remap names for the section names
The parameters for the function are:
Name of the section
Name fo the type of mod to fix
- _dfsExplore(section: IfTemplate, visited: Dict[str, IfTemplate], runSequence: List[Tuple[str, IfTemplate]])
The typical recursive implementation of DFS for exploring a particular section (node)
- Parameters
section (
IfTemplate) – The section that is currently being exploredvisited (Dict[
str,ifTemplate]) – The sections that have already been visitedrunSequence (List[Tuple[
str,IfTemplate]]) – The order the sections will be ran
- property allSections
All the sections of the .ini file
Note
You can think of this as the adjacency list for the directed graph of all sections in the .ini file
- Getter
All the sections for the .ini file
- Setter
Constructs a new subgraph based on the new sections for the .ini file
- Type
Dict[
str,IfTemplate]
- build(newTargetSections: Optional[Union[Set[str], List[str]]] = None, newAllSections: Optional[Dict[str, IfTemplate]] = None, newModsToFix: Optional[Set[str]] = None)
Performs the initialization for rebuilding the subgraph
- Parameters
newTargetSections (Optional[Set[
str], List[str]]) –The new desired sections we want in our subgraph
Default:
NonenewAllSections (Optional[Dict[
str,IfTemplate]]) –The new sections for the .ini file
Default:
NonenewModsToFix (Optional[Set[
str]]) –The new desired names of the mods that we want to fix for the .ini file
Default:
None
- construct() Dict[str, IfTemplate]
Constructs the subgraph for the sections using DFS
- Returns
The sections that are part of the subgraph
- Return type
Dict[
str,IfTemplate]
- getCommonMods(hashRepo: Hashes, indexRepo: Indices, version: Optional[float] = None) Set[str]
Retrieves the common mods to fix to based off all the :class:`IfTemplate`s in the graph
- Parameters
- Returns
The common mods to fix to
- Return type
Set[
str]
- getRemapBlendNames(newModsToFix: Optional[Set[str]] = None) Dict[str, Dict[str, str]]
Retrieves the corresponding remap names of the sections made by this fix
- getSection(sectionName: str, raiseException: bool = True) Optional[IfTemplate]
Retrieves the
IfTemplatefor a certain section- Parameters
raiseException (
bool) – Whether to raise an exception when the section’sIfTemplateis not found
- Raises
KeyError – If the
IfTemplatefor the section is not found andraiseExceptionis set toTrue- Returns
The corresponding
IfTemplatefor the section- Return type
Optional[
IfTemplate]
- property modsToFix
The names of the mods that will be fixed by the .ini file
- Getter
Retrieves the names of the mods to fix
- Type
Set[
str]
- property remapNames
The corresponding names for the sections that the fix will make
- property runSequence
The order the sections will be ran
- Getter
Retrieves the order the sections will be ran
- Type
List[Tuple[
str,IfTemplate]]
- property sections
The sections that are part of the contructed subgraph based on the desired sections specified at
IniSectionGraph.targetSectionsNote
You can think of this as the adjacency list for the subgraph
- Getter
All the sections for the subgraph
- Type
Dict[
str,IfTemplate]
Ini Parsers
Entities to help read and analyze a .ini file.
BaseIniParser
- class BaseIniParser(iniFile: IniFile)
Base class to parse a .ini file
- Parameters
iniFile (
IniFile) – The .ini file to parse
- clear()
Clears any saved data
- parse()
Parses the .ini file
IniParseBuilder
- defbuild
- class IniParseBuilder(cls: Type[BaseIniParser], args: Optional[List[Any]] = None, kwargs: Optional[Dict[str, Any]] = None)
This class inherits from
BuilderA class to help dynamically build a
BaseIniParser- Parameters
cls (Type[
BaseIniParser]) – The class to construct aBaseIniFixerargs (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
None
- build(iniFile: IniFile) BaseIniParser
Builds the parser
- Parameters
iniFile (
IniFile) – The .ini file to parse- Returns
The built parser
- Return type
GIMIParser
- def_makeRemapModels
- def_setToFix
- defclear
- defparse
- class GIMIParser(iniFile: IniFile)
This class inherits from
BaseIniParserParses a .ini file used by a GIMI related importer
- Parameters
iniFile (
IniFile) – The .ini file to parse
- nonBlendHashIndexCommandsGraph
All the sections that are not used by the
[Resource.*Blend.*]sections and contains the target hashes/indices that need to be replaced- Type
- resourceCommandsGraph
All the related sections to the
[Resource.*Blend.*]sections that are used by sections related to the[TextureOverride.*Blend.*]sections. The keys are the name of the sections.- Type
- _makeRemapModels(resourceGraph: IniSectionGraph, getFixedFile: Optional[Callable[[str], str]] = None) Dict[str, IniResourceModel]
Creates all the data needed for fixing the
[Resource.*Blend.*]sections in the .ini file- Parameters
resourceGraph (
IniSectionGraph) – The graph of sections for the resourcesgetFixedFile (Optional[Callable[[
str],str]]) –The function for transforming the file path of a found .*Blend.buf file into a .*RemapBlend.buf file
If this value is
None, then will useIniFile.getFixedBlendFile()
Default:
None
- Returns
The data for fixing the resource sections
The keys are the original names for the resource sections and the values are the required data for fixing the sections
- Return type
Dict[
str,IniResourceModel]
- _setToFix() Set[str]
Sets the names for the types of mods that will used in the fix
- Returns
The names of the mods that will be used in the fix
- Return type
Set[
str]
- clear()
Clears any saved data
- parse()
Parses the .ini file
GIMIObjParser
- def_makeRemapModels
- def_makeTexModels
- def_setToFix
- defclear
- defgetTexEditor
- defgetTexGraph
- defgetTexGraphs
- defparse
- class GIMIObjParser(iniFile: IniFile, objs: Set[str], texEdits: Optional[Dict[str, Dict[str, Dict[str, BaseTexEditor]]]] = None)
This class inherits from
GIMIParserParses a .ini file used by a GIMI related importer and parses section’s related to a specific mod object (head, body, dress, etc…)
Note
For the specific names of the objects for a particular mod, please refer to GIMI Assets
- Parameters
iniFile (
IniFile) – The .ini file to parseobjs (Set[
str]) – The specific mod objects to keep track oftexEdits (Optional[Dict[
str, Dict[str, Dict[str,BaseTexEditor]]]]) –texture resource sections that require to be editted
The outer keys ares the name of the mod object the texture resource belongs in
The second outer keys are the name of the register the texture resource belongs in
The inner keys are the names of the type of texture files that are editted
The inner value is the editor for changing the texture files
Note
The new names of the texture files to be editted should be all unique
Default:
None
- objGraphs
The different sections related to each mod object
The keys are the names of the objects and the values are the graphs related to each object
- Type
Dict[
str,IniSectionGraph]
- texGraphs
The different sections related to the textures to be editted
The outer keys are the name of the mod object
The inner keys are the name of the register within the mod object
The inner value are the graphs for each register specified
- Type
Dict[
str, Dict[str,IniSectionGraph]]
- _objSearchPatterns
The Regex patterns used to find the roots of the sections related to each mod object
The keys are the names of the objects and the values are the Regex patterns
- Type
Dict[
str, Pattern]
- _objRootSections
The root sections for each mod object
The keys are the names of the objects and the values are the names of the sections
- texEditRegs
The corresponding register for a particular texture resource to be editted
The keys are the names of the type of texture resource to edit
- The values contains info about the corresponding register for the texture. The tuple contains:
The name of the mod object the texture resource belongs to
The name of the register that holds the texture
- _makeRemapModels(resourceGraph: IniSectionGraph, getFixedFile: Optional[Callable[[str], str]] = None) Dict[str, IniResourceModel]
Creates all the data needed for fixing the
[Resource.*Blend.*]sections in the .ini file- Parameters
resourceGraph (
IniSectionGraph) – The graph of sections for the resourcesgetFixedFile (Optional[Callable[[
str],str]]) –The function for transforming the file path of a found .*Blend.buf file into a .*RemapBlend.buf file
If this value is
None, then will useIniFile.getFixedBlendFile()
Default:
None
- Returns
The data for fixing the resource sections
The keys are the original names for the resource sections and the values are the required data for fixing the sections
- Return type
Dict[
str,IniResourceModel]
- _makeTexModels(texName: str, texGraph: IniSectionGraph, texEditor: BaseTexEditor, getFixedFile: Optional[Callable[[str], str]] = None) Dict[str, Dict[str, IniTexModel]]
Creates all the data needed for fixing the
[Resource.*]sections related to texture files in the .ini file- Parameters
texName (
str) – The name for the type of texture file to edittexGraph (
IniSectionGraph) – The graph of sections for the particular type of texturesgetFixedFile (Optional[Callable[[
str],str]]) –The function for transforming the file path of a found from the texture .dds file into a .*RemapFix.dds file
If this value is
None, then will useIniFile.getFixedTexFile()
Default:
None
- Returns
The data for fixing the resource sections
- Return type
Dict[
str, Dict[str,IniTexModel]]
- _setToFix() Set[str]
Sets the names for the types of mods that will used in the fix
- Returns
The names of the mods that will be used in the fix
- Return type
Set[
str]
- clear()
Clears any saved data
- getTexEditor(texName: str) Optional[BaseTexEditor]
Retrieves the corresponding
BaseTexEditorbased on ‘texName’- Parameters
texName (
str) – The name to the type of texture file to be editted- Returns
The found texture editor
- Return type
Optional[
BaseTexEditor]
- getTexGraph(texName: str) Optional[IniSectionGraph]
Retrieves the corresponding
IniSectionGraphbased on ‘texName’- Parameters
texName (
str) – The name to the type of texture file to be editted- Returns
The found section graph
- Return type
Optional[
IniSectionGraph]
- getTexGraphs(texNames: List[str]) List[IniSectionGraph]
Retrieves the corresponding section graphs based on ‘texNames’
- Parameters
texNames (List[
str]) – The names to the type of texture files to be editted- Returns
The found section graphs
- Return type
List[
IniSectionGraph]
- property objs
The specific mod objects to keep track of
- Getter
Returns the names of the mod objects
- Setter
Sets the new names for the mod objects to keep track of
- Type
Set[
str]
- parse()
Parses the .ini file
- property texEdits
texture resource sections that require to be editted
The outer keys ares the name of the mod object the texture resource belongs in
The second outer keys are the name of the register the texture resource belongs in
The inner keys are the names of the type of texture files that are editted
The inner value is the editor for changing the texture files
- Getter
Returns the specific registers to have their textures editted
- Setter
Sets the new registers to have their textures editted
- Type
Dict[
str, Dict[str, Dict[str,BaseTexEditor]]]
Ini Fixers
The classes below help perform correction on .ini files after the .ini file has been parsed by the Ini Parsers
BaseIniFixer
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- deffillIfTemplate
- deffix
- defgetFix
- class BaseIniFixer(parser: BaseIniParser)
Base class to fix a .ini file
- Parameters
parser (
BaseIniParser) – The associated parser to retrieve data for the fix
- _parser
The associated parser to retrieve data for the fix
- Type
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the corresponding asset
- Parameters
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the replacement for ‘asset’
- Parameters
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type
Union[
str, Any]
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
IniFixBuilder
- defbuild
- class IniFixBuilder(cls: Type[BaseIniFixer], args: Optional[List[Any]] = None, kwargs: Optional[Dict[str, Any]] = None)
This class inherits from
BuilderClass to dynamically build a
BaseIniFixerto fix .ini files- Parameters
cls (Type[
BaseIniFixer]) – The class to construct aBaseIniFixerargs (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
None
- build(parser: BaseIniParser) BaseIniFixer
Builds the fixer
- Parameters
parser (
BaseIniParser) – The corresponding parser for the .ini file- Returns
The built fixer
- Return type
GIMIFixer
- def_fillNonBlendSections
- def_fillRemapResource
- def_fillTextureOverrideRemapBlend
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- deffillIfTemplate
- deffix
- deffixMod
- defgetFix
- class GIMIFixer(parser: GIMIParser)
This class inherits from
BaseIniFixerFixes a .ini file used by a GIMI related importer
- Parameters
parser (
GIMIParser) – The associated parser to retrieve data for the fix
- _fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the corresponding asset
- Parameters
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the replacement for ‘asset’
- Parameters
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type
Union[
str, Any]
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
GIMIObjReplaceFixer
- def_fillNonBlendSections
- def_fillRemapResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- def_getTexEditFile
- defclear
- defeditRegisters
- deffillIfTemplate
- deffillObjNonBlendSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexResourceRemapFixName
- class GIMIObjReplaceFixer(parser: GIMIObjParser, regEditFilters: Optional[List[BaseRegEditFilter]] = None, regEditOldObj: bool = True)
This class inherits from
GIMIFixerBase class to fix a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are replaced by other mod objectss
- Parameters
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixregEditFilters (Optional[List[
BaseRegEditFilter]]) – Filters used to edit the registers of a certainIfContentPart. Filters are executed based on the order specified in the list.
- regEditOldObj
Whether the register editting attributes such as
GIMIObjReplaceFixer.regRemap()orGIMIObjReplaceFixer.regRemove()have their mod objects reference the original mod objects of the mod to be fixed or the new mod objects of the fixed mods- Type
- _fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns
The created content part
- Return type
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the corresponding asset
- Parameters
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the replacement for ‘asset’
- Parameters
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type
Union[
str, Any]
- _getTexEditFile(file: str, texInd: int, modName: str = '') str
Makes the file path for an editted texture
- clear()
Clears all the saved states
- editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str)
Edits the registers for a
IfContentPartNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters
modName (
str) – The name of the modpart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs to
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sections of some mod object, where the original section comes from a different mod objectTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns
The created content part
- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
- fixMod(modName: str, fix: str = '') str
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str
Retrieves the new name of the section for a new mod object
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns
The new name for the section
- Return type
- property regEditFilters
Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.- Getter
Retrieves all the sequence of filters
- Setter
Sets the new sequence of filters
- Type
List[
BaseRegEditFilter]
GIMIObjSplitFixer
- def_fillNonBlendSections
- def_fillRemapResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- def_getTexEditFile
- defclear
- defeditRegisters
- deffillIfTemplate
- deffillObjNonBlendSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexResourceRemapFixName
- class GIMIObjSplitFixer(parser: GIMIObjParser, objs: Dict[str, List[str]], regEditFilters: Optional[List[BaseRegEditFilter]] = None)
This class inherits from
GIMIObjReplaceFixerFixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are split into multiple mod objects in remapped mod
eg.
KeqingOpulent's "body" is split into Keqing's "body" and "dress" KeqingOpulent Keqing =============== ================= *** objects *** **** objects **** body -------+------> body head | head +------> dress
Note
For the order of how the registers are fixed, please see
GIMIObjReplaceFixer- Parameters
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixThe mod objects that will be split into multiple new mod objects
The keys are the names of the mod objects to be split and the values are the names of the new mod objects the original mod object will be split into
Note
The dictionary keys should align with the defined object names at
GIMIObjParser.objs()for your parserWarning
If multiple mod objects split into the same object, then the resultant .ini file will contain duplicate sections for that particular mod object
eg.
{"body": ["dress", "extra"], "head": ["face", "extra"]}regEditFilters (Optional[List[
BaseRegEditFilter]]) – Filters used to edit the registers of a certainIfContentPart. Filters are executed based on the order specified in the list.
- _fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns
The created content part
- Return type
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the corresponding asset
- Parameters
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the replacement for ‘asset’
- Parameters
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type
Union[
str, Any]
- _getTexEditFile(file: str, texInd: int, modName: str = '') str
Makes the file path for an editted texture
- clear()
Clears all the saved states
- editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str)
Edits the registers for a
IfContentPartNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters
modName (
str) – The name of the modpart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs to
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sections of some mod object, where the original section comes from a different mod objectTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns
The created content part
- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
- fixMod(modName: str, fix: str = '') str
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str
Retrieves the new name of the section for a new mod object
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns
The new name for the section
- Return type
- property objs: Dict[str, List[str]]
The mods objects that will be split to multiple other mod objects
The keys are the names of the objects in the mod to be remapped and the values are the split objects of the remapped mod
- property regEditFilters
Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.- Getter
Retrieves all the sequence of filters
- Setter
Sets the new sequence of filters
- Type
List[
BaseRegEditFilter]
GIMIObjMergeFixer
- def_fillNonBlendSections
- def_fillRemapResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- def_getTexEditFile
- defclear
- defeditRegisters
- deffillIfTemplate
- deffillObjNonBlendSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexResourceRemapFixName
- class GIMIObjMergeFixer(parser: GIMIObjParser, objs: Dict[str, List[str]], copyPreamble: str = '')
This class inherits from
GIMIObjReplaceFixerFixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are merged to a single mod object
eg.
Keqing's "body" and "dress" are merged into KeqingOpulent's "body" Keqing KeqingOpulent =============== ================= *** objects *** **** objects **** body -----+----> body head | head dress -----+
Note
This class takes advantage of GIMI’s bug/feature of overlapping mods from loading multiple mods of the same character by creating different variations of the original .ini file
- Parameters
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixThe mod objects to be merged to a single mod object
The keys are the names of the merged objects and the values are the names of the mod objects to be merged
Note
The dictionary values should align with the defined object names at
GIMIObjParser.objs()for your parsercopyPreamble (
str) –Any text we want to put before the text of the newly generated .ini file variations
Default:
""
- _targetObjs
Which original mod objects to show for each merged mod object in the current .ini file
The keys are the names of the original mod objects to display on the current .ini file and the values are the names of the merged objects.
- copyPreamble
Any text we want to put before the text of the newly generated .ini file variations
- Type
- _fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns
The created content part
- Return type
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the corresponding asset
- Parameters
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the replacement for ‘asset’
- Parameters
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type
Union[
str, Any]
- _getTexEditFile(file: str, texInd: int, modName: str = '') str
Makes the file path for an editted texture
- clear()
Clears all the saved states
- editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str)
Edits the registers for a
IfContentPartNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters
modName (
str) – The name of the modpart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs to
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sections of some mod object, where the original section comes from a different mod objectTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns
The created content part
- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
- fixMod(modName: str, fix: str = '') str
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str
Retrieves the new name of the section for a new mod object
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns
The new name for the section
- Return type
- property objs
The mod objects to be merged to a single mod object
The keys are the names of the merged objects and the values are the names of the mod objects to be merged
- property regEditFilters
Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.- Getter
Retrieves all the sequence of filters
- Setter
Sets the new sequence of filters
- Type
List[
BaseRegEditFilter]
GIMIObjRegEditFixer
- def_fillNonBlendSections
- def_fillRemapResource
- def_fillTexResource
- def_fillTextureOverrideRemapBlend
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- def_getTexEditFile
- defclear
- defeditRegisters
- deffillIfTemplate
- deffillObjNonBlendSection
- deffix
- deffixMod
- defgetFix
- defgetObjRemapFixName
- defgetTexResourceRemapFixName
- class GIMIObjRegEditFixer(parser: GIMIObjParser, regEditFilters: Optional[List[BaseRegEditFilter]] = None)
This class inherits from
GIMIObjSplitFixerFixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap needs to have their registers remapped or removed
Note
For the order of how the registers are fixed, please see
GIMIObjReplaceFixer- Parameters
parser (
GIMIObjParser) – The associated parser to retrieve data for the fixregEditFilters (Optional[List[
BaseRegEditFilter]]) – Filters used to edit the registers of a certainIfContentPart. Filters are executed based on the order specified in the list.
- _fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[Resource.*]sections of a texture fileTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix topart (
IfContentPart) – The content part of theIfTemplateof the original[Resource.*Blend.*]sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content parttexName (
str) – The name of the type of texture fileoldModName (
str) – The name of the type of mod to fix fromsmodObjName (
str) – The name of the type of mod object associated to the sectiontexGraph (
IniSectionGraph) – The graph where the section belongs to
- Returns
The created content part
- Return type
- _fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str
Creates the content part of an
IfTemplatefor the new sections created by this fix related to the[TextureOverride.*Blend.*]sectionsTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content part
- Returns
The created content part
- Return type
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the corresponding asset
- Parameters
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the replacement for ‘asset’
- Parameters
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type
Union[
str, Any]
- _getTexEditFile(file: str, texInd: int, modName: str = '') str
Makes the file path for an editted texture
- clear()
Clears all the saved states
- editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str)
Edits the registers for a
IfContentPartNote
For details on steps of how the registers are editted, see
GIMIObjReplaceFixer- Parameters
modName (
str) – The name of the modpart (
IfContentPart) – The part that is being edittedobj (
str) – The name of the mod object for the corresponding partsectionName (
str) – The name of the section the part belongs to
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)
Creates the content part of an
IfTemplatefor the new sections created by this fix that are not related to the[TextureOverride.*Blend.*]sections of some mod object, where the original section comes from a different mod objectTip
For more info about an ‘IfTemplate’, see
IfTemplate- Parameters
modName (
str) – The name for the type of mod to fix tosectionName (
str) – The new name for the sectionpart (
IfContentPart) – The content part of theIfTemplateof the original [TextureOverrideBlend] sectionpartIndex (
int) – The index of where the content part appears in theIfTemplateof the original sectionlinePrefix (
str) – The text to prefix every line of the created content partobjName (
str) – The name of the original mod objectnewObjName (
str) – The name of the mod object to fix to
- Returns
The created content part
- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
- fixMod(modName: str, fix: str = '') str
Generates the newly added code in the .ini file for the fix of a single type of mod
Note
- eg.
If we are making the fix from
Jean->JeanCNandJeanSeaBreeze, The code below will only make the fix forJeanCN
fixMod("JeanCN")
- getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str
Retrieves the new name of the section for a new mod object
- getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str
Retrieves the new name of the section for a texture resource that is created/editted
- Parameters
texTypeName (
str) – The name of the type of texture fileoldModName (
str) – The name of the mod to fix fromnewModName (
str) – The name of the mod to fix toobjName (
str) – The mod object the texture resource referecesaddInd (
bool) –Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type
Default:
False
- Returns
The new name for the section
- Return type
- property objs: Dict[str, List[str]]
The mods objects that will be split to multiple other mod objects
The keys are the names of the objects in the mod to be remapped and the values are the split objects of the remapped mod
- property regEditFilters
Filters used to edit the registers of a certain
IfContentPart. Filters are executed based on the order specified in the list.- Getter
Retrieves all the sequence of filters
- Setter
Sets the new sequence of filters
- Type
List[
BaseRegEditFilter]
MultiModFixer
- def_getAsset
- def_getAssetReplacement
- def_getHash
- def_getHashReplacement
- def_getIndex
- def_getIndexReplacement
- defbuildFixers
- deffillIfTemplate
- deffix
- defgetFix
- class MultiModFixer(parser: BaseIniParser, fixBuilders: Dict[str, IniFixBuilder])
This class inherits from
BaseIniFixerFixes a .ini file where each mod to fix requires a different
BaseIniFixerstrategy- Parameters
parser (
BaseIniParser) – The associated parser to retrieve data for the fixfixBuilders (Dict[
str,IniFixBuilder]) –The different builders to dynamcally construct the
BaseIniFixerused for each mod to fix
The keys are the names of the mods to fix and the values are the different
IniFixBuilderused to construct theBaseIniFixerto fix the mod
- _fixBuilders
The different builders to dynamcally construct the
BaseIniFixerused for each mod to fix
The keys are the names of the mods to fix and the values are the different
IniFixBuilderused to construct theBaseIniFixerto fix the mod- Type
Dict[
str,IniFixBuilder]
- _fixers
The different fixers to fix each type of mod
The keys are the names of the mods to fix and the values are the fixers to fix the mod
- Type
Dict[
str,BaseIniFixer]
- _getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the corresponding asset
- Parameters
assetType (
str) – The name for the type of asset to retrieveassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the asset fornotFoundVal (Any) –
The value to be returned if the replacement is not found
Default:
None
- Returns
The found asset or the value from ‘notFoundVal’ if the asset was not found
- Return type
Union[
str, Any]
- _getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Optional[Any] = None) Union[str, Any]
Retrieves the replacement for ‘asset’
- Parameters
asset (
str) – The asset to be replacedassetRepoAttName (
str) – The name of theModIdAssetsrepo inIniFile.availableType()modName (
str) – The name of the mod we want the replacement fornotFoundVal (Any) –
The value to be returns if the replacement is not found
Default:
None
- Returns
The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found
- Return type
Union[
str, Any]
- buildFixers()
Rebuilds the
BaseIniFixerused for each mod
- fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: Optional[str] = None) str
Creates a new
IfTemplatefor an existing section in the .ini file- Parameters
modName (
str) – The name for the type of mod to fix toifTemplate (
IfTemplate) – TheIfTemplateof the orginal sectionfillFunc (Callable[[
str,str,IfContentPart,int,str,str],str]]) –The function to create a new content part for the new
IfTemplate
Tip
For more info about an ‘IfTemplate’, see
IfTemplate
The parameter order for the function is:The name for the type of mod to fix to
The new section name
The corresponding content part in the original
IfTemplateThe index for the content part in the original
IfTemplateThe string to prefix every line in the content part of the
IfTemplateThe original name of the section
origSectionName (Optional[
str]) –The original name of the section.
If this argument is set to
None, then will assume this argument has the same value as the argument forsectionName
Default:
None
- Returns
The text for the newly created
IfTemplate- Return type
- fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) Union[str, List[str]]
Fixes the .ini file
- Parameters
- Returns
The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file
- Return type
Ini Removers
These entities help remove fixes from .ini files that were made from previous runs.
BaseIniRemover
- defremove
- class BaseIniRemover(iniFile: IniFile)
Base class to remove fixes from a .ini file
- Parameters
iniFile (
IniFile) – The .ini file to remove the fix from
- static _readLines(func)
Decorator to read all the lines in the .ini file first before running a certain function
All the file lines will be saved in
IniFile._fileLinesExamples
1@_readLines 2def printLines(self): 3 for line in self.iniFile.fileLines: 4 print(f"LINE: {line}")
IniRemoveBuilder
- class IniRemoveBuilder(cls: Type[BaseIniRemover], args: Optional[List[Any]] = None, kwargs: Optional[Dict[str, Any]] = None, cache: bool = True)
This class inherits from
FlyweightBuilderA class to help dynamically build a
BaseIniRemover- Parameters
cls (Type[
BaseIniRemover]) – The class to construct aBaseIniRemoverargs (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
Nonecache (
bool) –Whether to cache the built object
Default:
True
- build(iniFile: IniFile) BaseIniRemover
Builds the remover
- Parameters
iniFile (
IniFile) – The .ini file to parse- Returns
The built remover
- Return type
IniRemover
- defremove
- class IniRemover(iniFile: IniFile)
This class inherits from
BaseIniRemoverClass for the basic removal of the fixes from .ini files
- Parameters
iniFile (
IniFile) – The .ini file to remove the fix from
- static _readLines(func)
Decorator to read all the lines in the .ini file first before running a certain function
All the file lines will be saved in
IniFile._fileLinesExamples
1@_readLines 2def printLines(self): 3 for line in self.iniFile.fileLines: 4 print(f"LINE: {line}")
Register Editting Filters
Used for subclasses of the GIMIObjRegEditFixer class to handle editting registers within an IfTemplate in the .ini file
BaseRegEditFilter
- class BaseRegEditFilter
Base class for editting registers within an
IfContentPart- clear()
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
Edits the registers for the current
IfContentPart- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
RegEditFilter
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegEditFilter
This class inherits from
BaseRegEditFilterclass for editting registers within an
IfContentPart- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
The main function to edit the registers for the current
IfContentPart- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- clear()
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegNewVals
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegNewVals(vals: Optional[Dict[str, Dict[str, str]]] = None)
This class inherits from
RegEditFilterClass for assigning new values to specific registers for some
IfContentPart- Parameters
vals –
Defines which registers will have their values changed
The outer keys are the names of the new mod objects where the registers are found
The inner keys are the new names of the registers to have their values changed
The inner values are the new changed values for the register
eg.
{"head": {"ps-t1": "newVal"}, "body": {"ps-t3": "newVal2", "ps-t0": "newVal3"}}
- vals
Defines which registers will have their values changed
The outer keys are the names of the new mod objects where the registers are found
The inner keys are the new names of the registers to have their values changed
The inner values are the new changed values for the register
- _regUpdates
The value updates to do on the current
IfContentPartbeing parsed
The keys are the names of the registers and the values are the corresponding values to the registers
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
The main function to edit the registers for the current
IfContentPart- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- clear()
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegRemap
- def_editReg
- def_handleTex
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegRemap(remap: Optional[Dict[str, Dict[str, List[str]]]] = None)
This class inherits from
RegEditFilterClass for remapping the register keys for some
IfContentPart- Parameters
remap (Optional[Dict[
str, Dict[str, List[str]]]]) –Defines how the register values in the parts of an
IfTemplateare mapped to a new register in the remapped mod for particular mod objects
The outer keys are the name of the mod object to have their registers remapped
The inner keys are the names of the registers that hold the register values to be remapped
The inner values are the new names of the registers that will hold the register values
eg.
{"head": {"ps-t1": ["new_ps-t2", "new_ps-t3"]}, "body": {"ps-t3": [ps-t0"], "ps-t0": [], "ps-t1": ["ps-t8"]}}
Default:
None
- remap
Defines how the register values in the parts of an
IfTemplateare mapped to a new register in the remapped mod for particular mod objects
The outer keys are the name of the mod objects to have its registers remapped
The inner keys are the names of the registers that hold the register values to be remapped
The inner values are the new names of the registers that will hold the register values
eg.
{"head": {"ps-t1": ["new_ps-t2", "new_ps-t3"]}, "body": {"ps-t3": [ps-t0"], "ps-t0": [], "ps-t1": ["ps-t8"]}}
- _regRemap
The register remap to do on the current
IfContentPartbeing parsed
The keys are the names of the registers and the values are the newly mapped registers
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
The main function to edit the registers for the current
IfContentPart- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- _handleTex(currentTexRegs: Set[str])
Does post-processing on the current tracked texture registers, ‘currentTexRegs’
- Parameters
currentTexRegs (Set[
str]) –
- clear()
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegRemove
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegRemove(remove: Optional[Dict[str, Set[str]]] = None)
This class inherits from
RegEditFilterClass for removing keys from a
IfContentPart- Parameters
remove (Optional[Dict[
str, Set[str]]]) –Defines whether some register assignments should be removed from the sections from the mod objects
The keys are the names of the objects to have their registers removed and the values are the names of the register to be removed
eg.
{"head": {"ps-t1", "ps-t2"}, "body": {"ps-t3", "ps-t0"}}
:raw-html:`<br />`sDefault:
None
- remove
Defines whether some register assignments should be removed from the sections of the remapped mod object
The keys are the names of the objects to have their registers removed and the values are the names of the register to be removed
eg.
{"head": {"ps-t1", "ps-t2"}, "body": {"ps-t3", "ps-t0"}}
- _regRemove
The register removal to do on the current
IfContentPartbeing parsed- Type
Optional[Set[
str]]
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
The main function to edit the registers for the current
IfContentPart- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- clear()
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegTexAdd
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegTexAdd(textures: Optional[Dict[str, Dict[str, Tuple[str, TexCreator]]]] = None, mustAdd: bool = True)
This class inherits from
RegEditFilterClass for adding new texture .dds files to a
IfContentPart- Parameters
textures (Optional[Dict[
str, Dict[str, Tuple[str,TexCreator,bool]]]]) –New texture .dds files to be created
The outer key are the names of the mod object
The inner keys are the names of the register
- The inner values contanis:
The name of the type of texture file
The object that will create the new texture file
eg.
{"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummyShadowRamp", :class:`Colour`())}}
Default:
NonemustAdd (
bool) – Whether the texture files will still be created for a particularIfContentParteven if the corresponding register for the texture file does not exist within that particularIfContentPart
- textures
New texture .dds files to be created
The outer key are the names of the mod object
The inner keys are the names of the register
- The inner values contanis:
The name of the type of texture file
The object that will create the new texture file
eg.
{"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummySshadowRamp", :class:`Colour`())}}- Type
Dict[
str, Dict[str, Tuple[str,TexCreator]]]
- mustAdd
Whether the texture files will still be created for a particular
IfContentParteven if the corresponding register for the texture file does not exist within that particularIfContentPart- Type
- _regAddVals
The texture additions to do on the current
IfContentPartbeing parsed
The keys are the name of the registers and the values are the section names for the textures
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
The main function to edit the registers for the current
IfContentPart- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- clear()
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
RegTexEdit
- def_editReg
- defclear
- defedit
- defhandleTexAdd
- defhandleTexEdit
- class RegTexEdit(textures: Optional[Dict[str, List[str]]] = None)
This class inherits from
RegEditFilterClass for editting texture .dds files to a
IfContentPart- Parameters
textures (Optional[Dict[
str, List[str]]]) –Texture .dds files to be editted from existing textures files
The keys are the name of the type of texture files of the mod object
The values are the name of the registers to hold the editted textures
eg.
{"NormalMap": ["ps-t1", "r13", "ps-t0"], "ShinyMetalMap": ["ps-t2"]}
Default:
None
- _regEditVals
The texture edits to do on the current
IfContentPartbeing parsed
The keys are the name of the registers and the values are the section names for the textures
- _editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
The main function to edit the registers for the current
IfContentPart- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- clear()
Clears any saved state within this class
- edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart
Edits the registers for the current
IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/editsNote
If you are inheriting this class, you probably want to override the
RegEditFilter._editReg()method instead- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- Returns
The resultant part of the
IfTemplatethat got its registers editted- Return type
- handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)
Does any post-processing on the added textures of the corresponding
GIMIObjReplaceFixer- Parameters
part (
IfContentPart) – The part of theIfTemplatethat is being edittedmodType (
ModType) – The type of mod that is being fix fromfixModName (
str) – The name of the mod to fix toobj (
str) – The name of the mod object being fixedfixer (
GIMIObjReplaceFixer) – The fixer that is editting the registers
- property textures: Dict[str, List[str]]
Texture .dds files to be editted from existing textures files
The keys are the name of the type of texture files of the mod object
The values are the name of the registers to hold the editted textures
eg.
{"NormalMap": ["ps-t1", "r13", "ps-t0"], "ShinyMetalMap": ["ps-t2"]}
Models
Some internal data models used in the project.
Model
- class Model(logger: Optional[Logger] = None)
Generic class used for any data models in the fix
- Parameters
logger (Optional[
Logger]) –The logger used to print messages to the console
Default:
None
IniResourceModel
- defclear
- class IniResourceModel(iniFolderPath: str, fixedPaths: Dict[int, Dict[str, List[str]]], origPaths: Optional[Dict[int, List[str]]] = None)
Contains data for fixing a particular resource in a .ini file
Supported Operations:
- for fixedPath, fixedFullPath, origPath, origFullPath in x
Iterates over all the fixed paths to some resource within a
IfContentPart,x
The tuples to iterate over are as follows: #. fixedPath: (
str) The path name of the fixed file #. fixedFullPath: (str) The full path name to the fixed file #. origPath: (Optional[str]) The path to the orignal file, if available #. origFullPath: (Optional[str]) The full path name to the original file, if available
- Parameters
iniFolderPath (
str) – The folder path to where the .ini file of the resource is locatedfixedPaths (Dict[
int, Dict[str, List[str]]]) –The file paths to the fixed files for the resource
The outer keys are the indices to the
IfContentPartthat the Blend.buf file appears in theIfTemplatefor some resourceThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
origPaths (Optional[Dict[
int, List[str]]]) –The file paths for the resource
The keys are the indices to the
IfContentPartthat the Blend.buf file appears in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
Default:
None
- fixedPaths
The file paths to the fixed files for the resource
The outer keys are the indices to the
IfContentPartthat the resource files appear in theIfTemplatefor some resourceThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
- origPaths
The file paths to the files for the resource
The keys are the indices to the
IfContentPartthat the files appear in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
- fullPaths
The absolute paths to the fixed RemapBlend.buf files for the resource
The outer keys are the indices to the
IfContentPartthat the files appear in theIfTemplatefor some resourceThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
- origFullPaths
The absolute paths to the files for the resource
The keys are the indices to the
IfContentPartthat the resource files appear in theIfTemplatefor some resourceThe values are the file paths within the
IfContentPart
- clear()
Clears out all the path data stored
IniTexModel
- defclear
- class IniTexModel(iniFolderPath: str, fixedPaths: Dict[int, Dict[str, List[str]]], texEdits: Dict[int, Dict[str, List[BaseTexEditor]]], origPaths: Optional[Dict[int, List[str]]] = None)
This class inherits from
IniResourceModelContains data for editting some texture files in a .ini file
Supported Operations:
- for fixedPath, fixedFullPath, origPath, origFullPath in x
Iterates over all the fixed paths to some texture within a
IfContentPart,x
The tuples to iterate over are as follows: #. fixedPath: (
str) The path name of the fixed file #. fixedFullPath: (str) The full path name to the fixed file #. origPath: (Optional[str]) The path to the orignal file, if available #. origFullPath: (Optional[str]) The full path name to the original file, if available
- Parameters
iniFolderPath (
str) – The folder path to where the .ini file of the resource is locatedfixedPaths (Dict[
int, Dict[str, List[str]]]) –The file paths to the fixed files for the resource
The outer keys are the indices to the
IfContentPartthat the .dds files appears in theIfTemplatefor some textureThe inner keys are the names for the type of mod to fix to
The inner values are the file paths within the
IfContentPart
texEdits (Dict[
int, Dict[str, List[BaseTexEditor]]]) –The texture editors used to edit the texture
The outer keys are the indices to the
IfContentPartthat the .dds files appears in theIfTemplatefor some textureThe inner keys are the names for the type of mod to fix to
The inner values are the different texture editors used to the .dds files
origPaths (Optional[Dict[
int, List[str]]]) –The file paths for the resource
The keys are the indices to the
IfContentPartthat the .dds files appears in theIfTemplatefor some textureThe values are the file paths within the
IfContentPart
Default:
None
- clear()
Clears out all the path data stored
FileStats
- defaddFixed
- defaddRemoved
- defaddSkipped
- defaddUndoed
- defaddVisitedAtRemoval
- defclear
- defupdate
- defupdateFixed
- defupdateRemoved
- defupdateSkipped
- defupdateUndoed
- defupdateVisitedAtRemoval
- class FileStats
Keeps track of different types of files encountered by the program
- skippedByMods
The exceptions to file paths that were skipped due to errors, grouped for each mod folder paths
The outer keys are the names to the mod folders
The inner keys are the names of the file paths
The inner values are the errors encountered
- undoed
The file paths for files that got undoed to a previous state before the software was ran
- Type
Set[
str]
- visitedAtRemoval
The file paths for files that got visited when attempting to remove those files
- Type
Set[
str]
- addFixed(filePath: str)
Adds a new file path to the paths of fixed files
- Parameters
filePath (
str) – the new file path to a fixed file
- addRemoved(filePath: str)
Adds in a new file path that got removed
- Parameters
filePath (
str) – The file path that got removed
- addSkipped(filePath: str, error: Exception, modFolder: Optional[str] = None)
Adds a new file path to the paths of skipped files
- Parameters
- addUndoed(filePath: str)
Adds in a new file path that got undoeds
- Parameters
filePath (
str) – The file path that got undoed
- addVisitedAtRemoval(filePath: str)
Adds in a new file path that got visited when the software attempts to remove the file
- Parameters
filePath (
str) – The file path that got visited when the software attempts to remove the file
- clear()
Clears out all saved data about the files
- update(modFolder: Optional[str] = None, newFixed: Optional[Set[str]] = None, newSkipped: Optional[Dict[str, Exception]] = None, newRemoved: Optional[Set[str]] = None, newUndoed: Optional[Set[str]] = None, newVisitedAtRemoval: Optional[Set[str]] = None)
Updates the overall file paths in this class
Note
See
FileStats.updateFixed(),FileStats.updateSkipped()andFileStats.updateRemoved()for more details- Parameters
modFolder (Optional[
str]) –The folder where the files got skipped
Default:
NonenewFixed (Optional[Set[
str]]) –The newly added file paths that got fixed
Default:
NonenewSkipped (Optional[Dict[
str,Exception]]) –The newly skipped file paths due to errors within a particular mod folder
Default:
NonenewRemoved (Optional[Set[
str]]) –The newly added file paths that got removed
Default:
NonenewUndoed (Optional[Set[
str]]) –The newly added file paths that got contents undoed to a previous state before the software was ran
Default:
NonenewVisitedAtRemoved (Optional[Set[
str]]) –The newly added file paths that got visited when the software attempts to remove those files
Default:
None
- updateFixed(newFixed: Set[str])
Adds in new fixed file paths
- Parameters
newFixed (Set[
str]) – The newly added file paths that got fixed
- updateRemoved(newRemoved: Set[str])
Adds in new file paths that got removed
- Parameters
newRemoved (Set[
str]) – The newly added file paths that got removed
- updateSkipped(newSkipped: Dict[str, Exception], modFolder: Optional[str] = None)
Adds in new file paths that got skipped due to errors
Texture Editing
Classes to help with editting texture files.
BaseTexEditor
- deffix
- class BaseTexEditor
Base class to edit some .dds file
- fix(texFile: TextureFile, fixedTexFile: str)
Edits the texture file
- Parameters
texFile (
TextureFile) – The texture .dds file to be modifiedfixedTexFile (
str) – The name of the fixed texture file
TexEditor
- class TexEditor(pixelFilters: Optional[List[Union[BasePixelFilter, Callable[[Colour], Colour]]]] = None, preProcessors: Optional[List[Union[BaseTexFilter, Callable[[TextureFile], Any]]]] = None, postProcessors: Optional[List[Union[BaseTexFilter, Callable[[TextureFile], Any]]]] = None)
This class inherits from
BaseTexEditorClass for editing a texture file
- Parameters
pixelFilters (Optional[List[Union[
BasePixelFilter, Callable[[Colour], Any]]]]) –The filters to edit a single pixel in the texture file
Default:
NonepreProcessor (Optional[List[Union[
BaseTexFilter, Callable[[TextureFile], Any]]]]) –The pre-processors that transform the loaded image before the individual pixels are editted by
TexEditor.pixelFilters
Default:
NonepostProcessor (Optional[List[Union[
BaseTexFilter, Callable[[TextureFile], Any]]]]) –The post-processors that transform the loaded image after the individual pixels are editted by
TexEditor.pixelFilters
Default:
None
- pixelFilters
The filters to edit a single pixel in the texture file
- Type
List[Union[
BasePixelFilter, Callable[[Colour],Colour]]]
- preProcessors
The pre-processors that transform the loaded image before the individual pixels are editted by
TexEditor.pixelFilters- Type
List[Union[
BaseTexFilter, Callable[[TextureFile], Any]]]
- postProcessors
The post-processors that transform the loaded image after the individual pixels are editted by
TexEditor.pixelFilters- Type
List[Union[
BaseTexFilter, Callable[[TextureFile], Any]]]
- classmethod adjustBrightness(texFile: TextureFile, brightness: float)
Adjust the brightness of the texture
- Parameters
texFile (
TextureFile) – The texture file to be edittedbrightness (
float) –The brightness to adjust the texture.
0 => make the image black 1 => original brightness of the image >1 => make the image brighter
- classmethod adjustSaturation(texFile: TextureFile, saturation: float)
Adjust the saturation of the texture
- Parameters
texFile (
TextureFile) – The texture file to be edittedbrightness (
float) –The brightness to adjust the texture.
0 => make the image black and white 1 => original saturation of the image >1 => make the image really saturated like a TV
- classmethod adjustTranparency(texFile: TextureFile, alpha: int)
Adjust the transparency of the texture
- Parameters
texFile (
TextureFile) – The texture file to be edittedalpha (
int) –The value for the alpha (transparency) channel of each pixel. Range from 0 - 255.
0 => Transparent 255 => Opaque
- fix(texFile: TextureFile, fixedTexFile: str)
Edits the texture file
- Parameters
texFile (
TextureFile) – The texture .dds file to be modifiedfixedTexFile (
str) – The name of the fixed texture file
TexCreator
- deffix
- class TexCreator(width: int, height: int, colour: Optional[Colour] = None)
This class inherits from
BaseTexEditorCreates a brand new .dds file if the file doe not exist
- fix(texFile: TextureFile, fixedTexFile: str)
Edits the texture file
- Parameters
texFile (
TextureFile) – The texture .dds file to be modifiedfixedTexFile (
str) – The name of the fixed texture file
Colour
- class Colour(red: int = 255, green: int = 255, blue: int = 255, alpha: int = 255)
Class to store data for a colour
- Parameters
red (
int) –The red channel for the colour
Default:
255green (
int) –The green channel for the colour
Default:
255blue (
int) –The blue channel for the colour
Default:
255alpha (
int) –The transparency (alpha) channel for the colour with a range from 0-255. 0 = transparent, 255 = opaque
Default:
255
- classmethod boundColourChannel(val: int, min: int = 0, max: int = 255)
Makes a colour channel to be in between the minimum and maximum value
ColourRange
- defmatch
Texture Filters
Classes to transform the image within a TextureFile
BaseTexFilter
- deftransform
- class BaseTexFilter
Base class for transforming a texture file
- transform(texFile: TextureFile)
Applies a Transformation to ‘texFile’
- Parameters
texFile (
TextureFile) – The texture to be editteds
HueAdjust
- def_adjustHue
- deftransform
- class HueAdjust(hue: int)
This class inherits from
BaseTexFilterAdjusts the hue of a texture file
- Parameters
hue (
int) – The hue to adjust the image. Value is from -180 to 180
- transform(texFile: TextureFile)
Applies a Transformation to ‘texFile’
- Parameters
texFile (
TextureFile) – The texture to be editteds
Pixel Filters
Classes to help transform a single pixel within a texture file.
BasePixelFilter
- deftransform
- class BasePixelFilter
Base class for transforming a pixel in a texture file
ColourReplace
- deftransform
- class ColourReplace(replaceColour: Colour, colourToReplace: Optional[Union[Colour, ColourRange]] = None, replaceAlpha: bool = True)
This class inherits from
BasePixelFilterReplaces a coloured pixel
Paramaters
- replaceColour:
Colour The colour to fill in
- colourToReplace: Optional[Union[
Colour,ColourRange]] The colour to find to be replaced. If this value is
None, then will always replace the colour of the pixel
Default:
None- replaceAlpha:
bool Whether to also replace the alpha channel of the original colour
Default:
True
- colourToReplace
The colour to find to be replaced. If this value is
None, then will always replace the colour of the pixel- Type
Optional[Union[
Colour,ColourRange]]
- replaceColour:
HighlightShadow
- class HighlightShadow(highlight: float = 0, shadow: float = 0)
This class inherits from
BasePixelFilterA filter that approximates the adjustment of the shadow/hightlight of an image
Note
Reference: Highlight Shadow Approximation Reference
- Parameters
highlight (
float) –The amount of highlight to apply to the pixel. Range from -1 to 1, and 0 = no change
Default:
0
- highlight
The amount of shadow to apply to the pixel. Range from -1 to 1, and 0 = no change
- Type
InvertAlpha
- deftransform
- class InvertAlpha
This class inherits from
BasePixelFilterInverts the alpha channel of a pixel
TempControl
- deftransform
- class TempControl(temp: int = 0)
This class inherits from
BasePixelFilterControls the temperature of a texture file
- Parameters
temp (
int) –The temperature to set the image. Range from -100 to 100
Default:
None
Views
Different display views for the project.
Logger
- clsLogger.getBulletStr
- clsLogger.getNumberedStr
- def_addLogTxt
- def_setDefaultHeadingAtts
- defbox
- defbulletPoint
- defclear
- defcloseHeading
- deferror
- defgetStr
- defhandleException
- definput
- deflist
- deflog
- defopenHeading
- defspace
- defsplit
- defwaitExit
- class Logger(prefix: str = '', logTxt: bool = False, verbose: bool = True)
Class for pretty printing output to display on the console
- Parameters
- _headings
A stack of headings that have been opened (by calling
Heading.open()), but have not been closed yet (have not calledHeading.close()yet)- Type
Deque[
Heading]
- _addLogTxt(txt: str)
Appends the text to the logged output to be printed to a .txt file
- Parameters
txt (
str) – The text to be added onto the logged output
- _setDefaultHeadingAtts()
Sets the default attributes for printing out a header line
- box(message: str, header: str)
Prints the message to be sandwiched by the text defined in the argument,
header
- bulletPoint(txt: str)
Prints out an item in an unordered list
- Parameters
txt (
str) – The message we want to print out
- clear()
Clears out any saved text from the logger
- closeHeading()
Prints out a closing heading that corresponds to a previous opening heading printed (see line 3 of the example at
Heading)
- error(message: str)
Prints an error message
- Parameters
message (
str) – The message we want to print out
- handleException(exception: Exception)
Prints the message for an error
- Parameters
exception (
Exception) – The error we want to handle
- list(lst: List[str], transform: Optional[Callable[[str], str]] = None)
Prints out an ordered list
- Parameters
- log(message: str)
Regularly prints text onto the console
- Parameters
message (
str) – The message we want to print out
- openHeading(txt: str, sideLen: int = 2, headingChar='=')
Prints out an opening heading
- Parameters
txt (
str) – The message we want to print outsideLen (
int) –How many characters we want for the side border of the heading
(see line 1 of the example atHeading)
Default: 2
headingChar (
str) –The type of character used to print the side border of the heading
(see line 3 of the example atHeading)
Default: “=”
- property prefix
The line of text that is printed before any message is printed out
- Getter
Returns such a prefix
- Setter
Sets up such a prefix for the logger
- Type
- space()
Prints out a space
- split()
Prints out a new line
- waitExit()
Prints the message used when the script finishes running
Heading
- class Heading(title: str = '', sideLen: int = 0, sideChar: str = '=')
Class for handling information about a heading for pretty printing
Examples
1======= Title: Fix Raiden Boss 2 ======= 2... 3========================================
- Parameters
- sideLen
The number of characters we want one side for the border of the opening heading to have
- Type
Enums
Some useful Enumerations and constants.
ModTypes
- class ModTypes(value)
The supported types of mods that can be fixed
- Amber
Amber mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Amber)((?!(RemapBlend|CN)).)*Blend.*\s*\]- Type
- AmberCN
Amber Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(AmberCN)((?!RemapBlend).)*Blend.*\s*\]- Type
- Arlecchino
Arlecchino mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Arlecchino)((?!RemapBlend).)*Blend.*\s*\]- Type
- Barbara
Barabara mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Barbara)((?!RemapBlend|Summertime).)*Blend.*\s*\]- Type
- BarbaraSummertime
Barabara Summertime mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(BarbaraSummertime)((?!RemapBlend).)*Blend.*\s*\]- Type
- Fischl
Fischl mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Fischl)((?!RemapBlend|Highness).)*Blend.*\s*\]- Type
- FischlHighness
Fischl Highness mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(FischlHighness)((?!RemapBlend).)*Blend.*\s*\]- Type
- Ganyu
Ganyu mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Ganyu)((?!(RemapBlend|Twilight)).)*Blend.*\s*\]- Type
- GanyuTwilight
Ganyu Latern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(GanyuTwilight)((?!(RemapBlend)).)*Blend.*\s*\]- Type
- Jean
Jean mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Jean)((?!(RemapBlend|CN|Sea)).)*Blend.*\s*\]- Type
- JeanCN
Jean Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(JeanCN)((?!RemapBlend|Sea).)*Blend.*\s*\]- Type
- JeanSea
Jean Summertime mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(JeanSea)((?!RemapBlend|CN).)*Blend.*\s*\]- Type
- Keqing
Keqing mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Keqing)((?!(RemapBlend|Opulent)).)*Blend.*\s*\]- Type
- KeqingOpulent
Keqing Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(KeqingOpulent)((?!RemapBlend).)*Blend.*\s*\]- Type
- Kirara
Kirara mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Kirara)((?!RemapBlend|Boots).)*Blend.*\s*\]- Type
- KiraraBoots
Kirara in Boots mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(KiraraBoots)((?!RemapBlend).)*Blend.*\s*\]- Type
- Mona
Mona mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Mona)((?!(RemapBlend|CN)).)*Blend.*\s*\]- Type
- MonaCN
Mona Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(MonaCN)((?!RemapBlend).)*Blend.*\s*\]- Type
- Nilou
Nilou mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Nilou)((?!(RemapBlend|Breeze)).)*Blend.*\s*\]- Type
- NilouBreeze
Nilou Forest Fairy mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(NilouBreeze)((?!(RemapBlend)).)*Blend.*\s*\]- Type
- Ningguang
Ningguang Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Ningguang)((?!(RemapBlend|Orchid)).)*Blend.*\s*\]- Type
- NingguangOrchid
Ningguang Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(NingguangOrchid)((?!RemapBlend).)*Blend.*\s*\]- Type
- Raiden
Raiden mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Raiden|Shogun)((?!RemapBlend).)*Blend.*\s*\]- Type
- Rosaria
Rosaria mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Rosaria)((?!(RemapBlend|CN)).)*Blend.*\s*\]- Type
- RosariaCN
Rosaria Chinese mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(RosariaCN)((?!RemapBlend).)*Blend.*\s*\]- Type
- Shenhe
Shenhe mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(Shenhe)((?!RemapBlend|FrostFlower).)*Blend.*\s*\]- Type
- ShenheFrostFlower
Shenhe Lantern Rite mods
Checks if the .ini file contains a section with the regex
^\s*\[\s*TextureOverride.*(ShenheFrostFlower)((?!RemapBlend).)*Blend.*\s*\]- Type
IniKeywords
- class IniKeywords(value)
Common keywords used in the .ini file
- Blend = 'Blend'
The substring that usually occurse in the name of section to indicate that the section will call some *.Blend.buf file
- Draw = 'draw'
Location to draw a resource
- Filename = 'filename'
The filename for some resource
- Handling = 'handling'
Handling
- Hash = 'hash'
The unique id for a part in the mod
- HashNotFound = 'HashNotFound'
The hash for a mod has not been found
- IndexNotFound = 'IndexNotFound'
The index for a mod has not been found
- MatchFirstIndex = 'match_first_index'
The index location to map some resource
- RemapBlend = 'RemapBlend'
The substring used to indicate that the section references some *.RemapBlend.buf file
- RemapTex = 'RemapTex'
The substring used to indicate that the section contains some editted/created texture *.Remap.dds file
- Vb1 = 'vb1'
Vertex buffer #1
IfPredPartType
- class IfPredPartType(value)
Enum for the possible types for an
IfPredPart- Elif = 'elif'
The part contains the starting keyword ‘elif’
- Else = 'else'
The part contains the staring keyword ‘else’
- EndIf = 'endif'
The part contains the staring keyword ‘endif’
- If = 'if'
The part contains the staring keyword ‘if’
- classmethod getType(rawPredPart: str)
Retrieves the type for an
IfPredPart- Parameters
rawPredPart (
str) – The predicate string for theIfPredPart- Returns
The type found based off ‘rawPredPart’
- Return type
Optional[
IfPredPartType]
ColourConsts
- class ColourConsts(value)
Constants about colours
- MaxColourDegree = 360
Maximum degrees for some HSV/HSL images
- MaxColourValue = 255
Maximum bound for a colour channel
- MinColourDegree = 0
Minimum degrees for some HSV/HSL images
- MinColourValue = 0
Minimum bound for a colour channel
Colours
- class Colours(value)
Some common colours used
- LightMapGreenMin
Minimum range for the green colour usually in the LightMap.dds
- Type
:class:`Colour`(0, 125, 0, 0)
ImgFormats
- class ImgFormats(value)
Different formats for an image
- HSV = 'HSV'
HSV (hue, saturation, value) image
- RGB = 'RGB'
RGB (red, green blue) image
- RGBA = 'RGBA'
RGBA (red, green, blue) image
FileExt
- class FileExt(value)
Different file extensions for files
- Buf = '.buf'
Buffer file extension
- DDS = '.dds'
Direct Draw Surface file extension
- Ini = '.ini'
Initialization file extension
- Txt = '.txt'
Text file extension
FileTypes
- class FileTypes(value)
Different types of files the software encounters
- Blend = 'Blend.buf'
Blend.buf files
- Default = 'file'
Default file type
- Ini = '*.ini file'
Initialization files
- Log = 'RemapFixLog.txt'
Log file
- RemapBlend = 'RemapBlend.buf'
RemapBlend.buf files
- RemapTexture = 'RemapTex.dds'
RemapTex.dds files
- Texture = '*.dds'
Texture .dds files
Utilities
Some useful utility classes.
FileService
- clsFileService.absPathOfRelPath
- clsFileService.changeExt
- clsFileService.copyFile
- clsFileService.disableFile
- clsFileService.getFiles
- clsFileService.getFilesAndDirs
- clsFileService.getRelPath
- clsFileService.getSingleFiles
- clsFileService.ntPathToPosix
- clsFileService.parseOSPath
- clsFileService.read
- clsFileService.readBinary
- clsFileService.rename
- clsFileService.writeBinary
- class FileService
Tools for handling with files and folders
- classmethod absPathOfRelPath(dstPath: str, relFolder: str) str
Retrieves the absolute path of the relative path of a file with respect to a certain folder
- classmethod disableFile(file: str, filePrefix: str = 'DISABLED_RemapBackup_') str
Marks a file as ‘DISABLED’ and changes the file to a .txt file
- classmethod getFiles(path: Optional[str] = None, filters: Optional[List[Callable[[str], bool]]] = None, files: Optional[List[str]] = None) Union[List[str], List[List[str]]]
Retrieves many different types of files within a folder
Note
Only retrieves files that are the direct children of the folder (will not retrieve files nested in a folder within the folder we are searching)
- Parameters
path (Optional[
str]) –The path to the target folder we are working with. If this value is set to
None, then will use the current directory of where this module is loaded
Default:
Nonefilters (Optional[List[Callable[[
str],bool]]]) –Different filter functions for each type of file we are trying to get. If this values is either
Noneor[], then will default to a filter to get all the files
Default:
Nonefiles (Optional[List[
str]]) –The files contained in the target folder
If this value is set to
None, then the function will search for the files
Default:
None
- Returns
The files partitioned into the different types specified by the filters
If ‘filters’ only has 1 element, then the function returns List[
str] Otherwise, will return List[List[str]]- Return type
- classmethod getFilesAndDirs(path: Optional[str] = None, recursive: bool = False) List[List[str]]
Retrieves the files and folders contained in a certain folder
- Parameters
- Returns
The files and directories within the folder. The order for the result is:
files
folders
- Return type
- classmethod getRelPath(path: str, start: str) str
Tries to get the relative path of a file/folder relative to another folder, if possible.
If it is not possible to get the relative path, will return back the original file path
Note
An example where it would not be possible to get the relative path would be:
If the file is located in one mount (eg. C:/ drive) and the folder is located in another mount (eg. D:/ drive)
- classmethod getSingleFiles(path: Optional[str] = None, filters: Optional[Dict[str, Callable[[str], bool]]] = None, files: Optional[List[str]] = None, optional: bool = False) Union[str, None, List[str], List[Optional[str]]]
Retrieves exactly 1 of each type of file in a folder
- Parameters
path (Optional[
str]) –The path to the target folder we are searching.
If this value is set to
None, then will use the current directory of where this module is loaded
Default:
Nonefilters (Optional[Dict[str, Callable[[
str],bool]]]) –Different filter functions for each type of file we are trying to get. If this value is
Noneor{}, then will default to use a filter to get all filesThe keys are the names for the file type
Default:
Nonefiles (Optional[List[
str]]) –The files contained in the target folder
If this value is set to
None, then the function will search for the files
Default:
Noneoptional (
bool) –Whether we want to send an exception if there is not exactly 1 file for a certain type of file
If this value is
Falseand there are no files for a certain type of file, then will raise aMissingFileExceptionIf this value is
Falseand there are more than 1 file for a certain type of file, then will raise aDuplicateFileExceptionIf this value is
Trueand there are no files for a certain type of file, then the file for that type of file will beNoneIf this value is
Trueand there are more than 1 file for a certain type of file, then will retrieve the first file for that type of file
Default:
False
- Raises
MissingFileException – if
optionalis set toFalseand there are not files for a certain type of fileDuplicateFileException – if
optionalis set toFalseand there are more than 1 file for a certain type of file
- Returns
The files partitioned for each type of file
- Return type
- classmethod ntPathToPosix(path: str) str
Converts a file path from the ntpath library to a file path for the os library
Note
The character for the folder paths (
/or\) used in both libraries may be different depending on the OS
- classmethod parseOSPath(path: str)
Retrieves a normalized file path from a string
- Parameters
path (
str) – The string containing some sort of file path
- classmethod read(file: str, fileCode: str, postProcessor: Callable[[TextIoWrapper], Any]) Any
Tries to read a file using different file encodings
Will interact with the file using the following order of encodings:
utf-8
latin1
- Parameters
file (
str) – The file we are trying to read fromfileCode (
str) – What file mode to interact with the file (eg. r, rb, r+, etc…)postProcessor (Callable[[TextIoWrapper], Any]) – A function used to process the file pointer of the opened file
- Returns
The result after processing the file pointer of the opened file
- Return type
Any
DictTools
- class DictTools
Tools for handling with Dictionaries
- classmethod combine(dict1: Dict[Hashable, Any], dict2: Dict[Hashable, Any], combineDuplicate: Optional[Callable[[Any, Any], Any]] = None) Dict[Hashable, Any]
Creates a new dictionary from combining 2 dictionaries
- Parameters
dict1 (Dict[Hashable, Any]) – The destination of where we want the combined dictionaries to be stored
dict2 (Dict[Hashable, Any]) – The dictionary we want to combine with
combineDuplicate (Optional[Callable[[Any, Any], Any]]) –
Function for handling cases where there contains the same key in both dictionaries
If this value is set to
None, then will use the key from ‘dict2’
Default:
NonemakeNewCopy (
bool) – Whether we want the resultant dictionary to be newly created or to be updated intodict1
- Returns
The new combined dictionary
- Return type
Dict[Hashable, Any]
- classmethod filter(dict: Dict[Hashable, Any], predicate: Callable[[Hashable, Any], bool]) Dict[Hashable, Any]
Filters a dictionary
- Parameters
dict (Dict[Hashable, Hashable]) – The dictionary to filter
predicate (Callable[[Hashable, Any],
bool]) –The predicate used for the filter
The predicate has the following parameters
The key of the dictionary
The value of the dictionary
- Returns
The filtered dictionary
- Return type
Dict[Hashable, Any]
- classmethod forDict(nestedDict: Dict[Hashable, Any], keyNames: List[str], func: Callable[[Dict[str, Hashable], Dict[str, Any]], Any])
Iterates over a nested dictionary
- Parameters
nestedDict (Dict[Hashable, Any]) – The nested dictionary to iterate over
keyNames (List[
str]) – The variable names of the keys in the nested dictionaryfunc (Callable[Dict[
str, Hashable], Dict[str, Any], Any]) –callback function that will be called at the leaf node of the nested dictionary
The function contains the following arguments: #. The dictionary keys encountered in the current iteration #. The corresponding values encountered at each dictionary layer in the current iteration
- classmethod getFirstKey(dict: Dict[Any, Any]) Any
Retrieves the first key in a dictionary
- Parameters
dict (Dict[Any, Any]) –
The dictionary we are working with
Note
The dictionary must not be empty
- Returns
The first key of the dictionary
- Return type
Any
- classmethod getFirstValue(dict: Dict[Any, Any]) Any
Retrieves the first value in a dictionary
- Parameters
dict (Dict[Any, Any]) – The dictionary we are working with
- Returns
The first value of the dictionary
- Return type
Any
- classmethod invert(dict: Dict[Hashable, Hashable]) Dict[Hashable, Hashable]
Inverts a dictionary by making the keys the values and the values the keys
- Parameters
dict (Dict[Hashable, Hashable]) – The dictionary to invert
- Returns
The inverted dictionary
- Return type
Dict[Hashable, Hashable]
- classmethod update(srcDict: Dict[Hashable, Any], newDict: Dict[Hashable, Any], combineDuplicate: Optional[Callable[[Any, Any], Any]] = None) Dict[Hashable, Any]
Updates
srcDictbased off the new values fromnewDict- Parameters
srcDict (Dict[Hashable, Any]) – The dictionary to be updated
newDict (Dict[Hashable, Any]) – The dictionary to help with updating
srcDictcombineDuplicate (Optional[Callable[[Any, Any], Any]]) –
Function for handling cases where there contains the same key in both dictionaries
The first parameter comes from
srcDictThe second parameter comes from
newDict
If this value is set to
None, then will use the key fromnewDict
Default:
None
- Returns
Reference to the updated dictionary
- Return type
Dict[Hashable, Any]
TextTools
- class TextTools
-
- classmethod getTextLines(txt: str) List[str]
Retrieves the lines of text, split by the newline character, similar to how python’s readlines function works
- classmethod removeLines(txtLines: List[str], partIndices: List[Tuple[int, int]]) List[str]
Removes multiple sub-lists of lines from a list of text lines
- Parameters
- Returns
The new lines of text with the removed lines
- Return type
List[
str]
FilePath
- class FilePath(path: str)
Class for storing info about a file path
- Parameters
path (
str) – The file path
- property base
The base for the file path (includes file extension)
- Getter
Retrieves the base
- Setter
Sets the new base for the file path
- Type
- property baseName
The basename for the file path without any file extensions
- Getter
Retrieves the basename
- Setter
Sets the new basename for the file path
- Type
- property folder
The parent folder for the path
- Getter
Retrieves the parent folder name
- Setter
Sets the new parent folder name
- Type
Cache
- defclear
- class Cache(capacity: int = 128, cacheStorage: Optional[Any] = None)
Class for a generic cache
Supported Operations:
- len(x)
Retrieves the size of the
Cache,x
- x[key]
Retrieves the value from the
Cache,x, from the keykey
- x[key] = newValue
Sets the key
keyof theCache,x, to have the value ofnewValue
- Parameters
LruCache
- defclear
- class LruCache(capacity: int = 128)
This class inherits from
CacheClass for an LRU cache
Supported Operations:
- len(x)
Retrieves the size of the
LruCache,x
- x[key]
Retrieves the value from the
LruCache,x, from the keykey
- x[key] = newValue
Sets the key
keyof theLruCache,x, to have the value ofnewValue
- Parameters
capacity (
int) –The maximum capacity of the cache
Default: 128
Algo
- class Algo
Tools for some basic algorithms
- classmethod binaryInsert(lst: List[T], target: T, compare: Callable[[T, T], bool], optionalInsert: bool = False) bool
Insert’s ‘target’ into ‘lst’ using binary search
- Parameters
lst (List[T]) – The sorted list we want to insert the target element
target (T) – The target element to insert
compare (Callable[[T, T],
bool]) – The compare function for comparing elements in the list with the target elementoptionalInsert (
bool) –Whether to still insert the target element into the list if the element target element is found in the list
Default:
False
- Returns
Whether the target element has been inserted into the list
- Return type
- classmethod binarySearch(lst: List[T], target: T, compare: Callable[[T, T], bool]) List[Union[int, bool]]
Performs binary search to search for ‘target’ in ‘lst’
- Parameters
lst (List[T]) – The sorted list we are searching from
target (T) – The target element to search for in the list
compare (Callable[[T, T],
bool]) – The compare function for comparing elements in the list with the target element
- Returns
The first element is whether the target element is found in the list
The second element is the found index or the index that we expect the target element to be in the list
- Return type
Builder
- class Builder(cls: Type[BuildCls], args: Optional[List[Any]] = None, kwargs: Optional[Dict[str, Any]] = None)
Class to dynamically create a new object
- Parameters
cls (Type[T]) – The class for the objects to be built from
args (Optional[List[Any]]) –
The constant arguments used to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
The constant keyword arguments used to build the object
Default:
None
- cls
The class for the objects to be built from
- Type
Type[T]
- args
The constant arguments used to build the object
- Type
List[Any]
- build(*args, **kwargs) BuildCls
Builds the object
- Parameters
*args – arguments to build the object
**kwargs – keyword arguments to build the object
- Returns
The built objects
- Return type
T
FlyweightBuilder
- defbuild
- class FlyweightBuilder(cls: Type[BuildCls], args: Optional[List[Any]] = None, kwargs: Optional[Dict[str, Any]] = None)
This class inherits from
BuilderA flyweight factory for building the same reusable objects (based off flyweight design pattern)
- build(args: Optional[List[Any]] = None, kwargs: Optional[Dict[str, Any]] = None, id: Optional[Hashable] = None, cache: bool = True) BuildCls
Builds the object
- Parameters
args (Optional[List[Any]]) –
arguments to build the object
Default:
Nonekwargs (Optional[Dict[str, Any]]) –
keyword arguments to build the object
Default:
Noneid (Optional[Hashable]) –
The id for the repeating states to be built by the object
If this value is
None, then will auto-generate an id
Default:
Nonecache (
bool) –Whether to cache the built object
Note
If this value is set to
False, then this function behaves the same asBuilder.build()Default:
True
- Returns
The built objects
- Return type
T
Exceptions
Error
- class Error(message: str)
The base exception used by this module
- Parameters
message (
str) – the error message to print out
FileException
- class FileException(message: str, path: Optional[str] = None)
This Class inherits from
ErrorExceptions relating to files
- Parameters
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
DuplicateFileException
- class DuplicateFileException(files: List[str], fileType: str = 'file', path: Optional[str] = None)
This Class inherits from
FileExceptionException when there are multiple files of the same type in a folder
- Parameters
files (List[
str]) – The files that triggered the exceptionfileType (
str) –The name for the type of files
Default: “file”
path (Optional[
str]) –The path to the folder where the files are located If this value is
None, then the path will be the current directory where this module is loaded
Default:
None
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
MissingFileException
- class MissingFileException(fileType: str = 'file', path: Optional[str] = None)
This Class inherits from
FileExceptionException when a certain type of file is missing from a folder
- Parameters
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
RemapMissingBlendFile
- class RemapMissingBlendFile(remapBlend: str)
This Class inherits from
FileExceptionException when a RemapBlend.buf file is missing its corresponding Blend.buf file
- Parameters
remapBlend (
str) – The path to the RemapBlend.buf file
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
BlendFileNotRecognized
- class BlendFileNotRecognized(blendFile: str)
This Class inherits from
FileExceptionException when a Blend.buf file cannot be read
- Parameters
blendFile (
str) – The file path to the Blend.buf file
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
BadBlendData
- class BadBlendData
This Class inherits fsrom
ErrorException when certain bytes do not correspond to the format defined for a Blend.buf file
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
ConflictingOptions
- class ConflictingOptions(options: List[str])
This Class inherits from
ErrorException when the script or
RemapServiceis ran with options that cannot be used together- Parameters
options (List[
str]) – The options that cannot be used together
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
InvalidModType
- class InvalidModType(type: str)
This Class inherits from
ErrorException when the type of mod specified to fix is not found
- Parameters
type (
str) – The name for the type of mod specified
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.