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

Class NiTriBasedGeomData

source code

                  object --+                                
                           |                                
      utils.graph.DetailNode --+                            
                               |                            
          utils.graph.GlobalNode --+                        
                                   |                        
object_models.xml.struct_.StructBase --+                    
                                       |                    
                     NifFormat._NiObject --+                
                                           |                
                          NifFormat.NiObject --+            
                                               |            
                       NifFormat._NiGeometryData --+        
                                                   |        
                            NifFormat.NiGeometryData --+    
                                                       |    
                           NifFormat._NiTriBasedGeomData --+
                                                           |
                                                          NifFormat.NiTriBasedGeomData
Known Subclasses:

Nested Classes [hide private]

Inherited from object_models.xml.struct_.StructBase: __metaclass__

Instance Methods [hide private]
 
is_interchangeable(self, other)
Heuristically checks if two NiTriBasedGeomData blocks describe the same geometry, that is, if they can be used interchangeably in a nif file without affecting the rendering.
source code
 
get_triangle_indices(self, triangles)
Yield list of triangle indices (relative to self.get_triangles()) of given triangles.
source code

Inherited from NiGeometryData: apply_scale, get_vertex_hash_generator, update_center_radius

Inherited from NiObject: find, find_chain, 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 _NiTriBasedGeomData (private): _attrs, _games, _is_template, _names

Inherited from _NiGeometryData (private): _has_links, _has_refs

Inherited from object_models.xml.struct_.StructBase: arg

Properties [hide private]

Inherited from _NiTriBasedGeomData: num_triangles

Inherited from _NiGeometryData: additional_data, bitangents, bs_num_uv_sets, center, compress_flags, consistency_flags, has_normals, has_uv, has_vertex_colors, has_vertices, keep_flags, normals, num_uv_sets, num_vertices, radius, tangents, unknown_13_shorts, unknown_int, uv_sets, vertex_colors, vertices

Inherited from object: __class__

Method Details [hide private]

is_interchangeable(self, other)

source code 
Heuristically checks if two NiTriBasedGeomData blocks describe the same geometry, that is, if they can be used interchangeably in a nif file without affecting the rendering. The check is not fool proof but has shown to work in most practical cases.
Parameters:
  • other (L{NifFormat.NiTriBasedGeomData} (if it has another type then the function will always return False)) - Another geometry data block.
Returns:
True if the geometries are equivalent, False otherwise.
Overrides: NiObject.is_interchangeable

get_triangle_indices(self, triangles)

source code 

Yield list of triangle indices (relative to self.get_triangles()) of given triangles. Degenerate triangles in the list are assigned index None.

>>> from pyffi.formats.nif import NifFormat
>>> geomdata = NifFormat.NiTriShapeData()
>>> geomdata.set_triangles([(0,1,2),(1,2,3),(2,3,4)])
>>> list(geomdata.get_triangle_indices([(1,2,3)]))
[1]
>>> list(geomdata.get_triangle_indices([(3,1,2)]))
[1]
>>> list(geomdata.get_triangle_indices([(2,3,1)]))
[1]
>>> list(geomdata.get_triangle_indices([(1,2,0),(4,2,3)]))
[0, 2]
>>> list(geomdata.get_triangle_indices([(0,0,0),(4,2,3)]))
[None, 2]
>>> list(geomdata.get_triangle_indices([(0,3,4),(4,2,3)])) # doctest: +ELLIPSIS
Traceback (most recent call last):
    ...
ValueError: ...
Parameters:
  • triangles (iterator or list of tuples of three ints) - An iterable of triangles to check.

Class Variable Details [hide private]

_attribute_list

Value:
[<pyffi.object_models.xml.StructAttribute object at 0x2dd11d0>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dd1f10>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dcce50>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dcccd0>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dd9610>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dd9650>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dd9750>,
 <pyffi.object_models.xml.StructAttribute object at 0x2dd9a90>,
...