Re: create and destroy pfNodes on the fly

New Message Reply Date view Thread view Subject view Author view

Yair Kurzion (yair++at++polygon.engr.sgi.com)
Fri, 19 Nov 1999 11:55:30 -0800 (PST)


> pfNodes should be created and destroyed on the fly. (Application provides add,
> selection and delete commands.)
>
> Especially, deleting instances fails from time to time.

The only case where pfDelete (pfNode::checkDelete) fails on a valid node is
when the ref-count on this node is non-zero. You can probably debug this by
calling pfGetRef before you call pfDelete and testing for non-zero ref.

> To illustrate what happens I describe the individual parts in the following:
>
> 1. Each model (.flt) is loaded only once. If a certain model is added, the app
> looks into a list of all loaded models (comparing the file names). If requested
> model is absent then it happens a request to the loader which stays in DBase
> process. Loader returns a result after model has been loaded successfully or
> loader has failed. (The last case is not important for this.)
>
> 2. Adding a model happens as follows: Get pfNode *pPfNode from loader, pfNode
> *pPfNodeCopy = pPfNode->clone(0);, add created copy to scenegraph. This works
> like expected.
>
> 3. Deleting a model happens as follows: pfAsyncDelete(pPfNodeCopy); This works
> mostly but fails from time to time. (App mostly doesn't crash but some nodes
> are still existant.)
> I tried pfDelete instead but this let the app crash.

pfAsyncDelete will fail if the parameter is NULL, or if the given memory was
not allocated by Performer (via pfMalloc or 'new' of a performer object).
You can try printing the type name of the object you are trying to delete
by:

    mem -> getClassType() -> getName()

As for pfNode::clone, it will duplicate all internal nodes but leave geometry
un-duplicated. In other words, if you have a pfDCS with a pfGeode under it,
cloning the pfDCS will create two copies of the pfDCS node, both point to the
same pfGeode child. You can pfDelete any one of the pfDCS parents independently,
but you can not delete the pfGeode child until both parents no longer point
to it.

         pfDCS pfDCS
            \ /
             \ /
              \ /
              pfGeode

-yair

-- 
\_________  \_____  \__    \__  \_____         Yair Kurzion
\_________  \_____   \__   \__  \_____         yair++at++sgi.com
       \__     \__   \____\__      \__   http://reality.sgi.com/yair
       \__          \__  \__                Work: (650) 933-6502
       \__          \__   \__               Home: (408) 226-9771
       \__          \__    \__             

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Fri Nov 19 1999 - 11:55:37 PST

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