pyffi.formats.nif — NetImmerse/Gamebryo (.nif and .kf)

Implementation

class pyffi.formats.nif.NifFormat

Bases: pyffi.object_models.xml.FileFormat

This class contains the generated classes from the xml.

class AVObject(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Used in NiDefaultAVObjectPalette.

av_object

Object reference.

name

Object name.

class NifFormat.AlphaFormat(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

An unsigned 32-bit integer, describing how transparency is handled in a texture.

class NifFormat.ApplyMode(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

An unsigned 32-bit integer, describing the apply mode of a texture.

class NifFormat.ArkTexture(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A texture reference used by NiArkTextureExtraData.

class NifFormat.AvoidNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Morrowind specific?

class NifFormat.BSAnimNotes(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Bethesda-specific node.

unknown_short_1

Unknown

class NifFormat.BSBlastNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-Specific node.

unknown_byte_1

Unknown

unknown_short_2

Unknown

class NifFormat.BSDamageStage(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-Specific node.

unknown_byte_1

Unknown

unknown_short_2

Unknown

class NifFormat.BSDebrisNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-Specific node.

unknown_byte_1

Unknown

unknown_short_2

Unknown

class NifFormat.BSDecalPlacementVectorExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Bethesda-specific node. (for dynamic decal projection?)

num_vector_blocks

Number of groups

unknown_float_1

Unknown

vector_blocks

Number of Blocks

class NifFormat.BSDistantTreeShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific node.

class NifFormat.BSFadeNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-specific fade node.

class NifFormat.BSFrustumFOVController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Bethesda-specific node.

interpolator

Frustrum field of view animation interpolater and data.

class NifFormat.BSFurnitureMarker(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown. Marks furniture sitting positions?

num_positions

Number of positions.

positions

Unknown. Probably has something to do with the furniture positions?

class NifFormat.BSKeyframeController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiKeyframeController

An extended keyframe controller.

data_2

A link to more keyframe data.

class NifFormat.BSMasterParticleSystem(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-Specific node.

max_emitter_objects

Unknown

num_particle_systems

Unknown

particle_systems

Unknown

class NifFormat.BSMaterialEmittanceMultController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiFloatInterpController

Bethesda-Specific node.

class NifFormat.BSMultiBound(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Bethesda-specific node.

data

Unknown.

class NifFormat.BSMultiBoundAABB(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSMultiBoundData

Bethesda-specific node.

unknown_floats_1

Unknown

class NifFormat.BSMultiBoundData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Abstract base type for bounding data.

class NifFormat.BSMultiBoundNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-specific node.

multi_bound

Unknown.

class NifFormat.BSMultiBoundSphere(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSMultiBoundData

Bethesda-specific node.

radius

Radius

unknown_int_1

Unknown Flag

unknown_int_2

Unknown Flag

unknown_int_3

Unknown Flag

class NifFormat.BSOrderedNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-Specific node.

alpha_sort_bound

Unknown

is_static_bound

Unknown

class NifFormat.BSPSysArrayEmitter(template=None, argument=None, parent=None)

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.

class NifFormat.BSPSysMultiTargetEmitterCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierCtlr

Particle system (multi?) emitter controller.

data

This controller’s data

unknown_int_1

Unknown

unknown_short_1

Unknown

visibility_interpolator

Links to a bool interpolator. Controls emitter’s visibility status?

class NifFormat.BSPSysSimpleColorModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Bethesda-Specific Particle node.

color_1_end_percent

Unknown

color_1_start_percent

Unknown

color_2_end_percent

Unknown

color_2_start_percent

Unknown

colors

Colors

fade_in_percent

Unknown

fade_out_percent

Unknown

class NifFormat.BSPSysStripUpdateModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Bethesda-Specific (mesh?) Particle System Modifier.

update_delta_time

Unknown

class NifFormat.BSParentVelocityModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Particle modifier that adds a blend of object space translation and rotation to particles born in world space.

damping

Amount of blending?

class NifFormat.BSRefractionFirePeriodController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Bethesda-specific node.

interpolator

Link to Interpolator.

class NifFormat.BSRefractionStrengthController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiFloatInterpController

Bethesda-Specific node.

class NifFormat.BSSegmentedTriShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriShape

Bethesda-specific node.

num_seg_triangles

Unknown

seg_triangles

Unknown

class NifFormat.BSSegmentedTriangle(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Bethesda-specific node.

unknown_byte_1

Unknown

unknown_int_1

Unknown

unknown_int_2

Unknown

class NifFormat.BSShaderLightingProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific property.

unknown_int_3

Unknown

class NifFormat.BSShaderNoLightingProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderLightingProperty

Bethesda-specific property.

file_name

The texture glow map.

unknown_float_2

Unknown

unknown_float_3

Normally what appears to be a junk value (0xB33BBD2E). Appears to be related to glow when Unk Flags is (0x82000148).

unknown_float_4

Unknown

unknown_float_5

Unknown

class NifFormat.BSShaderPPLightingProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderLightingProperty

Bethesda-specific Shade node.

refraction_period

Rate of texture movement for refraction shader.

texture_set

Texture Set

unknown_float_2

Unknown

unknown_float_4

Unknown

unknown_float_5

Unknown

class NifFormat.BSShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Bethesda-specific Property node

envmap_scale

Unknown

flags

Unknown

shader_flags

Shader Property Flags

shader_type

Unknown (Set to 0x21 for NoLighting, 0x11 for Water)

unknown_int_2

Unknown

class NifFormat.BSShaderTextureSet(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Bethesda-specific Texture Set.

num_textures

Number of Textures

textures

Textures.0: Diffuse1: Normal/Gloss2: Glow/Skin/Hair3: Height/Parallax4: Environment5: Environment Mask

class NifFormat.BSShaderType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The type of animation interpolation (blending) that will be used on the associated key frames.

class NifFormat.BSStripPSysData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysData

Bethesda-Specific (mesh?) Particle System Data.

unknown_byte_1

Unknown

unknown_int_2

Unknown

unknown_int_3

Unknown

unknown_short_3

Unknown

class NifFormat.BSStripParticleSystem(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleSystem

Bethesda-Specific (mesh?) Particle System.

class NifFormat.BSTreadTransfInfo(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Bethesda-specific node.

data

Data

unknown_float_1

Unknown Flag

class NifFormat.BSTreadTransfInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpolator

Bethesda-specific node.

num_transfers

Unknown

tread_transfer_info

Unknown

unknown_int_1

Unknown

class NifFormat.BSTreadTransfSubInfo(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Bethesda-specific node.

unknown_int_1

Unknown

unknown_int_2

Unknown

unknown_int_3

Unknown

unknown_int_4

Unknown

unknown_int_5

Unknown

unknown_int_6

Unknown

unknown_int_7

Unknown

unknown_int_8

Unknown

class NifFormat.BSValueNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-Specific node. Found on fxFire effects

unknown_byte

Unknown

value

Value

class NifFormat.BSWArray(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Bethesda-specific node.

items

Unknown

num_items

Unknown

class NifFormat.BSWindModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Particle Modifier that uses the wind value from the gamedata to alter the path of particles.

strength

The amount of force wind will have on particles.

class NifFormat.BSXFlags(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiIntegerExtraData

Controls animation and collision. Integer holds flags:Bit 0 : enable havokBit 1 : enable collisionBit 2 : is skeleton nif?Bit 3 : enable animationBit 4 : FlameNodes presentBit 5 : EditorMarkers present

class NifFormat.BillboardMode(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Determines the way the billboard will react to the camera.

NifFormat.BlockTypeIndex

alias of UShort

class NifFormat.BodyPartList(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Body part list for DismemberSkinInstance

body_part

Body Part Index

part_flag

Flags related to the Body Partition

class NifFormat.BoundingBox(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Bounding box.

radius

Radius, per direction.

rotation

Rotation matrix.

translation

Translation vector.

unknown_int

Usually 1.

class NifFormat.BoxBV(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Box Bounding Volume

axis

Axis

center

Center

extent

Extent

class NifFormat.ByteArray(**kwargs)

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__.

class NifFormat.ByteColor3(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A color without alpha (red, green, blue).

b

Blue color component.

g

Green color component.

r

Red color component.

class NifFormat.ByteColor4(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A color with alpha (red, green, blue, alpha).

a

Alpha color component.

b

Blue color component.

g

Green color component.

r

Red color component.

class NifFormat.ByteMatrix(**kwargs)

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__.

class NifFormat.CapsuleBV(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Capsule Bounding Volume

center

Center

origin

Origin

unknown_float_1

Unknown.

unknown_float_2

Unknown.

class NifFormat.ChannelData(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Channel data

bits_per_channel

Bits per channel

convention

Data Storage Convention

type

Channel Type

unknown_byte_1

Unknown

class NifFormat.CloningBehavior(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Sets how objects are to be cloned.

class NifFormat.Color3(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A color without alpha (red, green, blue).

b

Blue color component.

g

Green color component.

r

Red color component.

class NifFormat.Color4(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A color with alpha (red, green, blue, alpha).

a

Alpha.

b

Blue component.

g

Green component.

r

Red component.

class NifFormat.ComponentFormat(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The data format of components.

class NifFormat.ConsistencyType(**kwargs)

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'
get_node_name()

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'
class NifFormat.CoordGenType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Determines the way that UV texture coordinates are generated.

class NifFormat.CycleType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The animation cyle behavior.

class NifFormat.Data(version=67108866, user_version=0, user_version2=0)

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}.

Variables:
  • version – The nif version.
  • user_version – The nif user version.
  • user_version2 – The nif user version 2.
  • roots – List of root blocks.
  • header – The nif header.
  • blocks – List of blocks.
  • modification – Neo Steam (“neosteam”) or Ndoors (“ndoors”) or Joymaster Interactive Howling Sword (“jmihs1”) or Laxe Lore (“laxelore”) style nif?
inspect(stream)

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.

Parameters:stream (file) – The file to inspect.
inspect_version_only(stream)

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.
Parameters:stream (file) – The stream from which to read.
read(stream)

Read a nif file. Does not reset stream position.

Parameters:stream (file) – The stream from which to read.
write(stream)

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:stream (file) – The stream to which to write.
class NifFormat.DataStreamUsage(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Determines how a data stream is used?

class NifFormat.DecalVectorArray(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Array of Vectors for Decal placement in BSDecalPlacementVectorExtraData.

normals

Vector Normals

num_vectors

Number of sets

points

Vector XYZ coords

class NifFormat.DecayType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Determines decay function. Used by NiPSysBombModifier.

class NifFormat.DistantLODShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific node.

class NifFormat.EffectType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The type of information that’s store in a texture used by a NiTextureEffect.

class NifFormat.EmitFrom(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Controls which parts of the mesh that the particles are emitted from.

class NifFormat.FaceDrawMode(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

This enum lists the different face culling options.

class NifFormat.FieldType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The force field’s type.

class NifFormat.FilePath(**kwargs)

Bases: pyffi.formats.nif.string

A file path.

get_hash(data=None)

Returns a case insensitive hash value.

class NifFormat.ForceType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The type of force? May be more valid values.

class NifFormat.FurniturePosition(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Describes a furniture position?

offset

Offset of furniture marker.

orientation

Furniture marker orientation.

position_ref_1

Refers to a furnituremarkerxx.nif file. Always seems to be the same as Position Ref 2.

position_ref_2

Refers to a furnituremarkerxx.nif file. Always seems to be the same as Position Ref 1.

class NifFormat.FxButton(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.FxWidget

Unknown.

class NifFormat.FxRadioButton(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.FxWidget

Unknown.

buttons

Unknown pointers to other buttons. Maybe other buttons in a group so they can be switch off if this one is switched on?

num_buttons

Number of unknown links.

unknown_int_1

Unknown.

unknown_int_2

Unknown.

unknown_int_3

Unknown.

class NifFormat.FxWidget(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Firaxis-specific UI widgets?

unknown_292_bytes

Looks like 9 links and some string data.

unknown_3

Unknown.

class NifFormat.HairShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific node.

class NifFormat.HavokMaterial(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

A material, used by havok shape objects.

class NifFormat.ImageType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Determines how the raw image data is stored in NiRawImageData.

class NifFormat.Key(template=None, argument=None, parent=None)

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.

backward

The key backward tangent.

forward

Key forward tangent.

tbc

The key’s TBC.

time

Time of the key.

value

The key value.

class NifFormat.KeyGroup(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Array of vector keys (anything that can be interpolated, except rotations).

interpolation

The key type.

keys

The keys.

num_keys

Number of keys in the array.

class NifFormat.KeyType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The type of animation interpolation (blending) that will be used on the associated key frames.

class NifFormat.LODRange(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

The distance range where a specific level of detail applies.

far_extent

End of Range.

near_extent

Begining of range.

unknown_ints

Unknown (0,0,0).

class NifFormat.LightMode(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

An unsigned 32-bit integer, describing how vertex colors influence lighting.

class NifFormat.Lighting30ShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderPPLightingProperty

Bethesda-specific node.

class NifFormat.LineString(**kwargs)

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'
class NifFormat.MatchGroup(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Group of vertex indices of vertices that match.

num_vertices

Number of vertices in this group.

vertex_indices

The vertex indices.

class NifFormat.MaterialData(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Data stored per-material by NiRenderObject

material_extra_data

Extra data associated with the material?

material_name

The name of the material.

class NifFormat.Matrix22(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A 2x2 matrix of float values. Stored in OpenGL column-major format.

m_11

Member 1,1 (top left)

m_12

Member 1,2 (top right)

m_21

Member 2,1 (bottom left)

m_22

Member 2,2 (bottom right)

class NifFormat.MeshPrimitiveType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Describes the type of primitives stored in a mesh object.

class NifFormat.MipMap(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Description of a MipMap within a NiPixelData object.

height

Height of the mipmap image.

offset

Offset into the pixel data array where this mipmap starts.

width

Width of the mipmap image.

class NifFormat.MipMapFormat(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

An unsigned 32-bit integer, describing how mipmaps are handled in a texture.

class NifFormat.Morph(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Geometry morphing data component.

frame_name

Name of the frame.

interpolation

Unlike most objects, the presense of this value is not conditional on there being keys.

keys

The morph key frames.

num_keys

The number of morph keys that follow.

unknown_int

Unknown.

vectors

Morph vectors.

class NifFormat.MotionQuality(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The motion type. Determines quality of motion?

class NifFormat.MotionSystem(**kwargs)

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.

class NifFormat.Ni3dsAlphaAnimator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown.

num_1

Unknown.

num_2

Unknown.

parent

The parent?

unknown_1

Unknown.

unknown_2

Unknown.

class NifFormat.Ni3dsAnimationNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown. Only found in 2.3 nifs.

child

Child?

count

A count.

has_data

Unknown.

name

Name of this object.

unknown_array

Unknown.

unknown_floats_1

Unknown. Matrix?

unknown_floats_2

Unknown.

unknown_short

Unknown.

class NifFormat.Ni3dsColorAnimator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown!

unknown_1

Unknown.

class NifFormat.Ni3dsMorphShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown!

unknown_1

Unknown.

class NifFormat.Ni3dsParticleSystem(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown!

unknown_1

Unknown.

class NifFormat.Ni3dsPathController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown!

unknown_1

Unknown.

class NifFormat.NiAVObject(template=None, argument=None, parent=None)

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_property(prop)

Add the given property to the property list.

Parameters:prop (L{NifFormat.NiProperty}) – The property block to add.
apply_scale(scale)

Apply scale factor on data.

Parameters:scale – The scale factor.
get_properties()

Return a list of the properties of the block.

Returns:The list of properties.
Return type:list of L{NifFormat.NiProperty}
get_transform(relative_to=None)

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.

Parameters:relative_to – The block relative to which the transform must be calculated. If None, the local transform is returned.
remove_property(prop)

Remove the given property to the property list.

Parameters:prop (L{NifFormat.NiProperty}) – The property block to remove.
set_properties(proplist)

Set the list of properties from the given list (destroys existing list).

Parameters:proplist (list of L{NifFormat.NiProperty}) – The list of property blocks to set.
set_transform(m)

Set rotation, translation, and scale, from a 4x4 matrix.

Parameters:m – The matrix to which the transform should be set.
class NifFormat.NiAVObjectPalette(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown.

class NifFormat.NiAlphaController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiFloatInterpController

Time controller for transparency.

data

Alpha controller data index.

class NifFormat.NiAlphaProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Transparency. Flags 0x00ED.

flags

Bit 0 : alpha blending enableBits 1-4 : source blend modeBits 5-8 : destination blend modeBit 9 : alpha test enableBit 10-12 : alpha test modeBit 13 : no sorter flag ( disables triangle sorting )blend modes (glBlendFunc):0000 GL_ONE0001 GL_ZERO0010 GL_SRC_COLOR0011 GL_ONE_MINUS_SRC_COLOR0100 GL_DST_COLOR0101 GL_ONE_MINUS_DST_COLOR0110 GL_SRC_ALPHA0111 GL_ONE_MINUS_SRC_ALPHA1000 GL_DST_ALPHA1001 GL_ONE_MINUS_DST_ALPHA1010 GL_SRC_ALPHA_SATURATEtest modes (glAlphaFunc):000 GL_ALWAYS001 GL_LESS010 GL_EQUAL011 GL_LEQUAL100 GL_GREATER101 GL_NOTEQUAL110 GL_GEQUAL111 GL_NEVER

threshold

Threshold for alpha testing (see: glAlphaFunc)

unknown_int_2

Unknown

unknown_short_1

Unknown

class NifFormat.NiAmbientLight(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiLight

Ambient light source.

class NifFormat.NiArkAnimationExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown node.

class NifFormat.NiArkImporterExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown node.

importer_name

Contains a string like”Gamebryo_1_1”or”4.1.0.12”

class NifFormat.NiArkShaderExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown node.

class NifFormat.NiArkTextureExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown node.

class NifFormat.NiArkViewportInfoExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown node.

class NifFormat.NiAutoNormalParticles(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticles

Unknown.

class NifFormat.NiAutoNormalParticlesData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticlesData

Particle system data object (with automatic normals?).

class NifFormat.NiBSAnimationNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Bethesda-specific extension of Node with animation properties stored in the flags, often 42?

class NifFormat.NiBSBoneLODController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBoneLODController

A simple LOD controller for bones.

class NifFormat.NiBSPArrayController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleSystemController

A particle system controller, used by BS in conjunction with NiBSParticleNode.

class NifFormat.NiBSParticleNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Unknown.

class NifFormat.NiBSplineBasisData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Stores the number of control points of a B-spline.

num_control_points

The number of control points of the B-spline (number of frames of animation plus degree of B-spline minus one).

class NifFormat.NiBSplineCompFloatInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBSplineFloatInterpolator

Unknown.

base

Base value when curve not defined.

bias

Bias

multiplier

Multiplier

offset

Starting offset for the data. (USHRT_MAX for no data.)

class NifFormat.NiBSplineCompPoint3Interpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBSplinePoint3Interpolator

Unknown.

class NifFormat.NiBSplineData(template=None, argument=None, parent=None)

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)) 
[(1.0, 2.00...), (4.0, 2.99...)]
append_comp_data(data)

Append data as compressed list.

Parameters: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_float_data(data)

Append data.

Parameters: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_short_data(data)

Append data.

Parameters: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_comp_data(offset, num_elements, element_size, bias, multiplier)

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:
  • offset – The offset in the data where to start.
  • num_elements – Number of elements to get.
  • element_size – Size of a single element.
  • bias – Value bias.
  • multiplier – Value multiplier.
Returns:

A list of C{num_elements} tuples of size C{element_size}.

get_float_data(offset, num_elements, element_size)

Get an iterator to the data.

Parameters:
  • offset – The offset in the data where to start.
  • num_elements – Number of elements to get.
  • element_size – Size of a single element.
Returns:

A list of C{num_elements} tuples of size C{element_size}.

get_short_data(offset, num_elements, element_size)

Get an iterator to the data.

Parameters:
  • offset – The offset in the data where to start.
  • num_elements – Number of elements to get.
  • element_size – Size of a single element.
Returns:

A list of C{num_elements} tuples of size C{element_size}.

class NifFormat.NiBSplineFloatInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBSplineInterpolator

Unknown.

class NifFormat.NiBSplinePoint3Interpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBSplineInterpolator

Unknown.

unknown_floats

Unknown.

class NifFormat.NiBezierMesh(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiAVObject

Unknown

bezier_triangle

unknown

count_1

Data count.

count_2

data count 2.

data_2

data count.

num_bezier_triangles

references.

points_1

data.

points_2

data.

unknown_3

Unknown.

unknown_4

Unknown.

unknown_5

Unknown (illegal link?).

unknown_6

unknown

class NifFormat.NiBezierTriangle4(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Sub data of NiBezierMesh

matrix

unknown

unknown_1

unknown

unknown_2

unknown

unknown_3

unknown

unknown_4

unknown

unknown_5

unknown

unknown_6

unknown

vector_1

unknown

vector_2

unknown

class NifFormat.NiBillboardNode(template=None, argument=None, parent=None)

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

billboard_mode

The way the billboard will react to the camera.

class NifFormat.NiBinaryExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Binary extra data object. Used to store normals and binormals in Oblivion.

binary_data

The binary data.

class NifFormat.NiBinaryVoxelData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Voxel data object.

num_unknown_bytes_2

Unknown.

num_unknown_vectors

Unknown.

unknown_5_ints

Unknown.

unknown_7_floats

Unknown.

unknown_bytes_1

Unknown. Always a multiple of 7.

unknown_bytes_2

Unknown.

unknown_short_1

Unknown.

unknown_short_2

Unknown.

unknown_short_3

Unknown. Is this^3 the Unknown Bytes 1 size?

unknown_vectors

Vectors on the unit sphere.

class NifFormat.NiBinaryVoxelExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Voxel extra data object.

data

Link to binary voxel data.

unknown_int

Unknown. 0?

class NifFormat.NiBlendBoolInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBlendInterpolator

An interpolator for a bool.

bool_value

The interpolated bool?

class NifFormat.NiBlendFloatInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBlendInterpolator

An interpolator for a float.

float_value

The interpolated float?

class NifFormat.NiBlendInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpolator

An extended type of interpolater.

unknown_int

Unknown.

unknown_short

Unknown.

class NifFormat.NiBlendPoint3Interpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBlendInterpolator

Interpolates a point?

point_value

The interpolated point?

class NifFormat.NiBlendTransformInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBlendInterpolator

Unknown.

class NifFormat.NiBone(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

A NiNode used as a skeleton bone?

class NifFormat.NiBoneLODController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Level of detail controller for bones. Priority is arranged from low to high.

node_groups

A list of node groups (each group a sequence of bones).

num_node_groups

Number of node groups.

num_node_groups_2

Number of node groups.

num_shape_groups

Number of shape groups.

num_shape_groups_2

The size of the second list of shape groups.

shape_groups_1

List of shape groups.

shape_groups_2

Group of NiTriShape indices.

unknown_int_1

Unknown.

unknown_int_2

Unknown.

unknown_int_3

Unknown.

class NifFormat.NiBoolData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Timed boolean data.

data

The boolean keys.

class NifFormat.NiBoolInterpController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSingleInterpController

A controller that interpolates floating point numbers?

class NifFormat.NiBoolInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiKeyBasedInterpolator

Unknown.

bool_value

Value when posed? At time 0?

data

Refers to a NiBoolData object.

class NifFormat.NiBoolTimelineInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBoolInterpolator

Unknown.

class NifFormat.NiBooleanExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Boolean extra data.

boolean_data

The boolean extra data value.

class NifFormat.NiCamera(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiAVObject

Camera object.

frustum_bottom

Frustrum bottom.

frustum_far

Frustrum far.

frustum_left

Frustrum left.

frustum_near

Frustrum near.

frustum_right

Frustrum right.

frustum_top

Frustrum top.

lod_adjust

Level of detail adjust.

unknown_int

Unknown. Changing value crashes viewer.

unknown_int_2

Unknown. Changing value crashes viewer.

unknown_int_3

Unknown.

Unknown.

unknown_short

Unknown.

use_orthographic_projection

Determines whether perspective is used. Orthographic means no perspective.

viewport_bottom

Viewport bottom.

viewport_left

Viewport left.

viewport_right

Viewport right.

viewport_top

Viewport top.

class NifFormat.NiClod(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriBasedGeom

A shape node that holds continuous level of detail information.Seems to be specific to Freedom Force.

class NifFormat.NiClodData(template=None, argument=None, parent=None)

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.

class NifFormat.NiClodSkinInstance(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSkinInstance

A copy of NISkinInstance for use with NiClod meshes.

class NifFormat.NiCollisionData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiCollisionObject

Collision box.

bounding_volume

Collision data.

collision_mode

Collision Mode

propagation_mode

Propagation Mode

use_abv

Use Alternate Bounding Volume.

class NifFormat.NiCollisionObject(template=None, argument=None, parent=None)

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.

target

Index of the AV object referring to this collision object.

class NifFormat.NiColorData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Color data for material color controller.

data

The color keys.

class NifFormat.NiColorExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown.

data

RGBA Color?

class NifFormat.NiControllerManager(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Unknown. Root of all controllers?

controller_sequences

Refers to a list of NiControllerSequence object.

cumulative

Designates whether animation sequences are cumulative?

num_controller_sequences

The number of controller sequence objects.

object_palette

Refers to a NiDefaultAVObjectPalette.

class NifFormat.NiDefaultAVObjectPalette(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiAVObjectPalette

Unknown. Refers to a list of objects. Used by NiControllerManager.

num_objs

Number of objects.

objs

The objects.

unknown_int

Unknown.

class NifFormat.NiDirectionalLight(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiLight

Directional light source.

class NifFormat.NiDitherProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Unknown.

flags

1’s Bit: Enable dithering

class NifFormat.NiDynamicEffect(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiAVObject

A dynamic effect such as a light or environment map.

affected_node_list_pointers

This is probably the list of affected nodes. For some reason i do not know the max exporter seems to write pointers instead of links. But it doesn’t matter because at least in version 4.0.0.2 the list is automagically updated by the engine during the load stage.

affected_nodes

The list of affected nodes?

num_affected_node_list_pointers

The number of affected nodes referenced.

num_affected_nodes

The number of affected nodes referenced.

switch_state

Turns effect on and off? Switches list to list of unaffected nodes?

class NifFormat.NiEnvMappedTriShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObjectNET

Unknown

child_2

unknown

child_3

unknown

children

List of child node object indices.

num_children

The number of child objects.

unknown_1

unknown (=4 - 5)

unknown_matrix

unknown

class NifFormat.NiEnvMappedTriShapeData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriShapeData

Holds mesh data using a list of singular triangles.

class NifFormat.NiExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

A generic extra data object.

name

Name of this object.

next_extra_data

Block number of the next extra data object.

class NifFormat.NiExtraDataController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSingleInterpController

An controller for extra data.

class NifFormat.NiFlipController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiFloatInterpController

Texture flipping controller.

delta

Time between two flips.delta = (start_time - stop_time) / sources.num_indices

images

The image sources

num_sources

The number of source objects.

sources

The texture sources.

texture_slot

Target texture slot (0=base, 4=glow).

unknown_int_2

0?

class NifFormat.NiFloatData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Possibly the 1D position along a 3D path.

data

The keys.

class NifFormat.NiFloatExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Float extra data.

float_data

The float data.

class NifFormat.NiFloatExtraDataController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraDataController

Unknown.

controller_data

Refers to a NiFloatExtraData name.

num_extra_bytes

Number of extra bytes.

unknown_bytes

Unknown.

unknown_extra_bytes

Unknown.

class NifFormat.NiFloatInterpController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSingleInterpController

A controller that interpolates floating point numbers?

class NifFormat.NiFloatInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiKeyBasedInterpolator

Unknown.

data

Float data?

float_value

Value when posed? At time 0?

class NifFormat.NiFloatsExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Unknown.

data

Float data.

num_floats

Number of floats in the next field.

class NifFormat.NiFogProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Describes... fog?

flags

1’s bit: Enables Fog2’s bit: Sets Fog Function to FOG_RANGE_SQ4’s bit: Sets Fog Function to FOG_VERTEX_ALPHAIf 2’s and 4’s bit are not set, but fog is enabled, Fog function is FOG_Z_LINEAR.

fog_color

The color of the fog.

fog_depth

The thickness of the fog? Default is 1.0

class NifFormat.NiGeomMorpherController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpController

Time controller for geometry morphing.

always_update

Always Update

data

Geometry morphing data index.

extra_flags

Unknown.

interpolator_weights

Weighted Interpolators?

interpolators

List of interpolators.

num_interpolators

The number of interpolator objects.

num_unknown_ints

A count.

unknown_2

Unknown.

unknown_ints

Unknown.

class NifFormat.NiGeometry(template=None, argument=None, parent=None)

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(bone, vert_weights)

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:
  • bone – The bone NiNode block.
  • vert_weights – A dictionary mapping each influenced vertex index to a vertex weight.
flatten_skin()

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.

get_skin_deformation()

Returns a list of vertices and normals in their final position after skinning, in geometry space.

get_skin_partition()

Return the skin partition block.

get_vertex_weights()

Get vertex weights in a convenient format: list bone and weight per vertex.

is_skin()

Returns True if geometry is skinned.

send_bones_to_bind_position()

Send all bones to their bind position.

@deprecated: Use L{NifFormat.NiNode.send_bones_to_bind_position} instead of
this function.
set_skin_partition(skinpart)

Set skin partition block.

update_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.

class NifFormat.NiGeometryData(template=None, argument=None, parent=None)

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)
apply_scale(scale)

Apply scale factor on data.

get_vertex_hash_generator(vertexprecision=3, normalprecision=3, uvprecision=5, vcolprecision=3)

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 behind the comma.

Default for uvprecision should really be high because for very large models the uv coordinates can be very close together.

For vertexprecision, 3 seems usually enough (maybe we’ll have to increase this at some point).

Parameters:
  • vertexprecision (float) – Precision to be used for vertices.
  • normalprecision (float) – Precision to be used for normals.
  • uvprecision (float) – Precision to be used for uvs.
  • vcolprecision (float) – Precision to be used for vertex colors.
Returns:

A generator yielding a hash value for each vertex.

update_center_radius()

Recalculate center and radius of the data.

class NifFormat.NiGravity(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleModifier

A particle modifier; applies a gravitational field on the particles.

direction

The direction of the applied acceleration.

force

The strength/force of this gravity.

position

The position of the mass point relative to the particle system. (TODO: check for versions<= 3.1)

type

The force field’s type.

unknown_float_1

Unknown.

class NifFormat.NiIntegerExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Extra integer data.

integer_data

The value of the extra data.

class NifFormat.NiIntegersExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Integers data.

data

Integers.

num_integers

Number of integers.

class NifFormat.NiInterpController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

A controller capable of interpolation?

class NifFormat.NiInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Interpolator objects - function unknown.

class NifFormat.NiKeyBasedInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpolator

Interpolator objects that use keys?

class NifFormat.NiKeyframeController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSingleInterpController

A time controller object for animation key frames.

data

Keyframe controller data index.

class NifFormat.NiLODData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Abstract class used for different types of LOD selections.

class NifFormat.NiLODNode(template=None, argument=None, parent=None)

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.

lod_center

Point to calculate distance from for switching?

lod_level_data

Refers to LOD level information, either distance or screen size based.

lod_levels

The ranges of distance that each level of detail applies in.

num_lod_levels

Number of levels of detail.

class NifFormat.NiLight(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiDynamicEffect

Light source.

ambient_color

Ambient color.

diffuse_color

Diffuse color.

dimmer

Dimmer.

specular_color

Specular color.

class NifFormat.NiLightColorController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPoint3InterpController

Light color animation controller.

class NifFormat.NiLightDimmerController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiFloatInterpController

Unknown controller.

class NifFormat.NiLightIntensityController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiFloatInterpController

Unknown controller

class NifFormat.NiLines(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriBasedGeom

Wireframe geometry.

class NifFormat.NiLinesData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiGeometryData

Wireframe geometry data.

lines

Is vertex connected to other (next?) vertex?

class NifFormat.NiLookAtController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Unknown. Start time is 3.4e+38 and stop time is -3.4e+38.

look_at_node

Link to the node to look at?

unknown_1

Unknown.

class NifFormat.NiLookAtInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpolator

Unknown.

look_at

Refers to a Node to focus on.

rotation

Rotation.

scale

Scale.

target

Target node name.

translation

Translate.

Refers to NiPoint3Interpolator.

Refers to a NiFloatInterpolator.

Refers to a NiFloatInterpolator.

unknown_short

Unknown.

class NifFormat.NiMeshModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Base class for mesh modifiers.

complete_points

The complete points used by this mesh modifier

num_complete_points

The number of complete points used by this mesh modifier.

num_submit_points

The number of submit points used by this mesh modifier.

submit_points

The submit points used by this mesh modifier

class NifFormat.NiMeshPSysData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysData

Particle meshes data.

num_unknown_ints_1

Unknown.

unknown_byte_3

Unknown. 0?

unknown_int_2

Unknown. Possible vertex count but probably not.

unknown_ints_1

Unknown integers

unknown_node

Unknown NiNode.

class NifFormat.NiMeshParticleSystem(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleSystem

Particle system.

class NifFormat.NiMorphController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpController

Unknown! Used by Daoc->’healing.nif’.

class NifFormat.NiMorphMeshModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiMeshModifier

Performs linear-weighted blending between a set of target data streams.

elements

Semantics and normalization of the morphing data stream elements.

flags

FLAG_RELATIVETARGETS = 0x01FLAG_UPDATENORMALS = 0x02FLAG_NEEDSUPDATE = 0x04FLAG_ALWAYSUPDATE = 0x08FLAG_NEEDSCOMPLETION = 0x10FLAG_SKINNED = 0x20FLAG_SWSKINNED = 0x40

num_elements

The number of morphing data stream elements.

num_targets

The number of morph targets.

class NifFormat.NiMorpherController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpController

Unknown! Used by Daoc.

data

This controller’s data.

class NifFormat.NiMultiTargetTransformController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpController

Unknown.

extra_targets

NiNode Targets to be controlled.

num_extra_targets

The number of target pointers that follow.

class NifFormat.NiMultiTextureProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

(note: not quite complete yet... but already reads most of the DAoC ones)

flags

Property flags.

texture_elements

Describes the various textures used by this mutli-texture property. Each slot probably has special meaning like thoes in NiTexturingProperty.

unknown_int

Unknown. Always 5 for DAoC files, and always 6 for Bridge Commander. Seems to have nothing to do with the number of Texture Element slots that follow.

class NifFormat.NiNode(template=None, argument=None, parent=None)

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_child(child, front=False)

Add block to child list.

Parameters:
  • child (L{NifFormat.NiAVObject}) – The child to add.
  • front (bool) – Whether to add to the front or to the end of the list (default is at end).
add_effect(effect)

Add an effect to the list of effects.

Parameters:effect (L{NifFormat.NiDynamicEffect}) – The effect to add.
get_children()

Return a list of the children of the block.

Returns:The list of children.
Return type:list of L{NifFormat.NiAVObject}
get_effects()

Return a list of the effects of the block.

Returns:The list of effects.
Return type:list of L{NifFormat.NiDynamicEffect}
get_skinned_geometries()

This function yields all skinned geometries which have self as skeleton root.

merge_external_skeleton_root(skelroot)

Attach skinned geometry to self (which will be the new skeleton root of the nif at the given skeleton root). Use this function if you move a skinned geometry from one nif into a new nif file. The bone links will be updated to point to the tree at self, instead of to the external tree.

merge_skeleton_roots()

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_child(child)

Remove a block from the child list.

Parameters:child (L{NifFormat.NiAVObject}) – The child to remove.
remove_effect(effect)

Remove a block from the effect list.

Parameters:effect (L{NifFormat.NiDynamicEffect}) – The effect to remove.
send_bones_to_bind_position()

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
send_detached_geometries_to_node_position()

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.

send_geometries_to_bind_position()

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_children(childlist)

Set the list of children from the given list (destroys existing list).

Parameters:childlist (list of L{NifFormat.NiAVObject}) – The list of child blocks to set.
set_effects(effectlist)

Set the list of effects from the given list (destroys existing list).

Parameters:effectlist (list of L{NifFormat.NiDynamicEffect}) – The list of effect blocks to set.
class NifFormat.NiPSSimulator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiMeshModifier

The mesh modifier that performs all particle system simulation.

num_simulation_steps

The number of simulation steps in this modifier.

simulation_steps

Links to the simulation steps.

class NifFormat.NiPSSimulatorCollidersStep(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSSimulatorStep

Encapsulates a floodgate kernel that simulates particle colliders.

colliders

The colliders affecting the particle system.

num_colliders

The number of colliders affecting the particle system.

class NifFormat.NiPSSimulatorFinalStep(template=None, argument=None, parent=None)

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.

class NifFormat.NiPSSimulatorForcesStep(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSSimulatorStep

Encapsulates a floodgate kernel that simulates particle forces.

forces

The forces affecting the particle system.

num_forces

The number of forces affecting the particle system.

class NifFormat.NiPSSimulatorGeneralStep(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSSimulatorStep

Encapsulates a floodgate kernel that updates particle size, colors, and rotations.

color_keys

The particle color keys.

color_loop_behavior

The loop behavior for the color keys.

grow_generation

Specifies the particle generation to which the grow effect should be applied. This is usually generation 0, so that newly created particles will grow.

grow_time

The the amount of time over which a particle’s size is ramped from 0.0 to 1.0 in seconds

num_color_keys

The number of color animation keys.

num_rotation_keys

The number of rotatoin animation keys.

num_size_keys

The number of size animation keys.

rotation_keys

The particle rotation keys.

rotation_loop_behavior

The loop behavior for the rotation keys.

shrink_generation

Specifies the particle generation to which the shrink effect should be applied. This is usually the highest supported generation for the particle system, so that particles will shrink immediately before getting killed.

shrink_time

The the amount of time over which a particle’s size is ramped from 1.0 to 0.0 in seconds

size_keys

The particle size keys.

size_loop_behavior

The loop behavior for the size keys.

class NifFormat.NiPSSimulatorMeshAlignStep(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSSimulatorStep

Encapsulates a floodgate kernel that updates mesh particle alignment and transforms.

num_rotation_keys

The number of rotation keys.

rotation_keys

The particle rotation keys.

rotation_loop_behavior

The loop behavior for the rotation keys.

class NifFormat.NiPSSimulatorStep(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Abstract base class for a single step in the particle system simulation process. It has no seralized data.

class NifFormat.NiPSysAgeDeathModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Unknown particle modifier.

spawn_modifier

Link to NiPSysSpawnModifier object?

spawn_on_death

Unknown.

class NifFormat.NiPSysAirFieldAirFrictionCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for air field air friction.

class NifFormat.NiPSysAirFieldInheritVelocityCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for air field inherit velocity.

class NifFormat.NiPSysAirFieldModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysFieldModifier

Particle system modifier, used for controlling the particle velocity in a field like wind.

direction

Direction of the particle velocity

unknown_boolean_1

Unknown

unknown_boolean_2

Unknown

unknown_boolean_3

Unknown

unknown_float_2

Unknown

unknown_float_3

Unknown

unknown_float_4

Unknown

class NifFormat.NiPSysAirFieldSpreadCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for air field spread.

class NifFormat.NiPSysBombModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Particle modifier that uses a NiNode to use as a “Bomb Object” to alter the path of particles.

bomb_axis

Orientation of bomb object.

bomb_object

Link to a NiNode for bomb to function.

decay

Falloff rate of the bomb object.

decay_type

Decay type

delta_v

DeltaV / Strength?

symmetry_type

Shape/symmetry of the bomb object.

class NifFormat.NiPSysBoundUpdateModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Unknown particle system modifier.

update_skip

Unknown.

class NifFormat.NiPSysBoxEmitter(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysVolumeEmitter

Particle emitter that uses points within a defined Box shape to emit from..

depth

Defines the Depth of the box area.

height

Defines the Height of the box area.

width

Defines the Width of the box area.

class NifFormat.NiPSysCollider(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Particle system collider.

bounce

Defines amount of bounce the collider object has.

collider_object

Links to a NiNode that will define where in object space the collider is located/oriented.

die_on_collide

Kill particles on impact if set to yes.

next_collider

The next collider.

parent

Link to parent.

spawn_modifier

Link to NiPSysSpawnModifier object?

spawn_on_collide

Unknown.

class NifFormat.NiPSysColliderManager(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Particle modifier that adds a defined shape to act as a collision object for particles to interact with.

collider

Link to a NiPSysPlanarCollider or NiPSysSphericalCollider.

class NifFormat.NiPSysColorModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Particle modifier that adds keyframe data to modify color/alpha values of particles over time.

data

Refers to NiColorData object.

class NifFormat.NiPSysCylinderEmitter(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysVolumeEmitter

Particle emitter that uses points within a defined Cylinder shape to emit from.

height

Height of the cylinders shape.

radius

Radius of the cylinder shape.

class NifFormat.NiPSysDragFieldModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysFieldModifier

Particle system modifier, used for controlling the particle velocity in drag space warp.

direction

Direction of the particle velocity

use_direction

Whether to use the direction field?

class NifFormat.NiPSysDragModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Unknown.

drag_axis

The drag axis.

parent

Parent reference.

percentage

Drag percentage.

range

The range.

range_falloff

The range falloff.

class NifFormat.NiPSysEmitter(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

A particle emitter?

declination

Declination / First axis.

declination_variation

Declination randomness / First axis.

initial_color

Defines color of a birthed particle.

initial_radius

Size of a birthed particle.

life_span

Duration until a particle dies.

life_span_variation

Adds randomness to Life Span.

planar_angle

Planar Angle / Second axis.

planar_angle_variation

Planar Angle randomness / Second axis .

radius_variation

Particle Radius randomness.

speed

Speed / Inertia of particle movement.

speed_variation

Adds an amount of randomness to Speed.

class NifFormat.NiPSysEmitterCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierCtlr

Particle system emitter controller.

data

This controller’s data

visibility_interpolator

Links to a bool interpolator. Controls emitter’s visibility status?

class NifFormat.NiPSysEmitterCtlrData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Particle system emitter controller data.

float_keys

Unknown.

num_visibility_keys

Number of keys.

visibility_keys

Unknown.

class NifFormat.NiPSysEmitterDeclinationCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Unknown.

class NifFormat.NiPSysEmitterDeclinationVarCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Unknown.

class NifFormat.NiPSysEmitterInitialRadiusCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Unknown.

class NifFormat.NiPSysEmitterLifeSpanCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Unknown.

class NifFormat.NiPSysEmitterPlanarAngleCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for emitter planar angle.

class NifFormat.NiPSysEmitterPlanarAngleVarCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for emitter planar angle variation.

class NifFormat.NiPSysEmitterSpeedCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Unknown.

class NifFormat.NiPSysFieldAttenuationCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for force field attenuation.

class NifFormat.NiPSysFieldMagnitudeCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for force field magnitude.

class NifFormat.NiPSysFieldMaxDistanceCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for force field maximum distance.

class NifFormat.NiPSysFieldModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Base for all force field particle modifiers.

attenuation

Controls how quick the field diminishes

field_object

Force Field Object

magnitude

Magnitude of the force

max_distance

Maximum distance

use_max_distance

Use maximum distance

class NifFormat.NiPSysGravityFieldModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysFieldModifier

Particle system modifier, used for controlling the particle velocity in gravity field.

direction

Direction of the particle velocity

class NifFormat.NiPSysGravityModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Adds gravity to a particle system, when linked to a NiNode to use as a Gravity Object.

decay

Falloff range.

force_type

Planar or Spherical type

gravity_axis

Orientation of gravity.

gravity_object

Refers to a NiNode for gravity location.

strength

The strength of gravity.

turbulence

Adds a degree of randomness.

turbulence_scale

Range for turbulence.

unknown_byte

Unknown

class NifFormat.NiPSysGravityStrengthCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Unknown.

class NifFormat.NiPSysGrowFadeModifier(template=None, argument=None, parent=None)

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.

base_scale

Unknown

fade_generation

Unknown.

fade_time

Time in seconds to fade out.

grow_generation

Unknown.

grow_time

Time in seconds to fade in.

class NifFormat.NiPSysInitialRotAngleCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for emitter initial rotation angle.

class NifFormat.NiPSysInitialRotAngleVarCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for emitter initial rotation angle variation.

class NifFormat.NiPSysInitialRotSpeedCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for emitter initial rotation speed.

class NifFormat.NiPSysInitialRotSpeedVarCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierFloatCtlr

Particle system controller for emitter initial rotation speed variation.

class NifFormat.NiPSysMeshEmitter(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysEmitter

Particle emitter that uses points on a specified mesh to emit from.

emission_axis

The emission axis.

emission_type

The parts of the mesh that the particles emit from.

emitter_meshes

Links to meshes used for emitting.

initial_velocity_type

The way the particles get their initial direction and speed.

num_emitter_meshes

The number of references to emitter meshes that follow.

class NifFormat.NiPSysMeshUpdateModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Unknown.

meshes

Group of target NiNodes or NiTriShapes?

num_meshes

The number of object references that follow.

class NifFormat.NiPSysModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Generic particle system modifier object.

active

Whether the modifier is currently in effect? Usually true.

name

The object name.

order

Modifier ID in the particle modifier chain (always a multiple of 1000)?

target

NiParticleSystem parent of this modifier.

class NifFormat.NiPSysModifierActiveCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierBoolCtlr

Unknown.

data

This controller’s data.

class NifFormat.NiPSysModifierBoolCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierCtlr

A particle system modifier controller that deals with boolean data?

class NifFormat.NiPSysModifierCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSingleInterpController

A particle system modifier controller.

modifier_name

Refers to modifier object by its name?

class NifFormat.NiPSysModifierFloatCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifierCtlr

A particle system modifier controller that deals with floating point data?

data

This controller’s data.

class NifFormat.NiPSysPlanarCollider(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysCollider

Particle Collider object which particles will interact with.

height

Defines the height of the plane.

width

Defines the width of the plane.

x_axis

Defines Orientation.

y_axis

Defines Orientation.

class NifFormat.NiPSysPositionModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Unknown particle system modifier.

class NifFormat.NiPSysRadialFieldModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysFieldModifier

Particle system modifier, used for controlling the particlevelocity in force field.

radial_type

Unknown Enums?

class NifFormat.NiPSysResetOnLoopCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Unknown.

class NifFormat.NiPSysRotationModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Particle modifier that adds rotations to particles.

initial_axis

Unknown.

initial_rotation_angle

Sets the intial angle for particles to be birthed in.

initial_rotation_angle_variation

Adds a random range to Initial angle.

initial_rotation_speed

The initial speed of rotation.

initial_rotation_speed_variation

Adds a ranged randomness to rotation speed.

random_initial_axis

Unknown.

random_rot_speed_sign

Unknown

class NifFormat.NiPSysSpawnModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysModifier

Unknown particle modifier.

life_span

Unknown.

life_span_variation

Unknown.

max_num_to_spawn

Unknown.

min_num_to_spawn

Unknown.

num_spawn_generations

Unknown.

percentage_spawned

Unknown.

spawn_dir_chaos

Unknown.

spawn_speed_chaos

Unknown.

unknown_int

Unknown

class NifFormat.NiPSysSphereEmitter(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysVolumeEmitter

Particle emitter that uses points within a sphere shape to emit from.

radius

The radius of the sphere shape

class NifFormat.NiPSysSphericalCollider(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysCollider

Particle Collider object which particles will interact with.

radius

Defines the radius of the sphere object.

class NifFormat.NiPSysTrailEmitter(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysEmitter

Guild 2-Specific node

unknown_float_1

Unknown

unknown_float_2

Unknown

unknown_float_3

Unknown

unknown_float_4

Unknown

unknown_float_5

Unknown

unknown_float_6

Unknown

unknown_float_7

Unknown

unknown_int_1

Unknown

unknown_int_2

Unknown

unknown_int_3

Unknown

unknown_int_4

Unknown

class NifFormat.NiPSysTurbulenceFieldModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysFieldModifier

Particle system modifier, used for controlling the particle velocity in drag space warp.

frequency

Frequency of the update.

class NifFormat.NiPSysUpdateCtlr(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Particle system controller, used for ???.

class NifFormat.NiPSysVolumeEmitter(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysEmitter

An emitter that emits meshes?

emitter_object

Node parent of this modifier?

class NifFormat.NiPSysVortexFieldModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPSysFieldModifier

Particle system modifier, used for controlling the particle velocity in force field.

direction

Direction of the particle velocity

class NifFormat.NiPalette(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

A color palette.

num_entries

The number of palette entries. Always = 256.

palette

The color palette.

unknown_byte

Unknown, Usually = 0.

class NifFormat.NiParticleBomb(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleModifier

A particle modifier.

decay

Unknown.

decay_type

Unknown.

delta_v

Unknown.

direction

The direction of the applied acceleration?

duration

Unknown.

position

The position of the mass point relative to the particle system?

start

Unknown.

symmetry_type

Unknown.

class NifFormat.NiParticleColorModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleModifier

Unknown.

color_data

Color data index.

class NifFormat.NiParticleGrowFade(template=None, argument=None, parent=None)

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.

fade

The time from the end of the particle lifetime during which the particle fades.

grow

The time from the beginning of the particle lifetime during which the particle grows.

class NifFormat.NiParticleMeshModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleModifier

Unknown.

num_particle_meshes

The number of particle mesh references that follow.

particle_meshes

Links to nodes of particle meshes?

class NifFormat.NiParticleMeshes(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticles

Mesh particle node?

class NifFormat.NiParticleMeshesData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiRotatingParticlesData

Particle meshes data.

Refers to the mesh that makes up a particle?

class NifFormat.NiParticleModifier(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

A particle system modifier.

controller

Points to the particle system controller parent.

next_modifier

Next particle modifier.

class NifFormat.NiParticleRotation(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleModifier

Unknown.

initial_axis

Unknown.

random_initial_axis

Unknown.

rotation_speed

Unknown.

class NifFormat.NiParticleSystem(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticles

A particle system.

modifiers

The list of particle modifiers.

num_modifiers

The number of modifier references.

world_space

If true, Particles are birthed into world space. If false, Particles are birthed into object space.

class NifFormat.NiParticleSystemController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

A generic particle system time controller object.

emit_flags

Bit 0: Emit Rate toggle bit (0 = auto adjust, 1 = use Emit Rate value)

emit_rate

Particle emission rate (particles per second)

emit_start_time

Particle emit start time

emit_stop_time

Particle emit stop time

emitter

This index targets the particle emitter object (TODO: find out what type of object this refers to).

horizontal_angle

emitter’s horizontal opening angle

horizontal_direction

horizontal emit direction

lifetime

Particle lifetime

lifetime_random

Particle lifetime random modifier

num_particles

Size of the following array. (Maximum number of simultaneous active particles)

num_valid

Number of valid entries in the following array. (Number of active particles at the time the system was saved)

old_emit_rate

Particle emission rate in old files

old_speed

Particle speed in old files

particle_extra

Link to some optional particle modifiers (NiGravity, NiParticleGrowFade, NiParticleBomb, ...)

particle_lifetime

The particle’s age.

particle_timestamp

Timestamp of the last update.

particle_unknown_short

Unknown short

particle_unknown_vector

Unknown

particle_velocity

Particle velocity

particle_vertex_id

Particle/vertex index matches array index

particles

Individual particle modifiers?

size

Particle size

speed

Particle speed

speed_random

Particle random speed modifier

start_random

Particle random start translation vector

trailer

Trailing null byte

unknown_byte

Unknown byte, (=0)

unknown_color

Unknown.

unknown_float_13

? float=1.0 ?

unknown_int_1

? int=1 ?

unknown_int_2

? int=0 ?

unknown int (=0xffffffff)

Unknown int (=0xffffffff)

unknown_normal

Unknown.

unknown_short_2

? short=0 ?

unknown_short_3

? short=0 ?

vertical_angle

emitter’s vertical opening angle [radians]

vertical_direction

vertical emit direction [radians]0.0 : up1.6 : horizontal3.1416 : down

class NifFormat.NiParticles(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiGeometry

Generic particle system node.

class NifFormat.NiParticlesData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiGeometryData

Generic rotating particles data object.

has_radii

Is the particle size array present?

has_rotation_angles

Are the angles of rotation present?

has_rotation_axes

Are axes of rotation present?

has_rotations

Is the particle rotation array present?

has_sizes

Is the particle size array present?

has_unknown_stuff_1

Unknown ushort

num_active

The number of active particles at the time the system was saved. This is also the number of valid entries in the following arrays.

num_particles

The maximum number of particles (matches the number of vertices).

num_unknown_stuff_1

Unknown

particle_radius

The particles’size.

radii

The individual particel sizes.

rotation_angles

Angles of rotation

rotation_axes

Unknown

rotations

The individual particle rotations.

sizes

The individual particel sizes.

unknown_stuff_1

Unknown

class NifFormat.NiPathController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Time controller for a path.

float_data

Path controller data index (float data). ?

pos_data

Path controller data index (position data). ?

unknown_float_2

Unknown, often 0?

unknown_float_3

Unknown, often 0?

unknown_int_1

Unknown, always 1?

unknown_short

Unknown, always 0?

unknown_short_2

Unknown.

class NifFormat.NiPathInterpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiKeyBasedInterpolator

Unknown interpolator.

float_data

Links to NiFloatData.

pos_data

Links to NiPosData.

unknown_float_1

Unknown.

unknown_float_2

Unknown.

unknown_int

Unknown.

unknown_short

Unknown.

unknown_short_2

Unknown. Zero.

class NifFormat.NiPhysXActorDesc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

shape_description

PhysX Shape Description

unknown_byte_1

Unknown

unknown_byte_2

Unknown

unknown_int_1

Unknown

unknown_int_2

Unknown

unknown_int_4

Unknown

unknown_int_5

Unknown

unknown_int_6

Unknown

unknown_quat_1

Unknown

unknown_quat_2

Unknown

unknown_quat_3

Unknown

unknown_ref_0

Unknown

unknown_ref_1

Unknown

unknown_ref_2

Unknown

unknown_refs_3

Unknown

class NifFormat.NiPhysXBodyDesc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

unknown_bytes

Unknown

class NifFormat.NiPhysXD6JointDesc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

unknown_bytes

Unknown

class NifFormat.NiPhysXKinematicSrc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

unknown_bytes

Unknown

class NifFormat.NiPhysXMaterialDesc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown node.

unknown_byte_1

Unknown

unknown_byte_2

Unknown

unknown_int

Unknown

class NifFormat.NiPhysXMeshDesc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

num_vertices

Number of mesh vertices

unknown_byte_1

Unknown

unknown_byte_2

Unknown

unknown_bytes_0

NXS

unknown_bytes_1

MESH

unknown_bytes_2

Unknown

unknown_bytes_3

Unknown

unknown_float_1

Unknown

unknown_float_2

Unknown

unknown_int_1

Unknown

unknown_int_2

Unknown

unknown_int_4

Unknown

unknown_ints_1

Unknown

unknown_short_1

Unknown

unknown_short_2

Unknown

unknown_shorts_1

Unknown

vertices

Vertices

class NifFormat.NiPhysXProp(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObjectNET

Unknown PhysX node.

num_dests

Number of NiPhysXTransformDest references

prop_description

PhysX Property Description.

transform_dests

Unknown

unknown_byte

Unknown

unknown_float_1

Unknown

unknown_int

Unknown

unknown_int_1

Unknown

unknown_refs_1

Unknown

class NifFormat.NiPhysXPropDesc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

actor_descs

Unknown

joint_descs

PhysX Joint Descriptions

material_descs

PhysX Material Descriptions

num_dests

Number of NiPhysXActorDesc references

num_joints

Unknown

num_materials

Unknown

unknown_byte_6

Unknown

unknown_int_1

Unknown

unknown_int_2

Unknown

unknown_int_3

Unknown

unknown_int_5

Unknown

unknown_string_4

Unknown

class NifFormat.NiPhysXShapeDesc(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

mesh_description

PhysX Mesh Description

unknown_float_1

Unknown

unknown_float_2

Unknown

unknown_float_3

Unknown

unknown_int_1

Unknown

unknown_int_2

Unknown

unknown_int_3

Unknown

unknown_int_4

Unknown

unknown_int_5

Unknown

unknown_int_7

Unknown

unknown_int_8

Unknown

unknown_quat_1

Unknown

unknown_quat_2

Unknown

unknown_quat_3

Unknown

unknown_short_1

Unknown

unknown_short_2

Unknown

class NifFormat.NiPhysXTransformDest(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Unknown PhysX node.

node

Affected node?

unknown_byte_1

Unknown. =1?

unknown_byte_2

Unknown. =0

class NifFormat.NiPixelData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.ATextureRenderData

A texture.

pixel_data

Raw pixel data holding the mipmaps. Mipmap zero is the full-size texture and they get smaller by half as the number increases.

pixel_data_matrix

Raw pixel data holding the mipmaps. Mipmap zero is the full-size texture and they get smaller by half as the number increases.

class NifFormat.NiPlanarCollider(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleModifier

Unknown.

unknown_float_1

Unknown.

unknown_float_10

Unknown.

unknown_float_11

Unknown.

unknown_float_12

Unknown.

unknown_float_13

Unknown.

unknown_float_14

Unknown.

unknown_float_15

Unknown.

unknown_float_16

Unknown.

unknown_float_2

Unknown.

unknown_float_3

Unknown.

unknown_float_4

Unknown.

unknown_float_5

Unknown.

unknown_float_6

Unknown.

unknown_float_7

Unknown.

unknown_float_8

Unknown.

unknown_float_9

Unknown.

unknown_short

Usually 0?

unknown_short_2

Unknown.

class NifFormat.NiPoint3InterpController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSingleInterpController

A controller that interpolates point 3 data?

data

Material color controller data object index. Points to NiPosData.

target_color

Selects which color to control.

class NifFormat.NiPoint3Interpolator(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiKeyBasedInterpolator

Unknown.

data

Reference to NiPosData.

point_3_value

Value when posed? Value at time 0?

class NifFormat.NiPointLight(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiLight

A point light.

constant_attenuation

Constant Attenuation

linear_attenuation

Linear Attenuation

quadratic_attenuation

Quadratic Attenuation (see glLight)

class NifFormat.NiPortal(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiAVObject

A Portal

num_vertices

Number of vertices in this polygon

target

Target portal or room

unknown_flags

Unknown flags.

unknown_short_2

Unknown

vertices

Vertices

class NifFormat.NiPosData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Position data.

data

The position keys.

class NifFormat.NiProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObjectNET

A generic property object.

class NifFormat.NiRangeLODData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiLODData

Describes levels of detail based on distance of object from camera.

lod_center

?

lod_levels

The ranges of distance that each level of detail applies in.

num_lod_levels

Number of levels of detail.

class NifFormat.NiRawImageData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Raw image data.

height

Image height

image_type

The format of the raw image data.

rgb_image_data

Image pixel data.

rgba_image_data

Image pixel data.

width

Image width

class NifFormat.NiRenderObject(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiAVObject

An object that can be rendered.

active_material

The index of the currently active material.

material_data

Per-material data.

material_needs_update_default

The initial value for the flag that determines if the internal cached shader is valid.

num_materials

The number of materials affecting this renderable object.

class NifFormat.NiRollController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSingleInterpController

Unknown.

data

The data for the controller.

class NifFormat.NiRoom(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Grouping node for nodes in a Portal

in_portals

Number of portals into room

items

All geometry associated with room.

num_in_portals

Number of doors into room

num_items

Number of unknowns

num_portals_2

Number of doors out of room

num_walls

Number of walls in a room?

portals_2

Number of portals out of room

wall_plane

Face normal and unknown value.

class NifFormat.NiRoomGroup(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Grouping node for nodes in a Portal

num_rooms

Number of rooms in this group

rooms

Rooms associated with this group.

Outer Shell Geometry Node?

class NifFormat.NiRotatingParticles(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticles

Unknown.

class NifFormat.NiRotatingParticlesData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticlesData

Rotating particles data object.

has_rotations_2

Is the particle rotation array present?

rotations_2

The individual particle rotations.

class NifFormat.NiScreenElements(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriShape

Two dimensional screen elements.

class NifFormat.NiScreenElementsData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriShapeData

Two dimensional screen elements.

max_polygons

Maximum number of polygons?

num_polygons

Number of Polygons actually in use

polygon_indices

Polygon Indices

polygons

Polygons

unknown_u_short_1

Unknown

unknown_u_short_2

Unknown

unknown_u_short_3

Maximum number of faces

used_triangle_points

Number of in-use triangles

used_vertices

Number of in-use vertices

class NifFormat.NiScreenLODData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiLODData

Describes levels of detail based on size of object on screen?

bound_center

The center of the bounding sphere?

bound_radius

The radius of the bounding sphere?

proportion_count

The number of screen size based LOD levels.

proportion_levels

The LOD levels based on proportion of screen size?

world_center

The center of the bounding sphere in world space?

world_radius

The radius of the bounding sphere in world space?

class NifFormat.NiSequence(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Root node used in some Empire Earth II .kf files (version 4.2.2.0).

controlled_blocks

Refers to controlled objects.

name

Name of this object. This is also the name of the action associated with this file. For instance, if the original NIF file is called”demon.nif”and this animation file contains an attack sequence, then the file would be called”demon_attack1.kf”and this field would contain the string”attack1”.

num_controlled_blocks

Number of controlled objects.

text_keys

Link to NiTextKeyExtraData.

text_keys_name

Name of following referenced NiTextKeyExtraData class.

unknown_int_1

Unknown.

unknown_int_4

Unknown

unknown_int_5

Unknown

class NifFormat.NiSequenceStreamHelper(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObjectNET

Keyframe animation root node, in .kf files.

class NifFormat.NiShadeProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Determines whether flat shading or smooth shading is used on a shape.

flags

1’s Bit: Enable smooth phong shading on this shape.If 1’s bit is not set, hard-edged flat shading will be used on this shape.

class NifFormat.NiSingleInterpController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiInterpController

A controller referring to a single interpolator.

interpolator

Link to interpolator.

class NifFormat.NiSkinInstance(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Skinning instance.

bones

List of all armature bones.

data

Skinning data reference.

num_bones

The number of node bones referenced as influences.

skeleton_root

Armature root node.

skin_partition

Refers to a NiSkinPartition objects, which partitions the mesh such that every vertex is only influenced by a limited number of bones.

class NifFormat.NiSkinPartition(template=None, argument=None, parent=None)

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.

num_skin_partition_blocks

Unknown.

skin_partition_blocks

Skin partition objects.

class NifFormat.NiSortAdjustNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Unknown node. Found in Loki.

sorting_mode

Sorting

unknown_int_2

Unknown.

class NifFormat.NiSourceCubeMap(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiSourceTexture

Unknown node. Found in Emerge Demo.

class NifFormat.NiSourceTexture(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTexture

Describes texture source and properties.

alpha_format

Note: the NiTriShape linked to this object must have a NiAlphaProperty in its list of properties to enable material and/or texture transparency.

direct_render

Load direct to renderer

file_name

The original source filename of the image embedded by the referred NiPixelData object.

is_static

Is Static?

persist_render_data

Render data is persistant

pixel_data

Pixel data object index. NiPixelData or NiPersistentSrcTextureRendererData

pixel_layout

Specifies the way the image will be stored.

unknown_byte

Unknown. Seems to be set if Pixel Data is present?

Unknown.

use_external

Is the texture external?

use_mipmaps

Specifies whether mip maps are used.

class NifFormat.NiSpecularProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Gives specularity to a shape. Flags 0x0001.

flags

1’s Bit = Enable specular lighting on this shape.

class NifFormat.NiSphericalCollider(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiParticleModifier

Unknown.

unknown_float_1

Unknown.

unknown_float_2

Unknown.

unknown_float_3

Unknown.

unknown_float_4

Unknown.

unknown_float_5

Unknown.

unknown_short_1

Unknown.

unknown_short_2

Unknown.

class NifFormat.NiSpotLight(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiPointLight

A spot.

cutoff_angle

The opening angle of the spot.

exponent

Describes the distribution of light. (see: glLight)

unknown_float

Unknown

class NifFormat.NiStencilProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Allows control of stencil testing.

draw_mode

Used to enabled double sided faces. Default is 3 (DRAW_BOTH).

flags

Property flags:Bit 0: Stencil EnableBits 1-3: Fail ActionBits 4-6: Z Fail ActionBits 7-9: Pass ActionBits 10-11: Draw ModeBits 12-14: Stencil Function

stencil_enabled

Enables or disables the stencil test.

stencil_function

Selects the compare mode function (see: glStencilFunc).

stencil_mask

A bit mask. The default is 0xffffffff.

stencil_ref

Unknown. Default is 0.

class NifFormat.NiStringExtraData(template=None, argument=None, parent=None)

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.

bytes_remaining

The number of bytes left in the record. Equals the length of the following string + 4.

string_data

The string.

class NifFormat.NiStringPalette(template=None, argument=None, parent=None)

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.

palette

A bunch of 0x00 seperated strings.

class NifFormat.NiStringsExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

List of strings; for example, a list of all bone names.

data

The strings.

num_strings

Number of strings.

class NifFormat.NiSwitchNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

A node used to switch between branches, such as for LOD levels?

unknown_flags_1

Flags

unknown_int_1

Index?

class NifFormat.NiTextKeyExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Extra data, used to name different animation sequences.

num_text_keys

The number of text keys that follow.

text_keys

List of textual notes and at which time they take effect. Used for designating the start and stop of animations and the triggering of sounds.

unknown_int_1

Unknown. Always equals zero in all official files.

class NifFormat.NiTexture(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObjectNET

A texture.

class NifFormat.NiTextureEffect(template=None, argument=None, parent=None)

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).

clipping_plane

Determines whether a clipping plane is used. 0 means that a plane is not used.

coordinate_generation_type

The method that will be used to generate UV coordinates for the texture effect.

image

Image index.

model_projection_matrix

Model projection matrix. Always identity?

model_projection_transform

Model projection transform. Always (0,0,0)?

ps_2_k

-75?

ps_2_l

0?

source_texture

Source texture index.

texture_clamping

Texture Clamp mode.

texture_filtering

Texture Filtering mode.

texture_type

The type of effect that the texture is used for.

unknown_float

Unknown. 0?

unknown_short

Unknown: 0.

unknown_vector

Unknown: (1,0,0)?

class NifFormat.NiTextureModeProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Unknown

ps_2_k

-75?

ps_2_l

0?

unknown_short

Unknown. Either 210 or 194.

class NifFormat.NiTextureTransformController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiFloatInterpController

Texture transformation controller. The target texture slot should have “Has Texture Transform” enabled.

data

Link to NiFloatData.

operation

Determines how this controller animates the UV Coordinates.

texture_slot

The target texture slot.

unknown_2

Unknown.

class NifFormat.NiTexturingProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Describes an object’s textures.

apply_mode

Determines how the texture will be applied. Seems to have special functions in Oblivion.

base_texture

The base texture.

bump_map_luma_offset

Unknown.

bump_map_luma_scale

Unknown.

bump_map_matrix

Unknown.

bump_map_texture

The bump map texture.

dark_texture

The dark texture.

decal_0_texture

The decal texture.

decal_1_texture

Another decal texture.

decal_2_texture

Another decal texture.

decal_3_texture

Another decal texture. Who knows the limit.

detail_texture

The detail texture.

flags

Property flags.

gloss_texture

The gloss texture.

glow_texture

The glowing texture.

has_base_texture

Do we have a base texture?

has_bump_map_texture

Do we have a bump map texture?

has_dark_texture

Do we have a dark texture?

has_decal_0_texture

Do we have a decal 0 texture?

has_decal_1_texture

Do we have a decal 1 texture?

has_decal_2_texture

Do we have a decal 2 texture?

has_decal_3_texture

Do we have a decal 3 texture?

has_detail_texture

Do we have a detail texture?

has_gloss_texture

Do we have a gloss texture?

has_glow_texture

Do we have a glow texture?

has_normal_texture

Do we have a normal texture? (Noraml guess based on file suffix in sample files)

has_unknown_2_texture

Do we have a unknown texture 2?

normal_texture

Normal texture.

num_shader_textures

Number of Shader textures that follow.

shader_textures

Shader textures.

texture_count

Number of textures. Always 7 in versions<20.0.0.4. Can also be 8 in>= 20.0.0.4.

unknown_2_float

Unknown.

unknown_2_texture

Unknown texture 2.

class NifFormat.NiTimeController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

A generic time controller object.

flags

Controller flags (usually 0x000C). Probably controls loops.Bit 0 : Anim type, 0=APP_TIME 1=APP_INITBit 1-2 : Cycle type 00=Loop 01=Reverse 10=LoopBit 3 : ActiveBit 4 : Play backwards

frequency

Frequency (is usually 1.0).

next_controller

Index of the next controller.

phase

Phase (usually 0.0).

start_time

Controller start time.

stop_time

Controller stop time.

target

Controller target (object index of the first controllable ancestor of this object).

unknown_integer

Unknown integer.

class NifFormat.NiTransformController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiKeyframeController

NiTransformController replaces the NiKeyframeController.

class NifFormat.NiTransformData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiKeyframeData

Mesh animation keyframe data.

class NifFormat.NiTransparentProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Unknown

unknown

Unknown.

class NifFormat.NiTriShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriBasedGeom

A shape node that refers to singular triangle data.

class NifFormat.NiTriShapeData(template=None, argument=None, parent=None)

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() # stripifier keeps geometry but nothing else
[[0, 2, 1, 3], [2, 4, 3]]
>>> block.get_triangles()
[(0, 2, 1), (1, 2, 3), (2, 4, 3)]
class NifFormat.NiTriShapeSkinController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Old version of skinning instance.

bone_data

Contains skin weight data for each node that this skin is influenced by.

bones

List of all armature bones.

num_bones

The number of node bones referenced as influences.

vertex_counts

The number of vertex weights stored for each bone.

class NifFormat.NiTriStrips(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTriBasedGeom

A shape node that refers to data organized into strips of triangles

class NifFormat.NiTriStripsData(template=None, argument=None, parent=None)

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)]
class NifFormat.NiUVController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Time controller for texture coordinates.

data

Texture coordinate controller data index.

unknown_short

Always 0?

class NifFormat.NiUVData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Texture coordinate data.

uv_groups

Four UV data groups. Appear to be U translation, V translation, U scaling/tiling, V scaling/tiling.

class NifFormat.NiVectorExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Extra vector data.

unknown_float

Not sure whether this comes before or after the vector data.

vector_data

The vector data.

class NifFormat.NiVertWeightsExtraData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiExtraData

Not used in skinning.Unsure of use - perhaps for morphing animation or gravity.

num_bytes

Number of bytes in this data object.

num_vertices

Number of vertices.

weight

The vertex weights.

class NifFormat.NiVertexColorProperty(template=None, argument=None, parent=None)

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.

flags

Property flags. Appears to be unused until 20.1.0.3.Bits 0-2: UnknownBit 3: Lighting Mode?Bits 4-5: Vertex Mode?

lighting_mode

The light mode. In Flags from 20.1.0.3 on.

vertex_mode

Determines how vertex and material colors are mixed.related gl function: glColorMaterialIn Flags from version 20.1.0.3 onwards.

class NifFormat.NiVisController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiBoolInterpController

Time controller for visibility.

data

Visibility controller data object index.

class NifFormat.NiVisData(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiObject

Visibility data for a controller.

keys

The visibility keys.

num_keys

The number of visibility keys that follow.

class NifFormat.NiWireframeProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

Unknown.

flags

Property flags.0 - Wireframe Mode Disabled1 - Wireframe Mode Enabled

class NifFormat.NiZBufferProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiProperty

This Property controls the Z buffer (OpenGL: depth buffer).

flags

Bit 0 enables the z testBit 1 controls wether the Z buffer is read only (0) or read/write (1)

function

Z-Test function (see: glDepthFunc). In Flags from 20.1.0.3 on.

exception NifFormat.NifError

Bases: exceptions.Exception

Standard nif exception class.

class NifFormat.NodeGroup(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A group of NiNodes references.

nodes

The list of NiNode references.

num_nodes

Number of node references that follow.

class NifFormat.OblivionColFilter(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Oblivion’s ColFilter property for Havok.

col_filter

The first bit sets the LINK property and controls whether this body is physically linked to others. The next bit turns collision off. Then, the next bit sets the SCALED property in Oblivion. The next five bits make up the number of this part in a linked body list.

layer

Sets mesh color in Oblivion Construction Set.

unknown_short

Unknown.

class NifFormat.OblivionLayer(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Sets mesh color in Oblivion Construction Set. Anything higher than 57 is also null.

class NifFormat.OblivionSubShape(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Havok Information for packed TriStrip shapes.

col_filter

The first bit sets the LINK property and controls whether this body is physically linked to others. The next bit turns collision off. Then, the next bit sets the SCALED property in Oblivion. The next five bits make up the number of this part in a linked body list.

layer

Sets mesh color in Oblivion Construction Set.

material

The material of the subshape.

num_vertices

The number of vertices that form this sub shape.

unknown_short

Unknown. Perhaps the vertex wielding type?

class NifFormat.OldSkinData(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Used to store skin weights in NiTriShapeSkinController.

unknown_vector

Unknown. Perhaps some sort of offset?

vertex_index

The index of the vertex that this weight applies to.

vertex_weight

The amount that this bone affects the vertex.

class NifFormat.Particle(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

particle array entry

lifespan

Maximum age of the particle.

lifetime

The particle’s age.

timestamp

Timestamp of the last update.

unknown_short

Unknown short

unknown_vector

Unknown

velocity

Particle velocity

vertex_id

Particle/vertex index matches array index

class NifFormat.ParticleDesc(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Particle Description.

translation

Unknown.

unknown_float_1

Unknown.

unknown_float_2

Unknown.

unknown_float_3

Unknown.

unknown_floats_1

Unknown.

unknown_int_1

Unknown.

class NifFormat.PixelFormat(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Specifies the pixel format used by the NiPixelData object to store a texture.

class NifFormat.PixelLayout(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

An unsigned 32-bit integer, describing the color depth of a texture.

class NifFormat.Polygon(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Two dimensional screen elements.

num_triangles

Number of faces in this polygon

num_vertices

Number of vertices in this polygon

triangle_offset

Triangle offset in shape

vertex_offset

Vertex Offset

class NifFormat.Ptr(**kwargs)

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.

class NifFormat.QuatKey(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A special version of the key type used for quaternions. Never has tangents.

tbc

The TBC of the key.

time

Time the key applies.

value

Value of the key.

class NifFormat.Quaternion(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A quaternion.

w

The w-coordinate.

x

The x-coordinate.

y

The y-coordinate.

z

The z-coordinate.

class NifFormat.QuaternionXYZW(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A quaternion as it appears in the havok objects.

w

The w-coordinate.

x

The x-coordinate.

y

The y-coordinate.

z

The z-coordinate.

class NifFormat.Ref(**kwargs)

Bases: pyffi.object_models.xml.basic.BasicBase

Reference to another block.

Fix block links.

replace_global_node(oldbranch, newbranch, edge_filter=(True, True))
>>> 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(stream, data)

Write block reference.

class NifFormat.Region(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A range of indices, which make up a region (such as a submesh).

class NifFormat.RootCollisionNode(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiNode

Morrowind-specific node for collision mesh.

class NifFormat.ShaderTexDesc(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

An extended texture description for shader textures.

is_used

Is it used?

map_index

Map Index

texture_data

The texture data.

class NifFormat.ShortString(**kwargs)

Bases: pyffi.object_models.xml.basic.BasicBase

Another type for strings.

class NifFormat.SizedString(**kwargs)

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()
>>> from pyffi.object_models import FileFormat
>>> data = FileFormat.Data()
>>> 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, data)
>>> str(s)
'abcdefg'
>>> if f.seek(0): pass # ignore result for py3k
>>> s.set_value('Hi There')
>>> s.write(f, data)
>>> if f.seek(0): pass # ignore result for py3k
>>> m = SizedString()
>>> m.read(f, data)
>>> str(m)
'Hi There'
get_hash(data=None)

Return a hash value for this string.

Returns:An immutable object that can be used as a hash.
get_size(data=None)

Return number of bytes this type occupies in a file.

Returns:Number of bytes.
get_value()

Return the string.

Returns:The stored string.
read(stream, data)

Read string from stream.

Parameters:stream (file) – The stream to read from.
set_value(value)

Set string to C{value}.

Parameters:value (str) – The value to assign.
write(stream, data)

Write string to stream.

Parameters:stream (file) – The stream to write to.
class NifFormat.SkinShape(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Reference to shape and skin instance.

shape

The shape.

skin_instance

Skinning instance for the shape?

class NifFormat.SkinShapeGroup(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Unknown.

First link is a NiTriShape object.Second link is a NiSkinInstance object.

Counts unknown.

class NifFormat.SkinWeight(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A weighted vertex.

index

The vertex index, in the mesh.

weight

The vertex weight - between 0.0 and 1.0

class NifFormat.SkyShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific node? Found in Fallout3

file_name

The texture.

unknown_int_4

Unknown

unknown_int_5

Unknown

class NifFormat.SolverDeactivation(**kwargs)

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.

class NifFormat.SphereBV(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A sphere.

center

The sphere’s center.

radius

The sphere’s radius.

class NifFormat.StencilAction(**kwargs)

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.

class NifFormat.StencilCompareMode(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

This enum contains the options for doing stencil buffer tests.

NifFormat.StringIndex

alias of UInt

class NifFormat.StringOffset(**kwargs)

Bases: pyffi.object_models.common.Int

This is just an integer with -1 as default value.

class NifFormat.SymmetryType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Determines symetry type used by NiPSysBombModifier.

class NifFormat.SyncPoint(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Specifies the time when an application must syncronize for some reason.

class NifFormat.TBC(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Tension, bias, continuity.

b

Bias.

c

Continuity.

t

Tension.

class NifFormat.TallGrassShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific node.

file_name

Texture file name

class NifFormat.TargetColor(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Used by NiPoint3InterpControllers to select which type of color in the controlled object that will be animated.

class NifFormat.TexClampMode(**kwargs)

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.

class NifFormat.TexDesc(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

Texture description.

center_offset

The offset from the origin?

clamp_mode

0=clamp S clamp T, 1=clamp S wrap T, 2=wrap S clamp T, 3=wrap S wrap T

filter_mode

0=nearest, 1=bilinear, 2=trilinear, 3=..., 4=..., 5=...

flags

Texture mode flags; clamp and filter mode stored in upper byte with 0xYZ00 = clamp mode Y, filter mode Z.

has_texture_transform

Determines whether or not the texture’s coordinates are transformed.

ps_2_k

PS2 only; from the Freedom Force docs,”The K value is used as an offset into the mipmap levels and can range from -2047 to 2047. Positive values push the mipmap towards being blurry and negative values make the mipmap sharper.”-75 for most v4.0.0.2 meshes.

ps_2_l

PS2 only; from the Freedom Force docs,”L values can range from 0 to 3 and are used to specify how fast a texture gets blurry”.

source

NiSourceTexture object index.

tiling

The number of times the texture is tiled in each direction?

transform_type

The texture transform type? Doesn’t seem to do anything.

translation

The amount to translate the texture coordinates in each direction?

unknown_1

Unknown, 0 or 0x0101?

unknown_short

Unknown, seems to always be 1

uv_set

The texture coordinate set in NiGeometryData that this texture slot will use.

w_rotation

2D Rotation of texture image around third W axis after U and V.

class NifFormat.TexFilterMode(**kwargs)

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.

class NifFormat.TexSource(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A texture source.

file_name

The original source filename of the image embedded by the referred NiPixelData object.

pixel_data

Pixel data object index.

unknown_byte

Unknown.

Unknown.

use_external

Is the texture external?

class NifFormat.TexTransform(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

Determines how a NiTextureTransformController animates the UV coordinates.

class NifFormat.TexType(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

The type of texture.

class NifFormat.TileShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderLightingProperty

Bethesda-specific node.

file_name

Texture file name

class NifFormat.Triangle(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

List of three vertex indices.

v_1

First vertex index.

v_2

Second vertex index.

v_3

Third vertex index.

class NifFormat.Vector4(template=None, argument=None, parent=None)

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
class NifFormat.VelocityType(**kwargs)

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.

class NifFormat.VertMode(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

An unsigned 32-bit integer, which describes how to apply vertex colors.

class NifFormat.VolumetricFogShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific node.

class NifFormat.WaterShaderProperty(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.BSShaderProperty

Bethesda-specific node? Found in Fallout3

class NifFormat.ZCompareMode(**kwargs)

Bases: pyffi.object_models.xml.enum.EnumBase

This enum contains the options for doing z buffer tests.

class NifFormat.bhkAabbPhantom(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkShapePhantom

Bethesda-specific node.

class NifFormat.bhkBlendCollisionObject(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkCollisionObject

Unknown.

unknown_float_1

Blending parameter?

unknown_float_2

Another blending parameter?

class NifFormat.bhkBlendController(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiTimeController

Unknown. Is apparently only used in skeleton.nif files.

unknown_int

Seems to be always zero.

class NifFormat.bhkBreakableConstraint(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkConstraint

Bethesda-Specific node.

unknown_short_1

Unknown

class NifFormat.bhkBvTreeShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkShape

A tree-like Havok data structure stored in an assembly-like binary code?

class NifFormat.bhkCollisionObject(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkNiCollisionObject

Havok related collision object?

class NifFormat.bhkConvexListShape(template=None, argument=None, parent=None)

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.

material

The shape’s material.

num_sub_shapes

The number of sub shapes referenced.

sub_shapes

List of shapes.

unknown_byte_1

Unknown Flag

unknown_float_1

Unknown Flag

unknown_floats

Unknown. Set to (0.0,0.0,-0.0,0.0,0.0,-0.0), where -0.0 is 0x80000000 in hex.

class NifFormat.bhkConvexShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkSphereRepShape

A havok shape.

class NifFormat.bhkConvexTransformShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkTransformShape

A convex transformed shape?

class NifFormat.bhkEntity(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkWorldObject

A havok node, describes physical properties.

class NifFormat.bhkHingeConstraint(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkConstraint

A hinge constraint.

hinge

Hinge constraing.

class NifFormat.bhkLiquidAction(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkSerializable

Bethesda-specific node.

unknown_float_1

Unknown Flag

unknown_float_2

Unknown Flag

unknown_float_3

Unknown Flag

unknown_float_4

Unknown Flag

unknown_int_1

Unknown Flag

unknown_int_2

Unknown Flag

unknown_int_3

Unknown Flag

class NifFormat.bhkNiCollisionObject(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.NiCollisionObject

Havok related collision object?

body

Links to the collision object data

flags

Set to 1 for most objects, and to 41 for animated objects (OL_ANIM_STATIC). Bits: 0=Active 2=Notify 3=Set Local 6=Reset.

class NifFormat.bhkOrientHingedBodyAction(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkSerializable

Bethesda-Specific node.

class NifFormat.bhkPCollisionObject(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkNiCollisionObject

Unknown.

class NifFormat.bhkPhantom(template=None, argument=None, parent=None)

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.

class NifFormat.bhkPrismaticConstraint(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkConstraint

A prismatic constraint.

friction

Friction.

max_distance

Describe the max distance the object is able to travel.

min_distance

Describe the min distance the object is able to travel.

pivot_a

Pivot.

pivot_b

Pivot in B coordinates.

plane_a

Plane normal. Describes the plane the object is able to move on.

plane_b

Plane normal. Describes the plane the object is able to move on in B coordinates.

rotation_a

Rotation axis.

rotation_b

Rotation axis.

rotation_matrix_a

4x4 rotation matrix, rotates the child entity.

sliding_a

Describes the axis the object is able to travel along. Unit vector.

sliding_b

Describes the axis the object is able to travel along in B coordinates. Unit vector.

unknown_byte_1

Unknown. Do not set this to anything over 0 as it will crash the game.

class NifFormat.bhkRigidBodyT(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkRigidBody

Unknown.

class NifFormat.bhkSPCollisionObject(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkPCollisionObject

Unknown.

class NifFormat.bhkSerializable(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkRefObject

Havok objects that can be saved and loaded from disk?

class NifFormat.bhkShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkSerializable

A Havok Shape?

class NifFormat.bhkShapeCollection(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkShape

Havok collision object that uses multiple shapes?

class NifFormat.bhkShapePhantom(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkPhantom

A Havok phantom that uses a Havok shape object for its collision volume instead of just a bounding box.

class NifFormat.bhkSimpleShapePhantom(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkShapePhantom

Unknown shape.

unknown_float

Unknown.

unknown_floats_2

Unknown. (1,0,0,0,0) x 3.

unkown_floats

Unknown.

class NifFormat.bhkSphereRepShape(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkShape

A havok shape, perhaps with a bounding sphere for quick rejection in addition to more detailed shape data?

material

The shape’s material.

radius

The radius of the sphere that encloses the shape.

class NifFormat.bhkStiffSpringConstraint(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkConstraint

A spring constraint.

length

Length.

pivot_a

Pivot A.

pivot_b

Pivot B.

class NifFormat.bhkWorldObject(template=None, argument=None, parent=None)

Bases: pyffi.formats.nif.bhkSerializable

Havok objects that have a position in the world?

col_filter

The first bit sets the LINK property and controls whether this body is physically linked to others. The next bit turns collision off. Then, the next bit sets the SCALED property in Oblivion. The next five bits make up the number of this part in a linked body list.

layer

Sets mesh color in Oblivion Construction Set.

shape

Link to the body for this collision object.

unknown_short

Unknown.

class NifFormat.bool(**kwargs)

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
NifFormat.byte

alias of UByte

NifFormat.char

alias of Char

NifFormat.float

alias of Float

class NifFormat.hkTriangle(template=None, argument=None, parent=None)

Bases: pyffi.object_models.xml.struct_.StructBase

A triangle with extra data used for physics.

normal

This is the triangle’s normal.

triangle

The triangle.

welding_info

Additional havok information on how triangles are welded.

NifFormat.int

alias of Int

NifFormat.short

alias of Short

NifFormat.uint

alias of UInt

NifFormat.ulittle32

alias of ULittle32

NifFormat.ushort

alias of UShort

static NifFormat.version_number(version_str)

Converts version string into an integer.

Parameters:version_str (str) – The version string.
Returns:A version integer.
>>> hex(NifFormat.version_number('3.14.15.29'))
'0x30e0f1d'
>>> hex(NifFormat.version_number('1.2'))
'0x1020000'
>>> hex(NifFormat.version_number('3.03'))
'0x3000300'
>>> hex(NifFormat.version_number('NS'))
'0xa010000'

Regression tests

These tests are used to check for functionality and bugs in the library. They also provide code examples which you may find useful.

Read a NIF file

>>> 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()

Parse all NIF files in a directory tree

>>> 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/nds.nif
reading tests/nif/neosteam.nif
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_cleanstringpalette.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_grid_128x128.nif
reading tests/nif/test_grid_64x64.nif
reading tests/nif/test_mopp.nif
reading tests/nif/test_opt_collision_complex_mopp.nif
reading tests/nif/test_opt_collision_mopp.nif
reading tests/nif/test_opt_collision_packed.nif
reading tests/nif/test_opt_collision_to_boxshape.nif
reading tests/nif/test_opt_collision_to_boxshape_notabox.nif
reading tests/nif/test_opt_collision_unpacked.nif
reading tests/nif/test_opt_delunusedbones.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_grid_layout.nif
reading tests/nif/test_opt_mergeduplicates.nif
reading tests/nif/test_opt_vertex_cache.nif
reading tests/nif/test_opt_zeroscale.nif
reading tests/nif/test_skincenterradius.nif
reading tests/nif/test_vertexcolor.nif

Create a NIF model from scratch and write to file

>>> 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()

Get list of versions and games

>>> for vnum in sorted(NifFormat.versions.values()):
...     print('0x%08X' % vnum) 
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
0x14060500
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)) 
? 0x0A000103
Atlantica 0x14020008
Axis and Allies 0x0A010000
Bully SE 0x14030009
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 0x0A010000
Empire Earth III 0x14020007 0x14020008
Entropia Universe 0x0A010000
Epic Mickey 0x14060500
Fallout 3 0x14020007
Freedom Force 0x04000000 0x04000002
Freedom Force vs. the 3rd Reich 0x0A010000
Howling Sword 0x14030009
Kohan 2 0x0A010000
KrazyRain 0x14050000 0x14060000
Lazeska 0x14030009
Loki 0x0A020000
Megami Tensei: Imagine 0x14010003
Morrowind 0x04000002
NeoSteam 0x0A010000
Oblivion 0x0303000D 0x0A000100 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

Reading an unsupported nif file

>>> stream = open('tests/nif/invalid.nif', 'rb')
>>> data = NifFormat.Data()
>>> data.inspect(stream) # the file seems ok on inspection
>>> data.read(stream) 
Traceback (most recent call last):
    ...
ValueError: ...
>>> stream.close()

Template types

>>> 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'

Strings

>>> 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(None):
...     print(extrastr.decode("ascii"))
start
end