pyffi.spells.nif — NetImmerse/Gamebryo File/Keyframe (.nif/.kf/.kfa) spells¶
Module which contains all spells that check something in a NIF file.
Spells for dumping particular blocks from nifs.
pyffi.spells.nif.fix — spells to fix errors¶
Module which contains all spells that fix something in a nif.
Implementation¶
-
class
pyffi.spells.nif.fix.SpellDelTangentSpace(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellDelete tangentspace if it is present.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellAddTangentSpace(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellAdd tangentspace if none is present.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellFFVT3RSkinPartition(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellCreate or update skin partition, with settings that work for Freedom Force vs. The 3rd Reich.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellFixTexturePath(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.fix.SpellParseTexturePathFix the texture path. Transforms 0x0a into n and 0x0d into r. This fixes a bug in nifs saved with older versions of nifskope. Also transforms / into . This fixes problems when packing files into a bsa archive. Also if the version is 20.0.0.4 or higher it will check for bad texture path form of e.g. c:program filesbethsoftobtexturesfilepath.dds and replace it with e.g. texturesfilepath.dds.
-
class
pyffi.spells.nif.fix.SpellDetachHavokTriStripsData(*args, **kwargs)[source]¶ Bases:
pyffi.spells.nif.NifSpellFor NiTriStrips if their NiTriStripsData also occurs in a bhkNiTriStripsShape, make deep copy of data in havok. This is mainly useful as a preperation for other spells that act on NiTriStripsData, to ensure that the havok data remains untouched.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
dataentry()[source]¶ Called before all blocks are recursed. The default implementation simply returns
True. You can access the data viadata, and unlike in thedatainspect()method, the full file has been processed at this stage.Typically, you will override this function to perform a global operation on the file data.
- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellClampMaterialAlpha(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellClamp corrupted material alpha values.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellSendGeometriesToBindPosition(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.SpellVisitSkeletonRootsTransform skinned geometries so similar bones have the same bone data, and hence, the same bind position, over all geometries.
-
class
pyffi.spells.nif.fix.SpellSendDetachedGeometriesToNodePosition(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.SpellVisitSkeletonRootsTransform geometries so each set of geometries that shares bones is aligned with the transform of the root bone of that set.
-
class
pyffi.spells.nif.fix.SpellSendBonesToBindPosition(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.SpellVisitSkeletonRootsTransform bones so bone data agrees with bone transforms, and hence, all bones are in bind position.
-
class
pyffi.spells.nif.fix.SpellMergeSkeletonRoots(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellMerges skeleton roots in the NIF file so that no skeleton root has another skeleton root as child. Warns if merge is impossible (this happens if the global skin data of the geometry is not the unit transform).
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
dataentry()[source]¶ Called before all blocks are recursed. The default implementation simply returns
True. You can access the data viadata, and unlike in thedatainspect()method, the full file has been processed at this stage.Typically, you will override this function to perform a global operation on the file data.
- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellApplySkinDeformation(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellApply skin deformation to nif.
-
class
pyffi.spells.nif.fix.SpellScale(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellScale a model.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
dataentry()[source]¶ Called before all blocks are recursed. The default implementation simply returns
True. You can access the data viadata, and unlike in thedatainspect()method, the full file has been processed at this stage.Typically, you will override this function to perform a global operation on the file data.
- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellFixCenterRadius(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.check.SpellCheckCenterRadiusRecalculate geometry centers and radii.
-
class
pyffi.spells.nif.fix.SpellFixSkinCenterRadius(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.check.SpellCheckSkinCenterRadiusRecalculate skin centers and radii.
-
class
pyffi.spells.nif.fix.SpellFixMopp(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.check.SpellCheckMoppRecalculate mopp data from collision geometry.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellCleanStringPalette(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellRemove unused strings from string palette.
-
branchentry(branch)[source]¶ Parses string palette of either a single controller sequence, or of all controller sequences in a controller manager.
>>> seq = NifFormat.NiControllerSequence() >>> seq.string_palette = NifFormat.NiStringPalette() >>> block = seq.add_controlled_block() >>> block.string_palette = seq.string_palette >>> block.set_variable_1("there") >>> block.set_node_name("hello") >>> block.string_palette.palette.add_string("test") 12 >>> seq.string_palette.palette.get_all_strings() [b'there', b'hello', b'test'] >>> SpellCleanStringPalette().branchentry(seq) pyffi.toaster:INFO:parsing string palette False >>> seq.string_palette.palette.get_all_strings() [b'hello', b'there'] >>> block.get_variable_1() b'there' >>> block.get_node_name() b'hello'
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellDelUnusedRoots(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellRemove root branches that shouldn’t be root branches and are unused in the file such as NiProperty branches that are not properly parented.
-
dataentry()[source]¶ Called before all blocks are recursed. The default implementation simply returns
True. You can access the data viadata, and unlike in thedatainspect()method, the full file has been processed at this stage.Typically, you will override this function to perform a global operation on the file data.
- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.fix.SpellFixEmptySkeletonRoots(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellFix empty skeleton roots in an as sane as possible way.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
dataentry()[source]¶ Called before all blocks are recursed. The default implementation simply returns
True. You can access the data viadata, and unlike in thedatainspect()method, the full file has been processed at this stage.Typically, you will override this function to perform a global operation on the file data.
- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
Regression tests¶
Spells for optimizing NIF files.
-
class
pyffi.spells.nif.optimize.SpellCleanRefLists(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellRemove empty and duplicate entries in reference lists.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
dataentry()[source]¶ Called before all blocks are recursed. The default implementation simply returns
True. You can access the data viadata, and unlike in thedatainspect()method, the full file has been processed at this stage.Typically, you will override this function to perform a global operation on the file data.
- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.optimize.SpellMergeDuplicates(*args, **kwargs)[source]¶ Bases:
pyffi.spells.nif.NifSpellRemove duplicate branches.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.optimize.SpellOptimizeGeometry(*args, **kwargs)[source]¶ Bases:
pyffi.spells.nif.NifSpellOptimize all geometries: - remove duplicate vertices - triangulate - recalculate skin partition - recalculate tangent space
-
branchentry(branch)[source]¶ Optimize a NiTriStrips or NiTriShape block:
remove duplicate vertices
retriangulate for vertex cache
recalculate skin partition
recalculate tangent space
Todo
Limit the size of shapes (see operation optimization mod for Oblivion!)
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.optimize.SpellOptimize(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.SpellCleanFarNifSpellDelUnusedRootsSpellCleanRefListsSpellDetachHavokTriStripsDataSpellFixTexturePathSpellClampMaterialAlphaSpellFixBhkSubShapesSpellFixEmptySkeletonRootsSpellOptimizeGeometrySpellOptimizeCollisionBoxSpellOptimizeCollisionGeometrySpellMergeDuplicatesGlobal fixer and optimizer spell.
-
class
pyffi.spells.nif.optimize.SpellDelUnusedBones(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellRemove nodes that are not used for anything.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
dataentry()[source]¶ Called before all blocks are recursed. The default implementation simply returns
True. You can access the data viadata, and unlike in thedatainspect()method, the full file has been processed at this stage.Typically, you will override this function to perform a global operation on the file data.
- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
pyffi.spells.nif.modify — spells to make modifications¶
Module which contains all spells that modify a nif.
-
class
pyffi.spells.nif.modify.SpellTexturePath(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.fix.SpellParseTexturePathChanges the texture path while keeping the texture names.
-
substitute(old_path)[source]¶ Helper function to allow subclasses of this spell to change part of the path with minimum of code. This implementation returns path unmodified.
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellSubstituteTexturePath(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.fix.SpellFixTexturePathRuns a regex replacement on texture paths.
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
classmethod
-
class
pyffi.spells.nif.modify.SpellLowResTexturePath(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.modify.SpellSubstituteTexturePathChanges the texture path by replacing ‘textures*’ with ‘textureslowres*’ - used mainly for making _far.nifs
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
classmethod
-
class
pyffi.spells.nif.modify.SpellCollisionType(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellSets the object collision to be a different type
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellCollisionMaterial(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellSets the object’s collision material to be a different type
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellScaleAnimationTime(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellScales the animation time.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellReverseAnimation(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellReverses the animation by reversing datas in relation to the time.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellSubstituteStringPalette(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.fix.SpellCleanStringPaletteSubstitute strings in a string palette.
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
classmethod
-
class
pyffi.spells.nif.modify.SpellChangeBonePriorities(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellChanges controlled block priorities based on controlled block name.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellSetInterpolatorTransRotScale(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellChanges specified bone(s) translations/rotations in their NiTransformInterpolator.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellDelInterpolatorTransformData(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellDeletes the specified bone(s) NiTransformData(s).
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
classmethod
toastentry(toaster)[source]¶ Called just before the toaster starts processing all files. If it returns
False, then the spell is not used. The default implementation simply returnsTrue.For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.
- Parameters
toaster (
Toaster) – The toaster this spell is called from.- Returns
Trueif the spell applies,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellDelBranches(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellDelete blocks that match the exclude list.
-
class
pyffi.spells.nif.modify._SpellDelBranchClasses(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.modify.SpellDelBranchesDelete blocks that match a given list. Only useful as base class for other spells.
-
BRANCH_CLASSES_TO_BE_DELETED= ()¶ List of branch classes that have to be deleted.
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellDelSkinShapes(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.modify.SpellDelBranchesDelete any geometries with a material name of ‘skin’
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellDisableParallax(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellDisable parallax shader (for Oblivion, but may work on other nifs too).
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellAddStencilProperty(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.NifSpellAdds a NiStencilProperty to each geometry if it is not present.
-
branchentry(branch)[source]¶ Cast the spell on the given branch. First called with branch equal to
data’s children, then the grandchildren, and so on. The default implementation simply returnsTrue.Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.
- Parameters
branch (
GlobalNode) – The branch to cast the spell on.- Returns
Trueif the children must be processed,Falseotherwise.- Return type
bool
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellDelVertexColor(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.nif.modify.SpellDelBranchesDelete vertex color properties and vertex color data.
-
branchinspect(branch)[source]¶ Like
_branchinspect(), but for customization: can be overridden to perform an extra inspection (the default implementation always returnsTrue).- Parameters
branch (
GlobalNode) – The branch to check.- Returns
Trueif the branch must be processed,Falseotherwise.- Return type
bool
-
datainspect()[source]¶ This is called after
pyffi.object_models.FileFormat.Data.inspect()has been called, and beforepyffi.object_models.FileFormat.Data.read()is called. Override this function for customization.- Returns
Trueif the file must be processed,Falseotherwise.- Return type
bool
-
-
class
pyffi.spells.nif.modify.SpellMakeSkinlessNif(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.SpellDelSkinShapesSpellAddStencilPropertySpell to make fleshless CMR (Custom Model Races) clothing/armour type nifs.
-
class
pyffi.spells.nif.modify.SpellCleanFarNif(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.SpellDelVertexColorPropertySpellDelAlphaPropertySpellDelSpecularPropertySpellDelBSXFlagsSpellDelStringExtraDatasSpellDelTangentSpaceSpellDelCollisionDataSpellDelAnimationSpellDisableParallaxSpell to clean _far type nifs (for even more optimizations, combine this with the optimize spell).
-
class
pyffi.spells.nif.modify.SpellMakeFarNif(toaster=None, data=None, stream=None)[source]¶ Bases:
pyffi.spells.SpellDelVertexColorPropertySpellDelAlphaPropertySpellDelSpecularPropertySpellDelBSXFlagsSpellDelStringExtraDatasSpellDelTangentSpaceSpellDelCollisionDataSpellDelAnimationSpellDisableParallaxSpellLowResTexturePathSpell to make _far type nifs (for even more optimizations, combine this with the optimize spell).