i've gont a problem with my particle op i've created.
when i connect it to a normal “location” pop everything works fine and fancy, but when i connect it to a source pop which gets the emitting geometry from an outside sop, it crashes without warning.
so i've started debugging the whole mess and found out that instead of iterating through the particle primitives created with the location pop, not a single particle primitive is available when my pop its connected to the source pop.
here i got some codesnippets
OP_ERROR
POP_FrequenzTest::cookPop (OP_Context &context)
{
float t = context.myTime;
POP_ContextData* data = (POP_ContextData*) context.myData;
float timeInc = data->myTimeInc;
GEO_PrimParticle* part;
GEO_ParticleVertex* pvtx;
UT_Matrix4 xform;
UT_Vector3 origin;
UT_Vector3 dir;
UT_Vector3 gravity;
float radius;
float length;
POP_FParam strength;
POP_FParam mass;
int massOffset;
UT_String sourceName;
const GB_PointGroup *sourceGroup = NULL;
GU_PrimTubeParms tubeParms;
GU_PrimTubeParms cubeParms;
GU_CapOptions caps;
UT_Interrupt* boss = UTgetInterrupt();
this->pConnAttribID = data->getDetail()->addPointAttrib(“connections”,sizeof(hou_particleConnections),GB_ATTRIB_MIXED,0);
// Add this to the list of guide geometries to show in the POP_ContextData.
if (doUpdateViewport(data))
{
data->myOPGuides.append(myGuide);
data->myGuidePOPs.append(this);
}
if (lockInputs(context) >= UT_ERROR_ABORT) return(error());
setupDynamicVars(data);
// Build the particle list that this POP needs to process.
if (buildParticleList(context) >= UT_ERROR_ABORT)
{
unlockInputs();
myCurrPt = NULL;
return error();
}
if (!checkActivation(data, (POP_FParam) &POP_FrequenzTest::ACTIVATE)) // Checks if Node is Active
{
unlockInputs();
myCurrPt = NULL;
return
}
if (this->getActiveParticle(context)>= UT_ERROR_ABORT)
{
unlockInputs();
myCurrPt = NULL;
return error();
}
}
and here's the
OP_ERROR POP_FrequenzTest::getActiveParticle(OP_Context &context)
{
POP_ContextData* data = (POP_ContextData*) context.myData;
GEO_ParticleVertex* pvtx;
GEO_PrimParticle* part;
UT_String sourceName;
activeParticleSourceGroup = NULL;
this->SOURCE(sourceName);
if (sourceName.isstring())
{
activeParticleSourceGroup = parsePointGroups((const char*)sourceName,data->getDetail());
if (!activeParticleSourceGroup)
{
addError(POP_BAD_GROUP, sourceName);
{
unlockInputs();
// Reset this so something is defined for UI dialog updates.
myCurrPt = NULL;
return error();
}
}
}
// In order for the local variables to work, we must initialize them.
setupVars(data, activeParticleSourceGroup);
myCurrIter = 0;
if (activeParticleSourceGroup)
{
hou_particleID zaehler_ = 0;
FOR_ALL_GROUP_POINTS(data->getDetail(),activeParticleSourceGroup, myCurrPt)
{
UT_Vector3 *accel_ = (UT_Vector3*)myCurrPt->getAttribData(data->getAccelOffset());
UT_Vector3 *veloc_ = (UT_Vector3*)myCurrPt->getAttribData(data->getVelocityOffset());
UT_Vector4 pos_ = myCurrPt->getPos();
int pID_ = *(int*)myCurrPt->getAttribData(data->getIDOffset());
hou_particleConnections *partConn_
hou_particleConnections*) myCurrPt->getAttribData(this->pConnAttribID);int * state = (int*) myCurrPt->getAttribData(data->getStateOffset());
myCurrIter++;
}
}
else
{
int i=0;
for (part = myParticleList.iterateInit() ;part ; part = myParticleList.iterateNext())
{
for (pvtx = part->iterateInit() ; pvtx ; pvtx = pvtx->next)
{
myCurrPt = pvtx->getPt();
UT_Vector3 *accel_= (UT_Vector3*)myCurrPt->getAttribData(data->getAccelOffset());
UT_Vector3 *veloc_ = (UT_Vector3*)myCurrPt->getAttribData(data->getVelocityOffset());
int *state = (int*)myCurrPt->getAttribData(data->getStateOffset());
UT_Vector4 pos_ = myCurrPt->getPos();
int pID_ = *(int*)myCurrPt->getAttribData(data->getIDOffset());
hou_particleConnections *partConn_ = (hou_particleConnections*) myCurrPt->getAttribData(this->pConnAttribID);
myCurrIter++;
}
}
}
return error();
}
it would be very nice if somebody have a clue why its not workin with a source pop.
thx in advance
Sebastian


