More fun with the ISECT process and setUserData()

New Message Reply Date view Thread view Subject view Author view

Jeremy Friesner (jaf++at++chem.ucsd.edu)
Tue, 22 Oct 1996 15:53:11 -0700 (PDT)


Hi Everyone,

A few weeks ago I encountered the Performer bug that caused
pfDCS::getUserData() to return NULL when accessed from the
ISECT process, even after that node had been set using setUserData()
in the APP process.

It turned out the problem was that the setUserData()'s were being
issued before the first call to pfFrame. Due to a bug in Performer,
the setUserData()'s were not being propagated to the ISECT process.
Calling following routine after the first pfFrame() call was suggested
as a work-around:

// must be called AFTER the first pfFrame() call to have an effect!
void fixUserData(pfNode *node)
{
    void *userdata;

    if (node == NULL) return;

    // RE-set the userdata so the ISECT process will see it!
    if (userdata = node->getUserData()) node->setUserData(userdata);

    // recurse to all children of this node
    if (node->isOfType(pfGroup::getClassType()))
    {
         pfGroup * g = (pfGroup *)node;
         int numKids = g->getNumChildren();

         for (int i=0; i<numKids; i++) fixUserData(g->getChild(i));
    }
}

This works fine for scenery that I had generated earlier, but now
I need to add more objects to the scene at various times during
the course of the simulation.

So in the APP process, I do:

myData = new ObjectInfo(); // (ObjectInfo is derived from pfObject)
dcs = new pfDCS;
dcs->setUserData(myData);
myScene->addChild(dcs);

...and the same problem is back. As far as the ISECT process sees
it, the user-data for the newly added dcs is NULL.

I know that the ISECT process gets its own copy of the pfDCS's
(the pointer is different)... what is the mechanism by which
setUserData()'s are propagated from the APP process's scene graph
to the ISECT process's scene graph? An override of pfObject::setUserData(),
perhaps?

Finally, can anyone shed any light on why my setUserData() call is
not being seen by the ISECT process?

Thanks very much,
Jeremy
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:47 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.