Re: More fun with the ISECT process and setUserData()
rweyrauch++at++camus.paradigmsim.com
Wed, 23 Oct 1996 04:57:17 -0500
On Oct 22, 3:53pm, Jeremy Friesner wrote:
> Subject: More fun with the ISECT process and setUserData()
>
> 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.
>
All pfNodes created in APP do not have their user data propogated to the ISECT
process correctly. Just as for pfNodes created initially, you must reattach
each node's userdata after a pfFrame. Every time you add nodes to the scene
call fixUserData after the next call to pfFrame.
Nodes added to the scene from the DBASE process do not have the userdata
problem.
>
> Thanks very much,
> Jeremy
>-- End of excerpt from Jeremy Friesner
Rick
--
Rick Weyrauch voice: (972) 960-2301
Paradigm Simulation Inc. fax: (972) 960-2303
14900 Landmark Blvd., Suite 400 rweyrauch++at++paradigmsim.com
Dallas TX 75240 www.paradigmsim.com
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2
on Mon Aug 10 1998 - 17:53:48 PDT