HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
POP_ContextData Class Reference

#include <POP_ContextData.h>

+ Inheritance diagram for POP_ContextData:

Public Member Functions

 POP_ContextData (const char *owner)
 
virtual ~POP_ContextData (void)
 
const char * getName () const
 
void copyFrom (const POP_ContextData &data, GU_Detail *gdp=NULL)
 
void cook (OP_Context &context)
 cook() is used to perform cooking on the POP specified by myCookPOP. More...
 
void cookGuide (OP_Context &context)
 
void reset (POP_Node *pop, GU_Detail *gdp, const char *init, bool keepgeo, unsigned seed, bool solveimmediately)
 
void frameReset (void)
 
void offsetReset (void)
 offsetReset() resets the attribute offsets. More...
 
void recacheOffset (void)
 
void cacheMissingInternalAttributes ()
 
GU_DetailgetDisplayDetail (void)
 
void setDisplayToMyGdp ()
 
float random (void)
 
float randomSample (void)
 
unsigned getRandomSeed () const
 
GU_DetailgetDetail (void) const
 
void cacheDetail (POP_Node *node)
 
void addToParticleList (GEO_PrimParticle *part, POP_Node *pop, int idx)
 
void clearParticleLists ()
 
void setRefDetail (GU_Detail *gdp)
 
int getRuleSuppression ()
 
void setRuleSuppression (int suppress)
 
POP_ParticleListgetParticleList (void)
 
int isGuideOnly (void) const
 
int nextID (void)
 
void bumpNumParticles (int delta)
 
int allowBirth (void)
 allowBirth() returns whether a new particle can be born. More...
 
void getInputGeo (UT_String &path, int index) const
 
void setInputGeo (const UT_String &path, int index)
 
void appendGuide (POP_Node *, const GU_DetailHandle &)
 
void setInstanceGuide (POP_Node *, const GU_DetailHandle &)
 
bool getSelectionChanged () const
 
void setSelectionChanged ()
 
void setTime (fpreal time)
 
fpreal getTime () const
 
void setTimeInc (fpreal tinc)
 
fpreal getTimeInc () const
 
Blind Data Management
POP_BlindDatagetBlindData (const POP_Node *pop) const
 
int addBlindData (POP_BlindData *data)
 
POP_BlindDatastealBlindData (const POP_Node *pop)
 
GEO_PrimParticle Management
GEO_PrimParticlegetPrimPart (POP_Node *node)
 
GEO_PrimParticlehasPrimPart (POP_Node *node)
 
POP_NodegetGenerator (GEO_PrimParticle *part) const
 
Event Management
GA_RWAttributeRef getEventAttr (void)
 getEventAttr() returns the event attribute. More...
 
void addEvent (UT_String &events, float t)
 addEvent() signals that an event has occurred. More...
 
void removeEvent (UT_String &events)
 removeEvent() signals that an event is over. More...
 
void clearAllEvents (void)
 clearAllEvents() clears any currently active events. More...
 
POP_Cache Reference Counting

Reference counting, used for caching in POP_Cache (through POPNET_Node) Note that when the count reaches 0, myGdp is deleted along with this, because in the POP_Cache a new gdp is created for each context data.

void incRef ()
 
void decRef ()
 
Cook Control Flags

These flags control how the pop network will cook. They globally turn off various update rules so it is possible to, for example, only perform the velocity update, or only perform the cooking.

bool shouldDoReap () const
 
void setDoReap (bool v)
 
bool shouldDoPrep () const
 
void setDoPrep (bool v)
 
bool shouldDoApplyRules () const
 
void setDoApplyRules (bool v)
 
bool shouldDoCook () const
 
void setDoCook (bool v)
 
bool shouldDoCookFirst () const
 
void setDoCookFirst (bool v)
 
User Local Variables
CH_LocalVariablegetUserVariables (void)
 
const CH_LocalVariablegetUserVariables (void) const
 
GA_RWAttributeRef addUserVariable (const char *name, int tuplesize, GA_StorageClass type, GA_Defaults def, const char *local=0)
 
int isUserVariable (int index)
 
float getUserVariableValue (GEO_PointP ppt, int index, int thread)
 
uint64 getUserVariableSerial () const
 
- Public Member Functions inherited from OP_ContextData
 OP_ContextData ()
 
virtual ~OP_ContextData ()
 

Static Public Member Functions

