Package pyffi :: Package spells :: Package nif :: Module optimize :: Class SpellOptimizeCollisionBox
[hide private]
[frames] | no frames]

Class SpellOptimizeCollisionBox

source code

object --+        
         |        
     Spell --+    
             |    
      NifSpell --+
                 |
                SpellOptimizeCollisionBox

Optimize collision geometries by converting shapes to primitive boxes where appropriate.
Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Initialize the spell data.
source code
bool
datainspect(self)
This is called after pyffi.object_models.FileFormat.Data.inspect has been called, and before pyffi.object_models.FileFormat.Data.read is called.
source code
bool
branchinspect(self, branch)
Like _branchinspect, but for customization: can be overridden to perform an extra inspection (the default implementation always returns True).
source code
 
get_box_shape(self, shape)
Check if the given shape is has a box shape.
source code
bool
branchentry(self, branch)
Optimize a vertex based collision block: - remove duplicate vertices - rebuild triangle indice and welding info - update MOPP data if applicable.
source code

Inherited from NifSpell: inspectblocktype

Inherited from NifSpell (private): _datainspect

Inherited from Spell: branchexit, dataentry, dataexit, recurse

Inherited from Spell (private): _branchinspect

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

Class Methods [hide private]

Inherited from Spell: get_toast_stream, toastentry, toastexit

Class Variables [hide private]
  SPELLNAME = 'opt_collisionbox'
A str describing how to refer to the spell from the command line.
  READONLY = False
A bool which determines whether the spell is read only or not.
  VERTEXPRECISION = 3

Inherited from Spell: changed, data, stream, toaster

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 
Initialize the spell data.
Parameters:
  • data - The file data.
  • stream - The file stream.
  • toaster - The toaster this spell is called from (optional).
Overrides: object.__init__
(inherited documentation)

datainspect(self)

source code 
This is called after pyffi.object_models.FileFormat.Data.inspect has been called, and before pyffi.object_models.FileFormat.Data.read is called. Override this function for customization.
Returns: bool
True if the file must be processed, False otherwise.
Overrides: Spell.datainspect
(inherited documentation)

branchinspect(self, branch)

source code 
Like _branchinspect, but for customization: can be overridden to perform an extra inspection (the default implementation always returns True).
Parameters:
  • branch - The branch to check.
Returns: bool
True if the branch must be processed, False otherwise.
Overrides: Spell.branchinspect
(inherited documentation)

get_box_shape(self, shape)

source code 

Check if the given shape is has a box shape. If so, return an equivalent (bhkConvexTransformShape +) bhkBoxShape.

Shape should be a bhkPackedNiTriStripsShape or a bhkNiTriStripsShape.

branchentry(self, branch)

source code 
Optimize a vertex based collision block: - remove duplicate vertices - rebuild triangle indice and welding info - update MOPP data if applicable.
Parameters:
  • branch - The branch to cast the spell on.
Returns: bool
True if the children must be processed, False otherwise.
Overrides: Spell.branchentry