Allen Bierbaum wrote:

Andreas Zieringer wrote:

Hi Aron,

I am running into a problem using RemoteAspects in OpenSG while changing the graph structure. I start with a graph that looks like the following:

Root -> Light1 -> Light2 -> Scene

When I want to remove the first light from the scene I believe that I should call the following on the client:

OSG::beginEditCP(Light1);
  Light1->subChild(Light2);
OSG::endEditCP(Light1);



this destroys Light2 and its subtree!


It doesn't destroy light2 and subtree. There are other refptr's sitting around that still reference light2 elsewhere. So he can be a little more free about the order of operations here. I suspect that if he used the commands you suggest below we would still have the same problems since it revolves more around how the remote site is processing the change list then any specific order of operations on the local side.

-Allen

The actual code that is being used is:

     OSG::RefPtr<OSG::NodePtr> parent(osg_light_node->getParent());
     OSG::RefPtr<OSG::NodePtr> child(osg_light_node->getChild(0));

     OSG::beginEditCP(osg_light_node);
        parent->subChild(shild);
     OSG::endEditCP(osg_light_node);

     // Replace the specified light node with its child.
     OSG::beginEditCP(parent);
        parent->subChild(osg_light_node);
        parent->addChild(child);
     OSG::endEditCP(parent);

Since we are using RefPtrs, we should not have any problems. Sorry for the confusion, I was trying to keep my example very simple.

-Aron


You could call addRefCP(Light2) before the Light1->subChild(Light2) and subRefCP(Light2) after Root->addChild(Light2)

But I think this should do the trick.

OSG::beginEditCP(Root);
   Root->addChild(Light2);
   Root->subChild(Light1);
OSG::beginEditCP(Root);

Andreas

OSG::beginEditCP(Root);
  Root->subChild(Light1);
  Root->addChild(Light2);
OSG::beginEditCP(Root);

After which my graph would appear like the following. Which results in the reference count of Light1 to go to zero and cause the destruction of the FieldContainer.

Root -> Light2 -> Scene

On the server side I am getting a core dump after Node::invalidateVolume() is called on the Scene node. It appears that Light2 has an invalid FieldContainer Id when calling recursively up the scene graph. I think this is a result of the way that the RemoteAspect packs up the changes before sending them across the network. Looking at the code it appears that RemoteAspect::sendSync() sends all changes in a certain order: created, destroyed, changed, addrefed, and subrefed. I think that my problem is that since both my structure change and my node destruction happen in one sync call. The following would happen on the server side:

destroy Light1
change Light1
change Root
change Scene

Changing the scene would then cause Node::invalidateVolume() to get called on Scene node. While calling up the scene graph I get a FieldContainerId similar to 161249600, which is definitely invalid. My question is then, is there any reason that destroys get sent before changes in RemoteAspect? Also I noticed that you are doing change compression, could you also eliminate all changes for FieldContainers that are being removed?

Thanks for your help,
Aron Bierbaum




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to