static POP_ContextDatagetExpressionData (int thread)
 

Public Attributes

float myTime
 
float myTimeInc
 
voidmyUserData
 
int myRemoveUnused
 
OP_NetworkmyXformObj
 
POP_NodemyCookPOP
 
POP_NodemyDisplayPOP
 
int myDoInfoButton
 
int myDoUpdateViewport
 
int myMaxParticles
 
POP_GuideHandleList myOPGuides
 
UT_IntArray myGuidePOPs
 
UT_ValArray< GEO_PointPmyInstancePoints
 
GU_DetailHandle myInstanceOPGuide
 
int myInstanceGuidePOP
 

Friends

class POP_ContextDataHandle
 

Detailed Description

A POP_ContextData encapsulates and caches data necessary to cook a POP network. An instance is typically initialized by the entity that cooks a POP network and passed from POP to POP as the cooking occurs.

The POP_ContextData contains the geometry detail to update during the cook along with many cached attribute offsets.

Definition at line 52 of file POP_ContextData.h.

Constructor & Destructor Documentation

POP_ContextData::POP_ContextData ( const char *  owner)
virtual POP_ContextData::~POP_ContextData ( void  )
virtual

Member Function Documentation

int POP_ContextData::addBlindData ( POP_BlindData data)

Returns 1 if the data was added successfully to the context data. At this point, the context assumes ownership of the data and may delete it from time to time.

void POP_ContextData::addEvent ( UT_String events,
float  t 
)

addEvent() signals that an event has occurred.

void POP_ContextData::addToParticleList ( GEO_PrimParticle part,
POP_Node pop,
int  idx 
)
GA_RWAttributeRef POP_ContextData::addUserVariable ( const char *  name,
int  tuplesize,
GA_StorageClass  type,
GA_Defaults  def,
const char *  local = 0 
)
int POP_ContextData::allowBirth ( void  )

allowBirth() returns whether a new particle can be born.

void POP_ContextData::appendGuide ( POP_Node ,
const GU_DetailHandle  
)

The following method is used to append guide geometry during a cook. The specified GU_DetailHandle must be pointing to a POP_Guide.

void POP_ContextData::bumpNumParticles ( int  delta)
inline

bumpNumParticles() updates the running count of particles in the network.

Definition at line 383 of file POP_ContextData.h.

void POP_ContextData::cacheDetail ( POP_Node node)
void POP_ContextData::cacheMissingInternalAttributes ( )

cacheMissingInternalOffsets() will acquire any attribute offsets from the gdp that it currently has noted as missing.

Note
This method does not affect user attribute offsets.
void POP_ContextData::clearAllEvents ( void  )

clearAllEvents() clears any currently active events.

void POP_ContextData::clearParticleLists ( )
inline

Erases the particle lists. You will need to reset() to rebuild them, but this avoids having dangling pointers to primitives You must clear lists if you will be losing control of the gdp and someone else may delete primitives.

Definition at line 204 of file POP_ContextData.h.

void POP_ContextData::cook ( OP_Context context)

cook() is used to perform cooking on the POP specified by myCookPOP.

void POP_ContextData::cookGuide ( OP_Context context)

cookGuide() is like cook() except that it is used to recook the guide geometry only.

void POP_ContextData::copyFrom ( const POP_ContextData data,
GU_Detail gdp = NULL 
)
void POP_ContextData::decRef ( )
inline

Definition at line 216 of file POP_ContextData.h.

void POP_ContextData::frameReset ( void  )

frameReset() is used to reset some information on a per frame basis. It should be called before an attempt to cook a POP. However, once this is set, any number of calls to cook a POP can be performed assuming the underlying network does not change.

POP_BlindData* POP_ContextData::getBlindData ( const POP_Node pop) const

Return the blind data associated with the POP. If there is no data stored for the pop, a null ptr will be returned.

GU_Detail* POP_ContextData::getDetail ( void  ) const
inline

getDetail() returns the GU_Detail being processed by this POP_ContextData.

Definition at line 173 of file POP_ContextData.h.

GU_Detail* POP_ContextData::getDisplayDetail ( void  )
inline

Definition at line 114 of file POP_ContextData.h.

GA_RWAttributeRef POP_ContextData::getEventAttr ( void  )

getEventAttr() returns the event attribute.

static POP_ContextData* POP_ContextData::getExpressionData ( int  thread)
static

