Re: pfSwitch Node

New Message Reply Date view Thread view Subject view Author view

Jim Helman (jimh++at++surreal)
Tue, 07 Jun 94 20:58:21 -0700


I don't think FLT supports Performer's notion of switch
nodes, but replacing one is fairly straightforward.

rgds,

-jim helman

jimh++at++surreal.asd.sgi.com
415/390-1151

    pfSwitch *Group2Switch(pfGroup *grp)
    {
            int i, numPar, numChild;
            pfSwitch *sw;
            sw = pfNewSwitch();
            numPar = pfGetNumParents(grp);
            numChild = pfGetNumChild(grp);

            /* add group's children to switch, in same order */
            for (i = 0 ; i < numChild ; i++)
            {
                    pfNode *child;
                    child = pfGetChild(grp, i);
                    pfAddChild(sw, child);
            }

            /* remove children from group */
            for (i = 0 ; i < numChild ; i++)
            {
                    pfNode *child;
                    child = pfGetChild(grp, i);
                    pfRemoveChild(grp, child);
            }

            /* replace group with switch under parent */
            for (i = 0 ; i < numPar ; i++)
            {
                    pfGroup *par;
                    par = pfGetParent(grp, i);
                    pfReplaceChild(par, grp, sw);
            }
            pfDelete(grp);
            return sw;
    }


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:50:19 PDT

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