Package pyffi :: Package formats :: Package nif :: Class NifFormat :: Class bhkPackedNiTriStripsShape
[hide private]
[frames] | no frames]

Class bhkPackedNiTriStripsShape

source code

                  object --+                                            
                           |                                            
      utils.graph.DetailNode --+                                        
                               |                                        
          utils.graph.GlobalNode --+                                    
                                   |                                    
object_models.xml.struct_.StructBase --+                                
                                       |                                
                     NifFormat._NiObject --+                            
                                           |                            
                          NifFormat.NiObject --+                        
                                               |                        
                         NifFormat._bhkRefObject --+                    
                                                   |                    
                              NifFormat.bhkRefObject --+                
                                                       |                
                               NifFormat.bhkSerializable --+            
                                                           |            
                                          NifFormat.bhkShape --+        
                                                               |        
                                    NifFormat.bhkShapeCollection --+    
                                                                   |    
                                NifFormat._bhkPackedNiTriStripsShape --+
                                                                       |
                                                                      NifFormat.bhkPackedNiTriStripsShape

Nested Classes [hide private]

Inherited from object_models.xml.struct_.StructBase: __metaclass__

Instance Methods [hide private]
 
get_mass_center_inertia(self, density=1, solid=True)
Return mass, center, and inertia tensor.
source code
 
get_sub_shapes(self)
Return sub shapes (works for both Oblivion and Fallout 3).
source code
 
add_shape(self, triangles, normals, vertices, layer=0, material=0)
Pack the given geometry.
source code
 
get_vertex_hash_generator(self, vertexprecision=3, subshape_index=None)
Generator which produces a tuple of integers for each vertex to ease detection of duplicate/close enough to remove vertices.
source code
 
get_triangle_hash_generator(self)
Generator which produces a tuple of integers, or None in degenerate case, for each triangle to ease detection of duplicate triangles.
source code

Inherited from bhkRefObject: get_shape_mass_center_inertia

Inherited from NiObject: apply_scale, find, find_chain, is_interchangeable, tree

Inherited from NiObject (private): _validateTree

Inherited from object_models.xml.struct_.StructBase: __init__, __str__, deepcopy, fix_links, get_attribute, get_basic_attribute, get_detail_child_names, get_detail_child_nodes, get_global_child_nodes, get_global_display, get_hash, get_links, get_refs, get_size, get_strings, get_template_attribute, read, replace_global_node, set_attribute, set_basic_attribute, set_template_attribute, write

Inherited from utils.graph.GlobalNode: get_global_child_edge_types, get_global_iterator

Inherited from utils.graph.DetailNode: get_detail_child_edge_types, get_detail_display, get_detail_iterator

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from object_models.xml.struct_.StructBase: get_games, get_versions

Class Variables [hide private]
  _attribute_list = [<pyffi.object_models.xml.StructAttribute ob...

Inherited from bhkSerializable (private): _games, _is_template

Inherited from object_models.xml.struct_.StructBase: arg

Properties [hide private]

Inherited from _bhkPackedNiTriStripsShape: data, num_sub_shapes, scale, sub_shapes, unknown_floats, unknown_floats_2

Inherited from object: __class__

Method Details [hide private]

get_vertex_hash_generator(self, vertexprecision=3, subshape_index=None)

source code 

Generator which produces a tuple of integers for each vertex to ease detection of duplicate/close enough to remove vertices. The precision parameter denote number of significant digits behind the comma.

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

>>> shape = NifFormat.bhkPackedNiTriStripsShape()
>>> data = NifFormat.hkPackedNiTriStripsData()
>>> shape.data = data
>>> shape.num_sub_shapes = 2
>>> shape.sub_shapes.update_size()
>>> data.num_vertices = 3
>>> shape.sub_shapes[0].num_vertices = 2
>>> shape.sub_shapes[1].num_vertices = 1
>>> data.vertices.update_size()
>>> data.vertices[0].x = 0.0
>>> data.vertices[0].y = 0.1
>>> data.vertices[0].z = 0.2
>>> data.vertices[1].x = 1.0
>>> data.vertices[1].y = 1.1
>>> data.vertices[1].z = 1.2
>>> data.vertices[2].x = 2.0
>>> data.vertices[2].y = 2.1
>>> data.vertices[2].z = 2.2
>>> list(shape.get_vertex_hash_generator())
[(0, (0, 100, 200)), (0, (1000, 1100, 1200)), (1, (2000, 2100, 2200))]
>>> list(shape.get_vertex_hash_generator(subshape_index=0))
[(0, 100, 200), (1000, 1100, 1200)]
>>> list(shape.get_vertex_hash_generator(subshape_index=1))
[(2000, 2100, 2200)]
Parameters:
  • vertexprecision (float) - Precision to be used for vertices.
Returns:
A generator yielding a hash value for each vertex.

get_triangle_hash_generator(self)

source code 

Generator which produces a tuple of integers, or None in degenerate case, for each triangle to ease detection of duplicate triangles.

>>> shape = NifFormat.bhkPackedNiTriStripsShape()
>>> data = NifFormat.hkPackedNiTriStripsData()
>>> shape.data = data
>>> data.num_triangles = 6
>>> data.triangles.update_size()
>>> data.triangles[0].triangle.v_1 = 0
>>> data.triangles[0].triangle.v_2 = 1
>>> data.triangles[0].triangle.v_3 = 2
>>> data.triangles[1].triangle.v_1 = 2
>>> data.triangles[1].triangle.v_2 = 1
>>> data.triangles[1].triangle.v_3 = 3
>>> data.triangles[2].triangle.v_1 = 3
>>> data.triangles[2].triangle.v_2 = 2
>>> data.triangles[2].triangle.v_3 = 1
>>> data.triangles[3].triangle.v_1 = 3
>>> data.triangles[3].triangle.v_2 = 1
>>> data.triangles[3].triangle.v_3 = 2
>>> data.triangles[4].triangle.v_1 = 0
>>> data.triangles[4].triangle.v_2 = 0
>>> data.triangles[4].triangle.v_3 = 3
>>> data.triangles[5].triangle.v_1 = 1
>>> data.triangles[5].triangle.v_2 = 3
>>> data.triangles[5].triangle.v_3 = 4
>>> list(shape.get_triangle_hash_generator())
[(0, 1, 2), (1, 3, 2), (1, 3, 2), (1, 2, 3), None, (1, 3, 4)]
Returns:
A generator yielding a hash value for each triangle.

Class Variable Details [hide private]

_attribute_list

Value:
[<pyffi.object_models.xml.StructAttribute object at 0x2dad210>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dad290>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dad310>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dad410>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dad450>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dad510>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dad210>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dad290>,
...