Query the context with respect to which expression functions are to be evaluated.

POP_Node* POP_ContextData::getGenerator ( GEO_PrimParticle part) const

getGenerator() returns the POP_Node that created a particular particle primitive.

void POP_ContextData::getInputGeo ( UT_String path,
int  index 
) const

Query the path to the specified context geometry.

Parameters
[out]pathnode path
[in]index[0 .. MAX_INPUT_GEOS-1]
const char* POP_ContextData::getName ( void  ) const
inline

Definition at line 58 of file POP_ContextData.h.

POP_ParticleList* POP_ContextData::getParticleList ( void  )
inline

Definition at line 257 of file POP_ContextData.h.

GEO_PrimParticle* POP_ContextData::getPrimPart ( POP_Node node)

getPrimPart() returns the particle primitive generated by a particular POP. If this particle doesn't exist already, it creates a new one.

unsigned POP_ContextData::getRandomSeed ( ) const
inline

Definition at line 152 of file POP_ContextData.h.

int POP_ContextData::getRuleSuppression ( )
inline

Globally force the suppression of certain update rules when executing POP_Node::applyRulesToList(). This should be a mask (bitfield) of the relevant PART_STAT_SUPP* flags you want to suppress.

Definition at line 252 of file POP_ContextData.h.

bool POP_ContextData::getSelectionChanged ( ) const
inline

Definition at line 408 of file POP_ContextData.h.

fpreal POP_ContextData::getTime ( ) const
inline

Access the context time

Definition at line 97 of file POP_ContextData.h.

fpreal POP_ContextData::getTimeInc ( ) const
inline

Access the context time

Definition at line 99 of file POP_ContextData.h.

CH_LocalVariable* POP_ContextData::getUserVariables ( void  )
inline

Definition at line 354 of file POP_ContextData.h.

const CH_LocalVariable* POP_ContextData::getUserVariables ( void  ) const
inline

Definition at line 355 of file POP_ContextData.h.

uint64 POP_ContextData::getUserVariableSerial ( ) const
inline

Definition at line 368 of file POP_ContextData.h.

float POP_ContextData::getUserVariableValue ( GEO_PointP  ppt,
int  index,
int  thread 
)
GEO_PrimParticle* POP_ContextData::hasPrimPart ( POP_Node node)

hasPrimPart() returns whether the node already has a particle primitive assigned to it.

void POP_ContextData::incRef ( )
inline

Definition at line 212 of file POP_ContextData.h.

int POP_ContextData::isGuideOnly ( void  ) const
inline

isGuideOnly() returns true when POP_Node::cookPop() implementations should only update the guide geometry.

Definition at line 373 of file POP_ContextData.h.

int POP_ContextData::isUserVariable ( int  index)
inline

Definition at line 363 of file POP_ContextData.h.

int POP_ContextData::nextID ( void  )

nextId() returns the integer ID to assign to the next birthed particle.

Warning
This method increments the internal state and so should only be called when initializing the "id" attribute of a newly birthed particle.
void POP_ContextData::offsetReset ( void  )

offsetReset() resets the attribute offsets.

float POP_ContextData::random ( void  )
inline

random() returns a random number between 0-1. This should be used instead of SYSfastRandom() so that random numbers used within POPs are completely deterministic.

Definition at line 523 of file POP_ContextData.h.

float POP_ContextData::randomSample ( void  )
inline

This uses the same seed as random() but sends the result through a hash... This is slower than random, but has the advantage that succeeding calls produce values that are "more" independent of each other. Specifically, if you sample a cube, you'll get a nice distribution

Definition at line 529 of file POP_ContextData.h.

void POP_ContextData::recacheOffset ( void  )

recacheOffset() will reacquire the attribute offsets from the gdp. This method should be called if the offsets in the detail may have changed, say as that result of a merge operation.

void POP_ContextData::removeEvent ( UT_String events)

removeEvent() signals that an event is over.

void POP_ContextData::reset ( POP_Node pop,
GU_Detail gdp,
const char *  init,
bool  keepgeo,
unsigned  seed,
bool  solveimmediately 
)

reset() is used to completely reset the POP_ContextData. It should be called whenever a restart of the particle system is required.

void POP_ContextData::setDisplayToMyGdp ( )
inline

Definition at line 119 of file POP_ContextData.h.

void POP_ContextData::setDoApplyRules ( bool  v)
inline

