Bases: pyffi.object_models.xml.FileFormat
This class contains the generated classes from the xml.
Bases: pyffi.object_models.xml.struct_.StructBase
Used in NiDefaultAVObjectPalette.
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 32-bit integer, describing how transparency is handled in a texture.
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 32-bit integer, describing the apply mode of a texture.
Bases: pyffi.object_models.xml.struct_.StructBase
A texture reference used by NiArkTextureExtraData.
Bases: pyffi.formats.nif.NiNode
Morrowind specific?
Bases: pyffi.formats.nif.NiObject
Bethesda-specific node.
Bases: pyffi.formats.nif.NiNode
Bethesda-Specific node.
Bases: pyffi.formats.nif.NiNode
Bethesda-Specific node.
Bases: pyffi.formats.nif.NiNode
Bethesda-Specific node.
Bases: pyffi.formats.nif.NiExtraData
Bethesda-specific node. (for dynamic decal projection?)
Bases: pyffi.formats.nif.NiSkinInstance
Bethesda-specific node.
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific node.
Bases: pyffi.formats.nif.NiNode
Bethesda-specific fade node.
Bases: pyffi.formats.nif.NiTimeController
Bethesda-specific node.
Bases: pyffi.formats.nif.NiExtraData
Unknown. Marks furniture sitting positions?
Bases: pyffi.formats.nif.NiKeyframeController
An extended keyframe controller.
Bases: pyffi.formats.nif.NiNode
Bethesda-Specific node.
Bases: pyffi.formats.nif.NiFloatInterpController
Bethesda-Specific node.
Bases: pyffi.formats.nif.NiObject
Bethesda-specific node.
Bases: pyffi.formats.nif.BSMultiBoundData
Bethesda-specific node.
Bases: pyffi.formats.nif.NiObject
Abstract base type for bounding data.
Bases: pyffi.formats.nif.NiNode
Bethesda-specific node.
Bases: pyffi.formats.nif.BSMultiBoundData
Bethesda-specific node.
Bases: pyffi.formats.nif.NiNode
Bethesda-Specific node.
Bases: pyffi.formats.nif.NiPSysVolumeEmitter
Particle emitter that uses a node, its children and subchildren to emit from. Emission will be evenly spread along points from nodes leading to their direct parents/children only.
Bases: pyffi.formats.nif.NiPSysModifierCtlr
Particle system (multi?) emitter controller.
Bases: pyffi.formats.nif.NiPSysModifier
Bethesda-Specific Particle node.
Bases: pyffi.formats.nif.NiPSysModifier
Bethesda-Specific (mesh?) Particle System Modifier.
Bases: pyffi.formats.nif.NiPSysModifier
Particle modifier that adds a blend of object space translation and rotation to particles born in world space.
Bases: pyffi.formats.nif.NiTimeController
Bethesda-specific node.
Bases: pyffi.formats.nif.NiFloatInterpController
Bethesda-Specific node.
Bases: pyffi.formats.nif.NiTriShape
Bethesda-specific node.
Bases: pyffi.object_models.xml.struct_.StructBase
Bethesda-specific node.
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific property.
Bases: pyffi.formats.nif.BSShaderLightingProperty
Bethesda-specific property.
Bases: pyffi.formats.nif.BSShaderLightingProperty
Bethesda-specific Shade node.
Bases: pyffi.formats.nif.NiProperty
Bethesda-specific Property node
Bases: pyffi.formats.nif.NiObject
Bethesda-specific Texture Set.
Bases: pyffi.object_models.xml.enum.EnumBase
The type of animation interpolation (blending) that will be used on the associated key frames.
Bases: pyffi.formats.nif.NiPSysData
Bethesda-Specific (mesh?) Particle System Data.
Bases: pyffi.formats.nif.NiParticleSystem
Bethesda-Specific (mesh?) Particle System.
Bases: pyffi.object_models.xml.struct_.StructBase
Bethesda-specific node.
Bases: pyffi.formats.nif.NiInterpolator
Bethesda-specific node.
Bases: pyffi.object_models.xml.struct_.StructBase
Bethesda-specific node.
Bases: pyffi.formats.nif.NiNode
Bethesda-Specific node. Found on fxFire effects
Bases: pyffi.formats.nif.NiExtraData
Bethesda-specific node.
Bases: pyffi.formats.nif.NiPSysModifier
Particle Modifier that uses the wind value from the gamedata to alter the path of particles.
Bases: pyffi.formats.nif.NiIntegerExtraData
Controls animation and collision. Integer holds flags:Bit 0 : enable animationBit 1 : enable collisionBit 2 : is skeleton nif?Bit 3 : toggable? unknown, set to 1 on oblivion signsBit 4 : FlameNodes presentBit 5 : EditorMarkers present
Bases: pyffi.object_models.xml.enum.EnumBase
Determines the way the billboard will react to the camera.
Bases: pyffi.object_models.xml.struct_.StructBase
Body part list for DismemberSkinInstance
Bases: pyffi.object_models.xml.struct_.StructBase
Bounding box.
Bases: pyffi.object_models.xml.struct_.StructBase
Box Bounding Volume
Bases: pyffi.object_models.xml.basic.BasicBase
Array (list) of bytes. Implemented as basic type to speed up reading and also to prevent data to be dumped by __str__.
Bases: pyffi.object_models.xml.struct_.StructBase
A color without alpha (red, green, blue).
Bases: pyffi.object_models.xml.struct_.StructBase
A color with alpha (red, green, blue, alpha).
Bases: pyffi.object_models.xml.basic.BasicBase
Matrix of bytes. Implemented as basic type to speed up reading and to prevent data being dumped by __str__.
Bases: pyffi.object_models.xml.struct_.StructBase
Capsule Bounding Volume
Bases: pyffi.object_models.xml.struct_.StructBase
Channel data
Bases: pyffi.object_models.xml.enum.EnumBase
Sets how objects are to be cloned.
Bases: pyffi.object_models.xml.struct_.StructBase
A color without alpha (red, green, blue).
Bases: pyffi.object_models.xml.struct_.StructBase
A color with alpha (red, green, blue, alpha).
Bases: pyffi.object_models.xml.enum.EnumBase
The data format of components.
Bases: pyffi.object_models.xml.enum.EnumBase
Used by NiGeometryData to control the volatility of the mesh. While they appear to be flags they behave as an enum.
Bases: pyffi.formats.nif._ControllerLink
>>> from pyffi.formats.nif import NifFormat
>>> link = NifFormat.ControllerLink()
>>> link.node_name_offset
-1
>>> link.set_node_name("Bip01")
>>> link.node_name_offset
0
>>> link.get_node_name()
'Bip01'
>>> link.node_name
'Bip01'
>>> link.set_node_name("Bip01 Tail")
>>> link.node_name_offset
6
>>> link.get_node_name()
'Bip01 Tail'
>>> link.node_name
'Bip01 Tail'
Return the node name.
>>> # a doctest
>>> from pyffi.formats.nif import NifFormat
>>> link = NifFormat.ControllerLink()
>>> link.string_palette = NifFormat.NiStringPalette()
>>> palette = link.string_palette.palette
>>> link.node_name_offset = palette.add_string("Bip01")
>>> link.get_node_name()
'Bip01'
>>> # another doctest
>>> from pyffi.formats.nif import NifFormat
>>> link = NifFormat.ControllerLink()
>>> link.node_name = "Bip01"
>>> link.get_node_name()
'Bip01'
Bases: pyffi.object_models.xml.enum.EnumBase
Determines the way that UV texture coordinates are generated.
Bases: pyffi.object_models.xml.enum.EnumBase
The animation cyle behavior.
Bases: pyffi.object_models.Data
A class to contain the actual nif data.
Note that L{header} and L{blocks} are not automatically kept in sync with the rest of the nif data, but they are resynchronized when calling L{write}.
| Variable version: | |
|---|---|
| The nif version. | |
| Variable user_version: | |
| The nif user version. | |
| Variable user_version2: | |
| The nif user version 2. | |
| Variable roots: | List of root blocks. |
| Variable header: | |
| The nif header. | |
| Variable blocks: | |
| List of blocks. | |
| Variable neosteam: | |
| Neo Steam style nif? | |
Quickly checks whether the stream appears to contain nif data, and read the nif header. Resets stream to original position.
Call this function if you only need to inspect the header of the nif.
| Parameter: | stream (file) – The file to inspect. |
|---|
This function checks the version only, and is faster than the usual inspect function (which reads the full header). Sets the L{version} and L{user_version} instance variables if the stream contains a valid nif file.
Call this function if you simply wish to check that a file is a nif file without having to parse even the header.
| Raises ValueError: | |
|---|---|
| If the stream does not contain a nif file. | |
| Parameter: | stream (file) – The stream from which to read. |
Read a nif file. Does not reset stream position.
| Parameters: |
|
|---|
Write a nif file. The L{header} and the L{blocks} are recalculated from the tree at L{roots} (e.g. list of block types, number of blocks, list of block types, list of strings, list of block sizes etc.).
| Parameters: |
|
|---|
Bases: pyffi.object_models.xml.enum.EnumBase
Determines how a data stream is used?
Bases: pyffi.object_models.xml.struct_.StructBase
Array of Vectors for Decal placement in BSDecalPlacementVectorExtraData.
Bases: pyffi.object_models.xml.enum.EnumBase
Determines decay function. Used by NiPSysBombModifier.
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific node.
Bases: pyffi.object_models.xml.enum.EnumBase
The type of information that’s store in a texture used by a NiTextureEffect.
Bases: pyffi.object_models.xml.enum.EnumBase
Controls which parts of the mesh that the particles are emitted from.
Bases: pyffi.object_models.xml.enum.EnumBase
This enum lists the different face culling options.
Bases: pyffi.object_models.xml.enum.EnumBase
The force field’s type.
Bases: pyffi.formats.nif.string
A file path.
Bases: pyffi.object_models.xml.enum.EnumBase
The type of force? May be more valid values.
Bases: pyffi.object_models.xml.struct_.StructBase
Describes a furniture position?
Bases: pyffi.formats.nif.FxWidget
Unknown.
Bases: pyffi.formats.nif.FxWidget
Unknown.
Bases: pyffi.formats.nif.NiNode
Firaxis-specific UI widgets?
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific node.
Bases: pyffi.object_models.xml.enum.EnumBase
A material, used by havok shape objects.
Bases: pyffi.object_models.xml.enum.EnumBase
Determines how the raw image data is stored in NiRawImageData.
Bases: pyffi.object_models.xml.struct_.StructBase
A generic key with support for interpolation. Type 1 is normal linear interpolation, type 2 has forward and backward tangents, and type 3 has tension, bias and continuity arguments. Note that color4 and byte always seem to be of type 1.
Bases: pyffi.object_models.xml.struct_.StructBase
Array of vector keys (anything that can be interpolated, except rotations).
Bases: pyffi.object_models.xml.enum.EnumBase
The type of animation interpolation (blending) that will be used on the associated key frames.
Bases: pyffi.object_models.xml.struct_.StructBase
The distance range where a specific level of detail applies.
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 32-bit integer, describing how vertex colors influence lighting.
Bases: pyffi.formats.nif.BSShaderPPLightingProperty
Bethesda-specific node.
Bases: pyffi.object_models.xml.basic.BasicBase
Basic type for strings ending in a newline character (0x0a).
>>> from tempfile import TemporaryFile
>>> f = TemporaryFile()
>>> l = NifFormat.LineString()
>>> f.write('abcdefg\x0a'.encode())
>>> f.seek(0)
>>> l.read(f)
>>> str(l)
'abcdefg'
>>> f.seek(0)
>>> l.set_value('Hi There')
>>> l.write(f)
>>> f.seek(0)
>>> m = NifFormat.LineString()
>>> m.read(f)
>>> str(m)
'Hi There'
Bases: pyffi.object_models.xml.struct_.StructBase
Group of vertex indices of vertices that match.
Bases: pyffi.object_models.xml.struct_.StructBase
Data stored per-material by NiRenderObject
Bases: pyffi.object_models.xml.struct_.StructBase
A 2x2 matrix of float values. Stored in OpenGL column-major format.
Bases: pyffi.object_models.xml.enum.EnumBase
Describes the type of primitives stored in a mesh object.
Bases: pyffi.object_models.xml.struct_.StructBase
Description of a MipMap within a NiPixelData object.
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 32-bit integer, describing how mipmaps are handled in a texture.
Bases: pyffi.object_models.xml.struct_.StructBase
Geometry morphing data component.
Bases: pyffi.object_models.xml.enum.EnumBase
The motion type. Determines quality of motion?
Bases: pyffi.object_models.xml.enum.EnumBase
The motion system. 4 (Box) is used for everything movable. 7 (Keyframed) is used on statics and animated stuff.
Bases: pyffi.formats.nif.NiObject
Unknown!
Bases: pyffi.formats.nif.NiObject
Unknown!
Bases: pyffi.formats.nif.NiObject
Unknown!
Bases: pyffi.formats.nif.NiObject
Unknown!
Bases: pyffi.formats.nif.NiObject
Unknown!
Bases: pyffi.formats.nif.NiObject
Unknown!
Bases: pyffi.formats.nif._NiAVObject
>>> from pyffi.formats.nif import NifFormat
>>> node = NifFormat.NiNode()
>>> prop1 = NifFormat.NiProperty()
>>> prop1.name = "hello"
>>> prop2 = NifFormat.NiProperty()
>>> prop2.name = "world"
>>> node.get_properties()
[]
>>> node.set_properties([prop1, prop2])
>>> [prop.name for prop in node.get_properties()]
['hello', 'world']
>>> [prop.name for prop in node.properties]
['hello', 'world']
>>> node.set_properties([])
>>> node.get_properties()
[]
>>> # now set them the other way around
>>> node.set_properties([prop2, prop1])
>>> [prop.name for prop in node.get_properties()]
['world', 'hello']
>>> [prop.name for prop in node.properties]
['world', 'hello']
>>> node.remove_property(prop2)
>>> [prop.name for prop in node.properties]
['hello']
>>> node.add_property(prop2)
>>> [prop.name for prop in node.properties]
['hello', 'world']
Add the given property to the property list.
| Parameter: | prop (L{NifFormat.NiProperty}) – The property block to add. |
|---|
Apply scale factor on data.
| Parameter: | scale – The scale factor. |
|---|
Return a list of the properties of the block.
| Returns: | The list of properties. |
|---|---|
| Return type: | list of L{NifFormat.NiProperty} |
Return scale, rotation, and translation into a single 4x4 matrix, relative to the C{relative_to} block (which should be another NiAVObject connecting to this block). If C{relative_to} is None, then returns the transform stored in C{self}, or equivalently, the target is assumed to be the parent.
| Parameter: | relative_to – The block relative to which the transform must be calculated. If None, the local transform is returned. |
|---|
Remove the given property to the property list.
| Parameter: | prop (L{NifFormat.NiProperty}) – The property block to remove. |
|---|
Set the list of properties from the given list (destroys existing list).
| Parameter: | proplist (list of L{NifFormat.NiProperty}) – The list of property blocks to set. |
|---|
Set rotation, translation, and scale, from a 4x4 matrix.
| Parameter: | m – The matrix to which the transform should be set. |
|---|
Bases: pyffi.formats.nif.NiObject
Unknown.
Bases: pyffi.formats.nif.NiFloatInterpController
Time controller for transparency.
Bases: pyffi.formats.nif.NiProperty
Transparency. Flags 0x00ED.
Bases: pyffi.formats.nif.NiLight
Ambient light source.
Bases: pyffi.formats.nif.NiExtraData
Unknown node.
Bases: pyffi.formats.nif.NiExtraData
Unknown node.
Bases: pyffi.formats.nif.NiExtraData
Unknown node.
Bases: pyffi.formats.nif.NiExtraData
Unknown node.
Bases: pyffi.formats.nif.NiExtraData
Unknown node.
Bases: pyffi.formats.nif.NiParticles
Unknown.
Bases: pyffi.formats.nif.NiParticlesData
Particle system data object (with automatic normals?).
Bases: pyffi.formats.nif.NiNode
Bethesda-specific extension of Node with animation properties stored in the flags, often 42?
Bases: pyffi.formats.nif.NiBoneLODController
A simple LOD controller for bones.
Bases: pyffi.formats.nif.NiParticleSystemController
A particle system controller, used by BS in conjunction with NiBSParticleNode.
Bases: pyffi.formats.nif.NiNode
Unknown.
Bases: pyffi.formats.nif.NiObject
Stores the number of control points of a B-spline.
Bases: pyffi.formats.nif.NiBSplineFloatInterpolator
Unknown.
Bases: pyffi.formats.nif.NiBSplinePoint3Interpolator
Unknown.
Bases: pyffi.formats.nif._NiBSplineData
>>> # a doctest
>>> from pyffi.formats.nif import NifFormat
>>> block = NifFormat.NiBSplineData()
>>> block.num_short_control_points = 50
>>> block.short_control_points.update_size()
>>> for i in range(block.num_short_control_points):
... block.short_control_points[i] = 20 - i
>>> list(block.get_short_data(12, 4, 3))
[(8, 7, 6), (5, 4, 3), (2, 1, 0), (-1, -2, -3)]
>>> offset = block.append_short_data([(1,2),(4,3),(13,14),(8,2),(33,33)])
>>> offset
50
>>> list(block.get_short_data(offset, 5, 2))
[(1, 2), (4, 3), (13, 14), (8, 2), (33, 33)]
>>> list(block.get_comp_data(offset, 5, 2, 10.0, 32767.0))
[(11.0, 12.0), (14.0, 13.0), (23.0, 24.0), (18.0, 12.0), (43.0, 43.0)]
>>> block.append_float_data([(1.0,2.0),(3.0,4.0),(0.5,0.25)])
0
>>> list(block.get_float_data(0, 3, 2))
[(1.0, 2.0), (3.0, 4.0), (0.5, 0.25)]
>>> block.append_comp_data([(1,2),(4,3)])
(60, 2.5, 1.5)
>>> list(block.get_short_data(60, 2, 2))
[(-32767, -10922), (32767, 10922)]
>>> list(block.get_comp_data(60, 2, 2, 2.5, 1.5)) # doctest: +ELLIPSIS
[(1.0, 2.00...), (4.0, 2.99...)]
Append data as compressed list.
| Parameter: | data – A list of elements, where each element is a tuple of integers. (Note: cannot be an interator; maybe this restriction will be removed in a future version.) |
|---|---|
| Returns: | The offset, bias, and multiplier. |
Append data.
| Parameter: | data – A list of elements, where each element is a tuple of floats. (Note: cannot be an interator; maybe this restriction will be removed in a future version.) |
|---|---|
| Returns: | The offset at which the data was appended. |
Append data.
| Parameter: | data – A list of elements, where each element is a tuple of integers. (Note: cannot be an interator; maybe this restriction will be removed in a future version.) |
|---|---|
| Returns: | The offset at which the data was appended. |
Get an interator to the data, converted to float with extra bias and multiplication factor. If C{x} is the short value, then the returned value is C{bias + x * multiplier / 32767.0}.
| Parameters: |
|
|---|---|
| Returns: | A list of C{num_elements} tuples of size C{element_size}. |
Get an iterator to the data.
| Parameters: |
|
|---|---|
| Returns: | A list of C{num_elements} tuples of size C{element_size}. |
Get an iterator to the data.
| Parameters: |
|
|---|---|
| Returns: | A list of C{num_elements} tuples of size C{element_size}. |
Bases: pyffi.formats.nif.NiBSplineInterpolator
Unknown.
Bases: pyffi.formats.nif.NiBSplineInterpolator
Unknown.
Bases: pyffi.formats.nif.NiAVObject
Unknown
Bases: pyffi.formats.nif.NiObject
Sub data of NiBezierMesh
Bases: pyffi.formats.nif.NiNode
These nodes will always be rotated to face the camera creating a billboard effect for any attached objects.In pre-10.1.0.0 the Flags field is used for BillboardMode.Bit 0: hiddenBits 1-2: collision modeBit 3: unknown (set in most official meshes)Bits 5-6: billboard modeCollision modes:00 NONE01 USE_TRIANGLES10 USE_OBBS11 CONTINUEBillboard modes:00 ALWAYS_FACE_CAMERA01 ROTATE_ABOUT_UP10 RIGID_FACE_CAMERA11 ALWAYS_FACE_CENTER
Bases: pyffi.formats.nif.NiExtraData
Binary extra data object. Used to store normals and binormals in Oblivion.
Bases: pyffi.formats.nif.NiObject
Voxel data object.
Bases: pyffi.formats.nif.NiExtraData
Voxel extra data object.
Bases: pyffi.formats.nif.NiBlendInterpolator
An interpolator for a bool.
Bases: pyffi.formats.nif.NiBlendInterpolator
An interpolator for a float.
Bases: pyffi.formats.nif.NiInterpolator
An extended type of interpolater.
Bases: pyffi.formats.nif.NiBlendInterpolator
Interpolates a point?
Bases: pyffi.formats.nif.NiBlendInterpolator
Unknown.
Bases: pyffi.formats.nif.NiNode
A NiNode used as a skeleton bone?
Bases: pyffi.formats.nif.NiTimeController
Level of detail controller for bones. Priority is arranged from low to high.
Bases: pyffi.formats.nif.NiObject
Timed boolean data.
Bases: pyffi.formats.nif.NiSingleInterpController
A controller that interpolates floating point numbers?
Bases: pyffi.formats.nif.NiKeyBasedInterpolator
Unknown.
Bases: pyffi.formats.nif.NiBoolInterpolator
Unknown.
Bases: pyffi.formats.nif.NiExtraData
Boolean extra data.
Bases: pyffi.formats.nif.NiAVObject
Camera object.
Bases: pyffi.formats.nif.NiTriBasedGeom
A shape node that holds continuous level of detail information.Seems to be specific to Freedom Force.
Bases: pyffi.formats.nif.NiTriBasedGeomData
Holds mesh data for continuous level of detail shapes.Pesumably a progressive mesh with triangles specified by edge splits.Seems to be specific to Freedom Force.The structure of this is uncertain and highly experimental at this point.No file with this data can currently be read properly.
Bases: pyffi.formats.nif.NiSkinInstance
A copy of NISkinInstance for use with NiClod meshes.
Bases: pyffi.formats.nif.NiCollisionObject
Collision box.
Bases: pyffi.formats.nif.NiObject
This is the most common collision object found in NIF files. It acts as a real object thatis visible and possibly (if the body allows for it) interactive. The node itselfis simple, it only has three properties.For this type of collision object, bhkRigidBody or bhkRigidBodyT is generally used.
Bases: pyffi.formats.nif.NiObject
Color data for material color controller.
Bases: pyffi.formats.nif.NiExtraData
Unknown.
Bases: pyffi.formats.nif.NiTimeController
Unknown. Root of all controllers?
Bases: pyffi.formats.nif.NiAVObjectPalette
Unknown. Refers to a list of objects. Used by NiControllerManager.
Bases: pyffi.formats.nif.NiLight
Directional light source.
Bases: pyffi.formats.nif.NiProperty
Unknown.
Bases: pyffi.formats.nif.NiAVObject
A dynamic effect such as a light or environment map.
Bases: pyffi.formats.nif.NiObjectNET
Unknown
Bases: pyffi.formats.nif.NiTriShapeData
Holds mesh data using a list of singular triangles.
Bases: pyffi.formats.nif.NiObject
A generic extra data object.
Bases: pyffi.formats.nif.NiSingleInterpController
An controller for extra data.
Bases: pyffi.formats.nif.NiFloatInterpController
Texture flipping controller.
Bases: pyffi.formats.nif.NiObject
Possibly the 1D position along a 3D path.
Bases: pyffi.formats.nif.NiExtraData
Float extra data.
Bases: pyffi.formats.nif.NiExtraDataController
Unknown.
Bases: pyffi.formats.nif.NiSingleInterpController
A controller that interpolates floating point numbers?
Bases: pyffi.formats.nif.NiKeyBasedInterpolator
Unknown.
Bases: pyffi.formats.nif.NiExtraData
Unknown.
Bases: pyffi.formats.nif.NiProperty
Describes... fog?
Bases: pyffi.formats.nif.NiInterpController
Time controller for geometry morphing.
Bases: pyffi.formats.nif._NiGeometry
>>> from pyffi.formats.nif import NifFormat
>>> id44 = NifFormat.Matrix44()
>>> id44.set_identity()
>>> skelroot = NifFormat.NiNode()
>>> skelroot.name = 'skelroot'
>>> skelroot.set_transform(id44)
>>> bone1 = NifFormat.NiNode()
>>> bone1.name = 'bone1'
>>> bone1.set_transform(id44)
>>> bone2 = NifFormat.NiNode()
>>> bone2.name = 'bone2'
>>> bone2.set_transform(id44)
>>> bone21 = NifFormat.NiNode()
>>> bone21.name = 'bone21'
>>> bone21.set_transform(id44)
>>> bone22 = NifFormat.NiNode()
>>> bone22.name = 'bone22'
>>> bone22.set_transform(id44)
>>> bone211 = NifFormat.NiNode()
>>> bone211.name = 'bone211'
>>> bone211.set_transform(id44)
>>> skelroot.add_child(bone1)
>>> bone1.add_child(bone2)
>>> bone2.add_child(bone21)
>>> bone2.add_child(bone22)
>>> bone21.add_child(bone211)
>>> geom = NifFormat.NiTriShape()
>>> geom.name = 'geom'
>>> geom.set_transform(id44)
>>> geomdata = NifFormat.NiTriShapeData()
>>> skininst = NifFormat.NiSkinInstance()
>>> skindata = NifFormat.NiSkinData()
>>> skelroot.add_child(geom)
>>> geom.data = geomdata
>>> geom.skin_instance = skininst
>>> skininst.skeleton_root = skelroot
>>> skininst.data = skindata
>>> skininst.num_bones = 4
>>> skininst.bones.update_size()
>>> skininst.bones[0] = bone1
>>> skininst.bones[1] = bone2
>>> skininst.bones[2] = bone22
>>> skininst.bones[3] = bone211
>>> skindata.num_bones = 4
>>> skindata.bone_list.update_size()
>>> [child.name for child in skelroot.children]
['bone1', 'geom']
>>> skindata.set_transform(id44)
>>> for bonedata in skindata.bone_list:
... bonedata.set_transform(id44)
>>> affectedbones = geom.flatten_skin()
>>> [bone.name for bone in affectedbones]
['bone1', 'bone2', 'bone22', 'bone211']
>>> [child.name for child in skelroot.children]
['geom', 'bone1', 'bone21', 'bone2', 'bone22', 'bone211']
Add bone with given vertex weights. After adding all bones, the geometry skinning information should be set from the current position of the bones using the L{update_bind_position} function.
| Parameters: |
|
|---|
Reposition all bone blocks and geometry block in the tree to be direct children of the skeleton root.
Returns list of all used bones by the skin.
Send all bones to their bind position.
Make current position of the bones the bind position for this geometry.
Sets the NiSkinData overall transform to the inverse of the geometry transform relative to the skeleton root, and sets the NiSkinData of each bone to the geometry transform relative to the skeleton root times the inverse of the bone transform relative to the skeleton root.
Bases: pyffi.formats.nif._NiGeometryData
>>> from pyffi.formats.nif import NifFormat
>>> geomdata = NifFormat.NiGeometryData()
>>> geomdata.num_vertices = 3
>>> geomdata.has_vertices = True
>>> geomdata.has_normals = True
>>> geomdata.has_vertex_colors = True
>>> geomdata.num_uv_sets = 2
>>> geomdata.vertices.update_size()
>>> geomdata.normals.update_size()
>>> geomdata.vertex_colors.update_size()
>>> geomdata.uv_sets.update_size()
>>> geomdata.vertices[0].x = 1
>>> geomdata.vertices[0].y = 2
>>> geomdata.vertices[0].z = 3
>>> geomdata.vertices[1].x = 4
>>> geomdata.vertices[1].y = 5
>>> geomdata.vertices[1].z = 6
>>> geomdata.vertices[2].x = 1.200001
>>> geomdata.vertices[2].y = 3.400001
>>> geomdata.vertices[2].z = 5.600001
>>> geomdata.normals[0].x = 0
>>> geomdata.normals[0].y = 0
>>> geomdata.normals[0].z = 1
>>> geomdata.normals[1].x = 0
>>> geomdata.normals[1].y = 1
>>> geomdata.normals[1].z = 0
>>> geomdata.normals[2].x = 1
>>> geomdata.normals[2].y = 0
>>> geomdata.normals[2].z = 0
>>> geomdata.vertex_colors[1].r = 0.310001
>>> geomdata.vertex_colors[1].g = 0.320001
>>> geomdata.vertex_colors[1].b = 0.330001
>>> geomdata.vertex_colors[1].a = 0.340001
>>> geomdata.uv_sets[0][0].u = 0.990001
>>> geomdata.uv_sets[0][0].v = 0.980001
>>> geomdata.uv_sets[0][2].u = 0.970001
>>> geomdata.uv_sets[0][2].v = 0.960001
>>> geomdata.uv_sets[1][0].v = 0.910001
>>> geomdata.uv_sets[1][0].v = 0.920001
>>> geomdata.uv_sets[1][2].v = 0.930001
>>> geomdata.uv_sets[1][2].v = 0.940001
>>> for h in geomdata.get_vertex_hash_generator():
... print(h)
(1000, 2000, 3000, 0, 0, 1000, 99000, 98000, 0, 92000, 0, 0, 0, 0)
(4000, 5000, 6000, 0, 1000, 0, 0, 0, 0, 0, 310, 320, 330, 340)
(1200, 3400, 5600, 1000, 0, 0, 97000, 96000, 0, 94000, 0, 0, 0, 0)
Generator which produces a tuple of integers for each (vertex, normal, uv, vcol), to ease detection of duplicate vertices. The precision parameters denote number of significant digits.
Default for uvprecision is higher than default for the rest because for very large models the uv coordinates can be very close together.
| Parameters: |
|
|---|---|
| Returns: | A generator yielding a hash value for each vertex. |
Bases: pyffi.formats.nif.NiParticleModifier
A particle modifier; applies a gravitational field on the particles.
Bases: pyffi.formats.nif.NiExtraData
Extra integer data.
Bases: pyffi.formats.nif.NiExtraData
Integers data.
Bases: pyffi.formats.nif.NiTimeController
A controller capable of interpolation?
Bases: pyffi.formats.nif.NiObject
Interpolator objects - function unknown.
Bases: pyffi.formats.nif.NiInterpolator
Interpolator objects that use keys?
Bases: pyffi.formats.nif.NiSingleInterpController
A time controller object for animation key frames.
Bases: pyffi.formats.nif.NiObject
Abstract class used for different types of LOD selections.
Bases: pyffi.formats.nif.NiSwitchNode
Level of detail selector. Links to different levels of detail of the same model, used to switch a geometry at a specified distance.
Bases: pyffi.formats.nif.NiDynamicEffect
Light source.
Bases: pyffi.formats.nif.NiPoint3InterpController
Light color animation controller.
Bases: pyffi.formats.nif.NiFloatInterpController
Unknown controller.
Bases: pyffi.formats.nif.NiFloatInterpController
Unknown controller
Bases: pyffi.formats.nif.NiTriBasedGeom
Wireframe geometry.
Bases: pyffi.formats.nif.NiGeometryData
Wireframe geometry data.
Bases: pyffi.formats.nif.NiTimeController
Unknown. Start time is 3.4e+38 and stop time is -3.4e+38.
Bases: pyffi.formats.nif.NiInterpolator
Unknown.
Bases: pyffi.formats.nif.NiPoint3InterpController
Time controller for material color. Flags are used for color selection in versions below 10.1.0.0.Bits 4-5: Target Color (00 = Ambient, 01 = Diffuse, 10 = Specular, 11 = Emissive)
Bases: pyffi.formats.nif.NiProperty
Describes the material shading properties.
Bases: pyffi.formats.nif.NiObject
Base class for mesh modifiers.
Bases: pyffi.formats.nif.NiPSysData
Particle meshes data.
Bases: pyffi.formats.nif.NiParticleSystem
Particle system.
Bases: pyffi.formats.nif.NiInterpController
Unknown! Used by Daoc->’healing.nif’.
Bases: pyffi.formats.nif.NiMeshModifier
Performs linear-weighted blending between a set of target data streams.
Bases: pyffi.formats.nif.NiInterpController
Unknown! Used by Daoc.
Bases: pyffi.formats.nif.NiInterpController
Unknown.
Bases: pyffi.formats.nif.NiProperty
(note: not quite complete yet... but already reads most of the DAoC ones)
Bases: pyffi.formats.nif._NiNode
>>> from pyffi.formats.nif import NifFormat
>>> x = NifFormat.NiNode()
>>> y = NifFormat.NiNode()
>>> z = NifFormat.NiNode()
>>> x.num_children =1
>>> x.children.update_size()
>>> y in x.children
False
>>> x.children[0] = y
>>> y in x.children
True
>>> x.add_child(z, front = True)
>>> x.add_child(y)
>>> x.num_children
2
>>> x.children[0] is z
True
>>> x.remove_child(y)
>>> y in x.children
False
>>> x.num_children
1
>>> e = NifFormat.NiSpotLight()
>>> x.add_effect(e)
>>> x.num_effects
1
>>> e in x.effects
True
>>> from pyffi.formats.nif import NifFormat
>>> node = NifFormat.NiNode()
>>> child1 = NifFormat.NiNode()
>>> child1.name = "hello"
>>> child_2 = NifFormat.NiNode()
>>> child_2.name = "world"
>>> node.get_children()
[]
>>> node.set_children([child1, child_2])
>>> [child.name for child in node.get_children()]
['hello', 'world']
>>> [child.name for child in node.children]
['hello', 'world']
>>> node.set_children([])
>>> node.get_children()
[]
>>> # now set them the other way around
>>> node.set_children([child_2, child1])
>>> [child.name for child in node.get_children()]
['world', 'hello']
>>> [child.name for child in node.children]
['world', 'hello']
>>> node.remove_child(child_2)
>>> [child.name for child in node.children]
['hello']
>>> node.add_child(child_2)
>>> [child.name for child in node.children]
['hello', 'world']
>>> from pyffi.formats.nif import NifFormat
>>> node = NifFormat.NiNode()
>>> effect1 = NifFormat.NiSpotLight()
>>> effect1.name = "hello"
>>> effect2 = NifFormat.NiSpotLight()
>>> effect2.name = "world"
>>> node.get_effects()
[]
>>> node.set_effects([effect1, effect2])
>>> [effect.name for effect in node.get_effects()]
['hello', 'world']
>>> [effect.name for effect in node.effects]
['hello', 'world']
>>> node.set_effects([])
>>> node.get_effects()
[]
>>> # now set them the other way around
>>> node.set_effects([effect2, effect1])
>>> [effect.name for effect in node.get_effects()]
['world', 'hello']
>>> [effect.name for effect in node.effects]
['world', 'hello']
>>> node.remove_effect(effect2)
>>> [effect.name for effect in node.effects]
['hello']
>>> node.add_effect(effect2)
>>> [effect.name for effect in node.effects]
['hello', 'world']
Add block to child list.
| Parameters: |
|
|---|
Add an effect to the list of effects.
| Parameter: | effect (L{NifFormat.NiDynamicEffect}) – The effect to add. |
|---|
Return a list of the children of the block.
| Returns: | The list of children. |
|---|---|
| Return type: | list of L{NifFormat.NiAVObject} |
Return a list of the effects of the block.
| Returns: | The list of effects. |
|---|---|
| Return type: | list of L{NifFormat.NiDynamicEffect} |
This function will look for other geometries whose skeleton root is a (possibly indirect) child of this node. It will then reparent those geometries to this node. For example, it will unify the skeleton roots in Morrowind’s cliffracer.nif file, or of the (official) body skins. This makes it much easier to import skeletons in for instance Blender: there will be only one skeleton root for each bone, over all geometries.
The merge fails for those geometries whose global skin data transform does not match the inverse geometry transform relative to the skeleton root (the maths does not work out in this case!)
Returns list of all new blocks that have been reparented (and added to the skeleton root children list), and a list of blocks for which the merge failed.
Remove a block from the child list.
| Parameter: | child (L{NifFormat.NiAVObject}) – The child to remove. |
|---|
Remove a block from the effect list.
| Parameter: | effect (L{NifFormat.NiDynamicEffect}) – The effect to remove. |
|---|
This function will send all bones of geometries of this skeleton root to their bind position. For best results, call L{send_geometries_to_bind_position} first.
| Returns: | A number quantifying the remaining difference between bind positions. |
|---|---|
| Return type: | float |
Some nifs (in particular in Morrowind) have geometries that are skinned but that do not share bones. In such cases, send_geometries_to_bind_position cannot reposition them. This function will send such geometries to the position of their root node.
Examples of such nifs are the official Morrowind skins (after merging skeleton roots).
Returns list of detached geometries that have been moved.
Call this on the skeleton root of geometries. This function will transform the geometries, such that all skin data transforms coincide, or at least coincide partially.
| Returns: | A number quantifying the remaining difference between bind positions. |
|---|---|
| Return type: | float |
Set the list of children from the given list (destroys existing list).
| Parameter: | childlist (list of L{NifFormat.NiAVObject}) – The list of child blocks to set. |
|---|
Set the list of effects from the given list (destroys existing list).
| Parameter: | effectlist (list of L{NifFormat.NiDynamicEffect}) – The list of effect blocks to set. |
|---|
Bases: pyffi.formats.nif.NiMeshModifier
The mesh modifier that performs all particle system simulation.
Bases: pyffi.formats.nif.NiPSSimulatorStep
Encapsulates a floodgate kernel that simulates particle colliders.
Bases: pyffi.formats.nif.NiPSSimulatorStep
Encapsulates a floodgate kernel that updates particle positions and ages. As indicated by its name, this step should be attached last in the NiPSSimulator mesh modifier.
Bases: pyffi.formats.nif.NiPSSimulatorStep
Encapsulates a floodgate kernel that simulates particle forces.
Bases: pyffi.formats.nif.NiPSSimulatorStep
Encapsulates a floodgate kernel that updates particle size, colors, and rotations.
Bases: pyffi.formats.nif.NiPSSimulatorStep
Encapsulates a floodgate kernel that updates mesh particle alignment and transforms.
Bases: pyffi.formats.nif.NiObject
Abstract base class for a single step in the particle system simulation process. It has no seralized data.
Bases: pyffi.formats.nif.NiPSysModifier
Unknown particle modifier.
Bases: pyffi.formats.nif.NiPSysFieldModifier
Particle system modifier, used for controlling the particle velocity in a field like wind.
Bases: pyffi.formats.nif.NiPSysModifier
Particle modifier that uses a NiNode to use as a “Bomb Object” to alter the path of particles.
Bases: pyffi.formats.nif.NiPSysModifier
Unknown particle system modifier.
Bases: pyffi.formats.nif.NiPSysVolumeEmitter
Particle emitter that uses points within a defined Box shape to emit from..
Bases: pyffi.formats.nif.NiObject
Particle system collider.
Bases: pyffi.formats.nif.NiPSysModifier
Particle modifier that adds a defined shape to act as a collision object for particles to interact with.
Bases: pyffi.formats.nif.NiPSysModifier
Particle modifier that adds keyframe data to modify color/alpha values of particles over time.
Bases: pyffi.formats.nif.NiPSysVolumeEmitter
Particle emitter that uses points within a defined Cylinder shape to emit from.
Bases: pyffi.formats.nif.NiRotatingParticlesData
Particle system data.
Bases: pyffi.formats.nif.NiPSysFieldModifier
Particle system modifier, used for controlling the particle velocity in drag space warp.
Bases: pyffi.formats.nif.NiPSysModifier
Unknown.
Bases: pyffi.formats.nif.NiPSysModifier
A particle emitter?
Bases: pyffi.formats.nif.NiPSysModifierCtlr
Particle system emitter controller.
Bases: pyffi.formats.nif.NiObject
Particle system emitter controller data.
Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr
Unknown.
Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr
Unknown.
Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr
Unknown.
Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr
Unknown.
Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr
Unknown.
Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr
Particle system controller, used for ???.
Bases: pyffi.formats.nif.NiPSysModifier
Base for all force field particle modifiers.
Bases: pyffi.formats.nif.NiPSysFieldModifier
Particle system modifier, used for controlling the particle velocity in gravity field.
Bases: pyffi.formats.nif.NiPSysModifier
Adds gravity to a particle system, when linked to a NiNode to use as a Gravity Object.
Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr
Unknown.
Bases: pyffi.formats.nif.NiPSysModifier
Particle modifier that controls the time it takes to grow a particle from Size=0 to the specified Size in the emitter, and then back to 0. This modifer has no control over alpha settings.
Bases: pyffi.formats.nif.NiPSysEmitter
Particle emitter that uses points on a specified mesh to emit from.
Bases: pyffi.formats.nif.NiPSysModifier
Unknown.
Bases: pyffi.formats.nif.NiObject
Generic particle system modifier object.
Bases: pyffi.formats.nif.NiPSysModifierBoolCtlr
Unknown.
Bases: pyffi.formats.nif.NiPSysModifierCtlr
A particle system modifier controller that deals with boolean data?
Bases: pyffi.formats.nif.NiSingleInterpController
A particle system modifier controller.
Bases: pyffi.formats.nif.NiPSysModifierCtlr
A particle system modifier controller that deals with floating point data?
Bases: pyffi.formats.nif.NiPSysCollider
Particle Collider object which particles will interact with.
Bases: pyffi.formats.nif.NiPSysModifier
Unknown particle system modifier.
Bases: pyffi.formats.nif.NiTimeController
Unknown.
Bases: pyffi.formats.nif.NiPSysModifier
Particle modifier that adds rotations to particles.
Bases: pyffi.formats.nif.NiPSysModifier
Unknown particle modifier.
Bases: pyffi.formats.nif.NiPSysVolumeEmitter
Particle emitter that uses points within a sphere shape to emit from.
Bases: pyffi.formats.nif.NiPSysCollider
Particle Collider object which particles will interact with.
Bases: pyffi.formats.nif.NiPSysEmitter
Guild 2-Specific node
Bases: pyffi.formats.nif.NiPSysFieldModifier
Particle system modifier, used for controlling the particle velocity in drag space warp.
Bases: pyffi.formats.nif.NiTimeController
Particle system controller, used for ???.
Bases: pyffi.formats.nif.NiPSysEmitter
An emitter that emits meshes?
Bases: pyffi.formats.nif.NiPSysFieldModifier
Particle system modifier, used for controlling the particle velocity in force field.
Bases: pyffi.formats.nif.NiObject
A color palette.
Bases: pyffi.formats.nif.NiParticleModifier
A particle modifier.
Bases: pyffi.formats.nif.NiParticleModifier
Unknown.
Bases: pyffi.formats.nif.NiParticleModifier
This particle system modifier controls the particle size. If it is present the particles start with size 0.0 . Then they grow to their original size and stay there until they fade to zero size again at the end of their lifetime cycle.
Bases: pyffi.formats.nif.NiParticleModifier
Unknown.
Bases: pyffi.formats.nif.NiParticles
Mesh particle node?
Bases: pyffi.formats.nif.NiRotatingParticlesData
Particle meshes data.
Bases: pyffi.formats.nif.NiObject
A particle system modifier.
Bases: pyffi.formats.nif.NiParticleModifier
Unknown.
Bases: pyffi.formats.nif.NiParticles
A particle system.
Bases: pyffi.formats.nif.NiTimeController
A generic particle system time controller object.
Bases: pyffi.formats.nif.NiGeometry
Generic particle system node.
Bases: pyffi.formats.nif.NiGeometryData
Generic rotating particles data object.
Bases: pyffi.formats.nif.NiTimeController
Time controller for a path.
Bases: pyffi.formats.nif.NiKeyBasedInterpolator
Unknown interpolator.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObject
Unknown node.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObjectNET
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.NiObject
Unknown PhysX node.
Bases: pyffi.formats.nif.ATextureRenderData
A texture.
Bases: pyffi.formats.nif.NiParticleModifier
Unknown.
Bases: pyffi.formats.nif.NiSingleInterpController
A controller that interpolates point 3 data?
Bases: pyffi.formats.nif.NiKeyBasedInterpolator
Unknown.
Bases: pyffi.formats.nif.NiLight
A point light.
Bases: pyffi.formats.nif.NiAVObject
A Portal
Bases: pyffi.formats.nif.NiObject
Position data.
Bases: pyffi.formats.nif.NiObjectNET
A generic property object.
Bases: pyffi.formats.nif.NiLODData
Describes levels of detail based on distance of object from camera.
Bases: pyffi.formats.nif.NiObject
Raw image data.
Bases: pyffi.formats.nif.NiAVObject
An object that can be rendered.
Bases: pyffi.formats.nif.NiSingleInterpController
Unknown.
Bases: pyffi.formats.nif.NiNode
Grouping node for nodes in a Portal
Bases: pyffi.formats.nif.NiNode
Grouping node for nodes in a Portal
Bases: pyffi.formats.nif.NiParticles
Unknown.
Bases: pyffi.formats.nif.NiParticlesData
Rotating particles data object.
Bases: pyffi.formats.nif.NiTriShape
Two dimensional screen elements.
Bases: pyffi.formats.nif.NiTriShapeData
Two dimensional screen elements.
Bases: pyffi.formats.nif.NiLODData
Describes levels of detail based on size of object on screen?
Bases: pyffi.formats.nif.NiObject
Root node used in some Empire Earth II .kf files (version 4.2.2.0).
Bases: pyffi.formats.nif.NiObjectNET
Keyframe animation root node, in .kf files.
Bases: pyffi.formats.nif.NiProperty
Determines whether flat shading or smooth shading is used on a shape.
Bases: pyffi.formats.nif.NiInterpController
A controller referring to a single interpolator.
Bases: pyffi.formats.nif.NiObject
Skinning instance.
Bases: pyffi.formats.nif.NiObject
Skinning data, optimized for hardware skinning. The mesh is partitioned in submeshes such that each vertex of a submesh is influenced only by a limited and fixed number of bones.
Bases: pyffi.formats.nif.NiNode
Unknown node. Found in Loki.
Bases: pyffi.formats.nif.NiSourceTexture
Unknown node. Found in Emerge Demo.
Bases: pyffi.formats.nif.NiTexture
Describes texture source and properties.
Bases: pyffi.formats.nif.NiProperty
Gives specularity to a shape. Flags 0x0001.
Bases: pyffi.formats.nif.NiParticleModifier
Unknown.
Bases: pyffi.formats.nif.NiPointLight
A spot.
Bases: pyffi.formats.nif.NiProperty
Allows control of stencil testing.
Bases: pyffi.formats.nif.NiExtraData
Apparently commands for an optimizer instructing it to keep things it would normally discard.Also refers to NiNode objects (through their name) in animation .kf files.
Bases: pyffi.formats.nif.NiObject
List of 0x00-seperated strings, which are names of controlled objects and controller types. Used in .kf files in conjunction with NiControllerSequence.
Bases: pyffi.formats.nif.NiExtraData
List of strings; for example, a list of all bone names.
Bases: pyffi.formats.nif.NiNode
A node used to switch between branches, such as for LOD levels?
Bases: pyffi.formats.nif.NiExtraData
Extra data, used to name different animation sequences.
Bases: pyffi.formats.nif.NiObjectNET
A texture.
Bases: pyffi.formats.nif.NiDynamicEffect
Enables environment mapping. Should be in both the children list and effects list of the NiTriShape object. For Morrowind: the bump map can be used to bump the environment map (note that the bump map is ignored if no NiTextureEffect object is present).
Bases: pyffi.formats.nif.NiProperty
Unknown
Bases: pyffi.formats.nif.NiFloatInterpController
Texture transformation controller. The target texture slot should have “Has Texture Transform” enabled.
Bases: pyffi.formats.nif.NiProperty
Describes an object’s textures.
Bases: pyffi.formats.nif.NiObject
A generic time controller object.
Bases: pyffi.formats.nif.NiKeyframeController
NiTransformController replaces the NiKeyframeController.
Bases: pyffi.formats.nif.NiKeyframeData
Mesh animation keyframe data.
Bases: pyffi.formats.nif.NiProperty
Unknown
Bases: pyffi.formats.nif.NiTriBasedGeom
A shape node that refers to singular triangle data.
Bases: pyffi.formats.nif._NiTriShapeData
Example usage:
>>> from pyffi.formats.nif import NifFormat
>>> block = NifFormat.NiTriShapeData()
>>> block.set_triangles([(0,1,2),(2,1,3),(2,3,4)])
>>> block.get_strips()
[[0, 1, 2, 3, 4]]
>>> block.get_triangles()
[(0, 1, 2), (2, 1, 3), (2, 3, 4)]
>>> block.set_strips([[1,0,1,2,3,4]])
>>> block.get_strips()
[[4, 3, 2, 1, 0]]
>>> block.get_triangles()
[(0, 2, 1), (1, 2, 3), (2, 4, 3)]
Bases: pyffi.formats.nif.NiTimeController
Old version of skinning instance.
Bases: pyffi.formats.nif.NiTriBasedGeom
A shape node that refers to data organized into strips of triangles
Bases: pyffi.formats.nif._NiTriStripsData
Example usage:
>>> from pyffi.formats.nif import NifFormat
>>> block = NifFormat.NiTriStripsData()
>>> block.set_triangles([(0,1,2),(2,1,3),(2,3,4)])
>>> block.get_strips()
[[0, 1, 2, 3, 4]]
>>> block.get_triangles()
[(0, 1, 2), (1, 3, 2), (2, 3, 4)]
>>> block.set_strips([[1,0,1,2,3,4]])
>>> block.get_strips()
[[1, 0, 1, 2, 3, 4]]
>>> block.get_triangles()
[(0, 2, 1), (1, 2, 3), (2, 4, 3)]
Bases: pyffi.formats.nif.NiTimeController
Time controller for texture coordinates.
Bases: pyffi.formats.nif.NiObject
Texture coordinate data.
Bases: pyffi.formats.nif.NiExtraData
Extra vector data.
Bases: pyffi.formats.nif.NiExtraData
Not used in skinning.Unsure of use - perhaps for morphing animation or gravity.
Bases: pyffi.formats.nif.NiProperty
Property of vertex colors. This object is referred to by the root object of the NIF file whenever some NiTriShapeData object has vertex colors with non-default settings; if not present, vertex colors have vertex_mode=2 and lighting_mode=1.
Bases: pyffi.formats.nif.NiBoolInterpController
Time controller for visibility.
Bases: pyffi.formats.nif.NiObject
Visibility data for a controller.
Bases: pyffi.formats.nif.NiProperty
Unknown.
Bases: pyffi.formats.nif.NiProperty
This Property controls the Z buffer (OpenGL: depth buffer).
Bases: exceptions.Exception
Standard nif exception class.
Bases: pyffi.object_models.xml.struct_.StructBase
A group of NiNodes references.
Bases: pyffi.object_models.xml.struct_.StructBase
Oblivion’s ColFilter property for Havok.
Bases: pyffi.object_models.xml.enum.EnumBase
Sets mesh color in Oblivion Construction Set. Anything higher than 57 is also null.
Bases: pyffi.object_models.xml.struct_.StructBase
Havok Information for packed TriStrip shapes.
Bases: pyffi.object_models.xml.struct_.StructBase
Used to store skin weights in NiTriShapeSkinController.
Bases: pyffi.object_models.xml.struct_.StructBase
particle array entry
Bases: pyffi.object_models.xml.struct_.StructBase
Particle Description.
Bases: pyffi.object_models.xml.enum.EnumBase
Specifies the pixel format used by the NiPixelData object to store a texture.
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 32-bit integer, describing the color depth of a texture.
Bases: pyffi.object_models.xml.struct_.StructBase
Two dimensional screen elements.
Bases: pyffi.formats.nif.Ref
A weak reference to another block, used to point up the hierarchy tree. The reference is not returned by the L{get_refs} function to avoid infinite recursion.
Bases: pyffi.object_models.xml.struct_.StructBase
A special version of the key type used for quaternions. Never has tangents.
Bases: pyffi.object_models.xml.struct_.StructBase
A quaternion.
Bases: pyffi.object_models.xml.struct_.StructBase
A quaternion as it appears in the havok objects.
Bases: pyffi.object_models.xml.basic.BasicBase
Reference to another block.
Fix block links.
| Parameters: |
|
|---|
>>> from pyffi.formats.nif import NifFormat
>>> x = NifFormat.NiNode()
>>> y = NifFormat.NiNode()
>>> z = NifFormat.NiNode()
>>> x.add_child(y)
>>> x.children[0] is y
True
>>> x.children[0] is z
False
>>> x.replace_global_node(y, z)
>>> x.children[0] is y
False
>>> x.children[0] is z
True
>>> x.replace_global_node(z, None)
>>> x.children[0] is None
True
Write block reference.
| Parameter: | block_index_dct – The dictionary of block indices (block -> index). |
|---|
Bases: pyffi.object_models.xml.struct_.StructBase
A range of indices, which make up a region (such as a submesh).
Bases: pyffi.formats.nif.NiNode
Morrowind-specific node for collision mesh.
Bases: pyffi.object_models.xml.struct_.StructBase
Rotation key array.
Bases: pyffi.object_models.xml.struct_.StructBase
An extended texture description for shader textures.
Bases: pyffi.object_models.xml.basic.BasicBase
Another type for strings.
Bases: pyffi.object_models.xml.basic.BasicBase, pyffi.object_models.editable.EditableLineEdit
Basic type for strings. The type starts with an unsigned int which describes the length of the string.
>>> from tempfile import TemporaryFile
>>> f = TemporaryFile()
>>> s = SizedString()
>>> if f.write('\x07\x00\x00\x00abcdefg'.encode("ascii")): pass # ignore result for py3k
>>> if f.seek(0): pass # ignore result for py3k
>>> s.read(f)
>>> str(s)
'abcdefg'
>>> if f.seek(0): pass # ignore result for py3k
>>> s.set_value('Hi There')
>>> s.write(f)
>>> if f.seek(0): pass # ignore result for py3k
>>> m = SizedString()
>>> m.read(f)
>>> str(m)
'Hi There'
Return a hash value for this string.
| Returns: | An immutable object that can be used as a hash. |
|---|
Return number of bytes this type occupies in a file.
| Returns: | Number of bytes. |
|---|
Return the string.
| Returns: | The stored string. |
|---|
Read string from stream.
| Parameter: | stream (file) – The stream to read from. |
|---|
Set string to C{value}.
| Parameter: | value (str) – The value to assign. |
|---|
Write string to stream.
| Parameter: | stream (file) – The stream to write to. |
|---|
Bases: pyffi.object_models.xml.struct_.StructBase
Reference to shape and skin instance.
Bases: pyffi.object_models.xml.struct_.StructBase
Unknown.
Bases: pyffi.object_models.xml.struct_.StructBase
A weighted vertex.
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific node? Found in Fallout3
Bases: pyffi.object_models.xml.enum.EnumBase
A list of possible solver deactivation settings. This value defines how thesolver deactivates objects. The solver works on a per object basis.Note: Solver deactivation does not save CPU, but reduces creeping ofmovable objects in a pile quite dramatically.
Bases: pyffi.object_models.xml.struct_.StructBase
A sphere.
Bases: pyffi.object_models.xml.enum.EnumBase
This enum defines the various actions used in conjunction with the stencil buffer.For a detailed description of the individual options please refer to the OpenGL docs.
Bases: pyffi.object_models.xml.enum.EnumBase
This enum contains the options for doing stencil buffer tests.
Bases: pyffi.object_models.common.Int
This is just an integer with -1 as default value.
Bases: pyffi.object_models.xml.enum.EnumBase
Determines symetry type used by NiPSysBombModifier.
Bases: pyffi.object_models.xml.enum.EnumBase
Specifies the time when an application must syncronize for some reason.
Bases: pyffi.object_models.xml.struct_.StructBase
Tension, bias, continuity.
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific node.
Bases: pyffi.object_models.xml.enum.EnumBase
Used by NiPoint3InterpControllers to select which type of color in the controlled object that will be animated.
Bases: pyffi.object_models.xml.enum.EnumBase
Specifies the availiable texture clamp modes. That is, the behavior of pixels outside the range of the texture.
Bases: pyffi.object_models.xml.struct_.StructBase
Texture description.
Bases: pyffi.object_models.xml.enum.EnumBase
Specifies the availiable texture filter modes. That is, the way pixels within a texture are blended together when textures are displayed on the screen at a size other than their original dimentions.
Bases: pyffi.object_models.xml.struct_.StructBase
A texture source.
Bases: pyffi.object_models.xml.enum.EnumBase
Determines how a NiTextureTransformController animates the UV coordinates.
Bases: pyffi.object_models.xml.enum.EnumBase
The type of texture.
Bases: pyffi.formats.nif.BSShaderLightingProperty
Bethesda-specific node.
Bases: pyffi.object_models.xml.struct_.StructBase
List of three vertex indices.
Bases: pyffi.formats.nif._Vector4
>>> from pyffi.formats.nif import NifFormat
>>> vec = NifFormat.Vector4()
>>> vec.x = 1.0
>>> vec.y = 2.0
>>> vec.z = 3.0
>>> vec.w = 4.0
>>> print(vec)
[ 1.000 2.000 3.000 4.000 ]
>>> vec.as_list()
[1.0, 2.0, 3.0, 4.0]
>>> vec.as_tuple()
(1.0, 2.0, 3.0, 4.0)
>>> print(vec.get_vector_3())
[ 1.000 2.000 3.000 ]
>>> vec2 = NifFormat.Vector4()
>>> vec == vec2
False
>>> vec2.x = 1.0
>>> vec2.y = 2.0
>>> vec2.z = 3.0
>>> vec2.w = 4.0
>>> vec == vec2
True
Bases: pyffi.object_models.xml.enum.EnumBase
Controls the way the a particle mesh emitter determines the starting speed and direction of the particles that are emitted.
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 32-bit integer, which describes how to apply vertex colors.
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific node.
Bases: pyffi.formats.nif.BSShaderProperty
Bethesda-specific node? Found in Fallout3
Bases: pyffi.object_models.xml.enum.EnumBase
This enum contains the options for doing z buffer tests.
Bases: pyffi.formats.nif.bhkShapePhantom
Bethesda-specific node.
Bases: pyffi.formats.nif.bhkCollisionObject
Unknown.
Bases: pyffi.formats.nif.NiTimeController
Unknown. Is apparently only used in skeleton.nif files.
Bases: pyffi.formats.nif.bhkConstraint
Bethesda-Specific node.
Bases: pyffi.formats.nif.bhkShape
A tree-like Havok data structure stored in an assembly-like binary code?
Bases: pyffi.formats.nif.bhkNiCollisionObject
Havok related collision object?
Bases: pyffi.formats.nif.bhkShape
A havok shape.A list of shapes.Do not put a bhkPackedNiTriStripsShape in the Sub Shapes. Use aseparate collision nodes without a list shape for those.Also, shapes collected in a bhkListShape may not have the correctwalking noise, so only use it for non-walkable objects.
Bases: pyffi.formats.nif.bhkSphereRepShape
A havok shape.
Bases: pyffi.formats.nif.bhkTransformShape
A convex transformed shape?
Bases: pyffi.formats.nif.bhkWorldObject
A havok node, describes physical properties.
Bases: pyffi.formats.nif.bhkConstraint
A hinge constraint.
Bases: pyffi.formats.nif.bhkSerializable
Bethesda-specific node.
Bases: pyffi.formats.nif.NiCollisionObject
Havok related collision object?
Bases: pyffi.formats.nif.bhkSerializable
Bethesda-Specific node.
Bases: pyffi.formats.nif.bhkNiCollisionObject
Unknown.
Bases: pyffi.formats.nif.bhkWorldObject
Havok object that do not react with other objects when they collide (causing deflection, etc.) but still trigger collision notifications to the game. Possible uses are traps, portals, AI fields, etc.
Bases: pyffi.formats.nif.bhkConstraint
A prismatic constraint.
Bases: pyffi.formats.nif.NiObject
The base type of most Bethesda-specific Havok-related NIF objects.
Bases: pyffi.formats.nif.bhkRigidBody
Unknown.
Bases: pyffi.formats.nif.bhkPCollisionObject
Unknown.
Bases: pyffi.formats.nif.bhkRefObject
Havok objects that can be saved and loaded from disk?
Bases: pyffi.formats.nif.bhkSerializable
A Havok Shape?
Bases: pyffi.formats.nif.bhkShape
Havok collision object that uses multiple shapes?
Bases: pyffi.formats.nif.bhkPhantom
A Havok phantom that uses a Havok shape object for its collision volume instead of just a bounding box.
Bases: pyffi.formats.nif.bhkShapePhantom
Unknown shape.
Bases: pyffi.formats.nif.bhkShape
A havok shape, perhaps with a bounding sphere for quick rejection in addition to more detailed shape data?
Bases: pyffi.formats.nif.bhkConstraint
A spring constraint.
Bases: pyffi.formats.nif.bhkSerializable
Havok objects that have a position in the world?
Bases: pyffi.object_models.xml.basic.BasicBase, pyffi.object_models.editable.EditableBoolComboBox
Basic implementation of a 32-bit (8-bit for versions > 4.0.0.2) boolean type.
>>> i = NifFormat.bool()
>>> i.set_value('false')
>>> i.get_value()
False
>>> i.set_value('true')
>>> i.get_value()
True
Bases: pyffi.object_models.xml.struct_.StructBase
A triangle with extra data used for physics.
Converts version string into an integer.
| Parameter: | version_str (str) – The version string. |
|---|---|
| Returns: | A version integer. |
>>> hex(NifFormat.versionNumber('3.14.15.29'))
'0x30e0f1d'
>>> hex(NifFormat.versionNumber('1.2'))
'0x1020000'
>>> hex(NifFormat.versionNumber('3.03'))
'0x3000300'
>>> hex(NifFormat.versionNumber('NS'))
'0xa010000'
These tests are used to check for functionality and bugs in the library. They also provide code examples which you may find useful.
>>> stream = open('tests/nif/test.nif', 'rb')
>>> data = NifFormat.Data()
>>> # inspect is optional; it will not read the actual blocks
>>> data.inspect(stream)
>>> hex(data.version)
'0x14010003'
>>> data.user_version
0
>>> for blocktype in data.header.block_types:
... print(blocktype.decode("ascii"))
NiNode
NiTriShape
NiTriShapeData
>>> data.roots # blocks have not been read yet, so this is an empty list
[]
>>> data.read(stream)
>>> for root in data.roots:
... for block in root.tree():
... if isinstance(block, NifFormat.NiNode):
... print(block.name.decode("ascii"))
test
>>> stream.close()
>>> for stream, data in NifFormat.walkData('tests/nif'):
... try:
... # the replace call makes the doctest also pass on windows
... print("reading %s" % stream.name.replace("\\", "/"))
... data.read(stream)
... except Exception:
... print("Warning: read failed due corrupt file, corrupt format description, or bug.")
reading tests/nif/invalid.nif
Warning: read failed due corrupt file, corrupt format description, or bug.
reading tests/nif/test.nif
reading tests/nif/test_centerradius.nif
reading tests/nif/test_check_tangentspace1.nif
reading tests/nif/test_check_tangentspace2.nif
reading tests/nif/test_check_tangentspace3.nif
reading tests/nif/test_check_tangentspace4.nif
reading tests/nif/test_convexverticesshape.nif
reading tests/nif/test_dump_tex.nif
reading tests/nif/test_fix_clampmaterialalpha.nif
reading tests/nif/test_fix_detachhavoktristripsdata.nif
reading tests/nif/test_fix_disableparallax.nif
reading tests/nif/test_fix_ffvt3rskinpartition.nif
reading tests/nif/test_fix_mergeskeletonroots.nif
reading tests/nif/test_fix_tangentspace.nif
reading tests/nif/test_fix_texturepath.nif
reading tests/nif/test_mopp.nif
reading tests/nif/test_opt_dupgeomdata.nif
reading tests/nif/test_opt_dupverts.nif
reading tests/nif/test_opt_emptyproperties.nif
reading tests/nif/test_opt_mergeduplicates.nif
reading tests/nif/test_skincenterradius.nif
>>> root = NifFormat.NiNode()
>>> root.name = 'Scene Root'
>>> blk = NifFormat.NiNode()
>>> root.add_child(blk)
>>> blk.name = 'new block'
>>> blk.scale = 2.4
>>> blk.translation.x = 3.9
>>> blk.rotation.m_11 = 1.0
>>> blk.rotation.m_22 = 1.0
>>> blk.rotation.m_33 = 1.0
>>> ctrl = NifFormat.NiVisController()
>>> ctrl.flags = 0x000c
>>> ctrl.target = blk
>>> blk.add_controller(ctrl)
>>> blk.add_controller(NifFormat.NiAlphaController())
>>> strips = NifFormat.NiTriStrips()
>>> root.add_child(strips, front = True)
>>> strips.name = "hello world"
>>> strips.rotation.m_11 = 1.0
>>> strips.rotation.m_22 = 1.0
>>> strips.rotation.m_33 = 1.0
>>> data = NifFormat.NiTriStripsData()
>>> strips.data = data
>>> data.num_vertices = 5
>>> data.has_vertices = True
>>> data.vertices.update_size()
>>> for i, v in enumerate(data.vertices):
... v.x = 1.0+i/10.0
... v.y = 0.2+1.0/(i+1)
... v.z = 0.03
>>> data.update_center_radius()
>>> data.num_strips = 2
>>> data.strip_lengths.update_size()
>>> data.strip_lengths[0] = 3
>>> data.strip_lengths[1] = 4
>>> data.has_points = True
>>> data.points.update_size()
>>> data.points[0][0] = 0
>>> data.points[0][1] = 1
>>> data.points[0][2] = 2
>>> data.points[1][0] = 1
>>> data.points[1][1] = 2
>>> data.points[1][2] = 3
>>> data.points[1][3] = 4
>>> data.num_uv_sets = 1
>>> data.has_uv = True
>>> data.uv_sets.update_size()
>>> for i, v in enumerate(data.uv_sets[0]):
... v.u = 1.0-i/10.0
... v.v = 1.0/(i+1)
>>> data.has_normals = True
>>> data.normals.update_size()
>>> for i, v in enumerate(data.normals):
... v.x = 0.0
... v.y = 0.0
... v.z = 1.0
>>> strips.update_tangent_space()
>>> from tempfile import TemporaryFile
>>> stream = TemporaryFile()
>>> nifdata = NifFormat.Data(version=0x14010003, user_version=10)
>>> nifdata.roots = [root]
>>> nifdata.write(stream)
>>> stream.close()
>>> for vnum in sorted(NifFormat.versions.values()):
... print('0x%08X' % vnum) # doctest: +REPORT_UDIFF
0x02030000
0x03000000
0x03000300
0x03010000
0x0303000D
0x04000000
0x04000002
0x0401000C
0x04020002
0x04020100
0x04020200
0x0A000100
0x0A000102
0x0A000103
0x0A010000
0x0A010065
0x0A01006A
0x0A020000
0x0A020001
0x0A040001
0x14000004
0x14000005
0x14010003
0x14020007
0x14020008
0x14030001
0x14030002
0x14030003
0x14030006
0x14030009
0x14050000
0x14060000
0x1E000002
>>> for game, versions in sorted(NifFormat.games.items(), key=lambda x: x[0]):
... print("%s " % game + " ".join('0x%08X' % vnum for vnum in versions)) # doctest: +REPORT_UDIFF
? 0x0A000103
Atlantica 0x14020008
Axis and Allies 0x0A010000
Civilization IV 0x04020002 0x04020100 0x04020200 0x0A000100 0x0A010000 0x0A020000 0x14000004
Culpa Innata 0x04020200
Dark Age of Camelot 0x02030000 0x03000300 0x03010000 0x0401000C 0x04020100 0x04020200 0x0A010000
Divinity 2 0x14030009
Emerge 0x14020007 0x14020008 0x14030001 0x14030002 0x14030003 0x14030006 0x1E000002
Empire Earth II 0x04020200
Empire Earth III 0x14020007 0x14020008
Entropia Universe 0x0A010000
Fallout 3 0x14020007
Freedom Force 0x04000000 0x04000002
Freedom Force vs. the 3rd Reich 0x0A010000
Kohan 2 0x0A010000
KrazyRain 0x14050000 0x14060000
Lazeska 0x14030009
Loki 0x0A020000
Megami Tensei: Imagine 0x14010003
Morrowind 0x04000002
NeoSteam 0x0A010000
Oblivion 0x0303000D 0x0A000102 0x0A010065 0x0A01006A 0x0A020000 0x14000004 0x14000005
Prison Tycoon 0x0A020000
Pro Cycling Manager 0x0A020000
Red Ocean 0x0A020000
Sid Meier's Railroads 0x14000004
Star Trek: Bridge Commander 0x03000000 0x03010000
The Guild 2 0x0A010000
Warhammer 0x14030009
Wildlife Park 2 0x0A010000 0x0A020000
Worldshift 0x0A020001 0x0A040001
Zoo Tycoon 2 0x0A000100
>>> stream = open('tests/nif/invalid.nif', 'rb')
>>> data = NifFormat.Data()
>>> data.inspect(stream) # the file seems ok on inspection
>>> data.read(stream) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
ValueError: ...
>>> stream.close()
>>> block = NifFormat.NiTextKeyExtraData()
>>> block.num_text_keys = 1
>>> block.text_keys.update_size()
>>> block.text_keys[0].time = 1.0
>>> block.text_keys[0].value = 'hi'
>>> NifFormat.NiNode._has_links
True
>>> NifFormat.NiBone._has_links
True
>>> skelroot = NifFormat.NiNode()
>>> geom = NifFormat.NiTriShape()
>>> geom.skin_instance = NifFormat.NiSkinInstance()
>>> geom.skin_instance.skeleton_root = skelroot
>>> [block.__class__.__name__ for block in geom.get_refs()]
['NiSkinInstance']
>>> [block.__class__.__name__ for block in geom.get_links()]
['NiSkinInstance']
>>> [block.__class__.__name__ for block in geom.skin_instance.get_refs()]
[]
>>> [block.__class__.__name__ for block in geom.skin_instance.get_links()]
['NiNode']
>>> extra = NifFormat.NiTextKeyExtraData()
>>> extra.num_text_keys = 2
>>> extra.text_keys.update_size()
>>> extra.text_keys[0].time = 0.0
>>> extra.text_keys[0].value = "start"
>>> extra.text_keys[1].time = 2.0
>>> extra.text_keys[1].value = "end"
>>> for extrastr in extra.get_strings():
... print(extrastr.decode("ascii"))
start
end