Definition at line 242 of file POP_ContextData.h.

void POP_ContextData::setDoCook ( bool  v)
inline

Definition at line 244 of file POP_ContextData.h.

void POP_ContextData::setDoCookFirst ( bool  v)
inline

Definition at line 246 of file POP_ContextData.h.

void POP_ContextData::setDoPrep ( bool  v)
inline

Definition at line 240 of file POP_ContextData.h.

void POP_ContextData::setDoReap ( bool  v)
inline

Definition at line 238 of file POP_ContextData.h.

void POP_ContextData::setInputGeo ( const UT_String path,
int  index 
)

Set the path to the specified context geometry.

Parameters
[in]pathnode path
[in]index[0 .. MAX_INPUT_GEOS-1]
void POP_ContextData::setInstanceGuide ( POP_Node ,
const GU_DetailHandle  
)

The following method is used to specify the instance guide geometry during a cook. The specified GU_DetailHandle must be pointing to a POP_Guide.

void POP_ContextData::setRefDetail ( GU_Detail gdp)
inline

Definition at line 230 of file POP_ContextData.h.

void POP_ContextData::setRuleSuppression ( int  suppress)
inline

Globally force the suppression of certain update rules when executing POP_Node::applyRulesToList(). This should be a mask (bitfield) of the relevant PART_STAT_SUPP* flags you want to suppress.

Definition at line 254 of file POP_ContextData.h.

void POP_ContextData::setSelectionChanged ( )
inline

Definition at line 410 of file POP_ContextData.h.

void POP_ContextData::setTime ( fpreal  time)
inline

Access the context time

Definition at line 96 of file POP_ContextData.h.

void POP_ContextData::setTimeInc ( fpreal  tinc)
inline

Access the context time

Definition at line 98 of file POP_ContextData.h.

bool POP_ContextData::shouldDoApplyRules ( ) const
inline

Definition at line 241 of file POP_ContextData.h.

bool POP_ContextData::shouldDoCook ( ) const
inline

Definition at line 243 of file POP_ContextData.h.

bool POP_ContextData::shouldDoCookFirst ( ) const
inline

Definition at line 245 of file POP_ContextData.h.

bool POP_ContextData::shouldDoPrep ( ) const
inline

Definition at line 239 of file POP_ContextData.h.

bool POP_ContextData::shouldDoReap ( ) const
inline

Definition at line 237 of file POP_ContextData.h.

POP_BlindData* POP_ContextData::stealBlindData ( const POP_Node pop)

Returns the blind data for the pop and gives up any responsiblity or ownership of the data.

Friends And Related Function Documentation

friend class POP_ContextDataHandle
friend

Definition at line 519 of file POP_ContextData.h.

Member Data Documentation

POP_Node* POP_ContextData::myCookPOP

Definition at line 427 of file POP_ContextData.h.

POP_Node* POP_ContextData::myDisplayPOP

Definition at line 428 of file POP_ContextData.h.

int POP_ContextData::myDoInfoButton

Definition at line 429 of file POP_ContextData.h.

int POP_ContextData::myDoUpdateViewport

Definition at line 430 of file POP_ContextData.h.

UT_IntArray POP_ContextData::myGuidePOPs

Definition at line 438 of file POP_ContextData.h.

int POP_ContextData::myInstanceGuidePOP

Definition at line 442 of file POP_ContextData.h.

GU_DetailHandle POP_ContextData::myInstanceOPGuide

Definition at line 441 of file POP_ContextData.h.

UT_ValArray<GEO_PointP> POP_ContextData::myInstancePoints

Definition at line 440 of file POP_ContextData.h.

int POP_ContextData::myMaxParticles

Definition at line 431 of file POP_ContextData.h.

POP_GuideHandleList POP_ContextData::myOPGuides

Definition at line 437 of file POP_ContextData.h.

int POP_ContextData::myRemoveUnused

Definition at line 425 of file POP_ContextData.h.

float POP_ContextData::myTime

Definition at line 422 of file POP_ContextData.h.

float POP_ContextData::myTimeInc

Definition at line 423 of file POP_ContextData.h.

void* POP_ContextData::myUserData

Definition at line 424 of file POP_ContextData.h.

OP_Network* POP_ContextData::myXformObj

Definition at line 426 of file POP_ContextData.h.


The documentation for this class was generated from the following file: