Sorry, I don't have a simple program that I can send you.  My code is
too big and ugly.  I believe by begin/end edits are correct, though.

original code:

         OSG::beginEditCP(parent_node);
            parent_node->addChild(child_node);           // Reparent complete
         OSG::endEditCP(parent_node);

new code:

         // Remove child from original parent, if it has one
         OSG::NodePtr cur_parent = child_node->getParent();
         if(OSG::NullFC != cur_parent)
         {
            OSG::beginEditCP(cur_parent);
               cur_parent->subChild(child_node);
            OSG::endEditCP(cur_parent);
         }

         OSG::beginEditCP(parent_node);
            parent_node->addChild(child_node);           // Reparent complete
         OSG::endEditCP(parent_node);



On 12/6/05, Dirk Reiners <[EMAIL PROTECTED]> wrote:
>
>         Hi Terry,
>
> On Tue, 2005-12-06 at 12:22 -0600, Terry Welsh wrote:
> > I found a nasty gotcha associated with moving nodes around and then
> > sending changes over the network.  Since an OSG::Node can only have
> > one parent, if you use Node::addChild(mynode), mynode loses any parent
> > that it had before and gains a new parent.
> >
> > The resulting scene graph looks fine on my local machine, but changes
> > do not propogate correctly to my receiving machine.  I end up with two
> > copies of mynode on the receiving machine.
> >
> > This problem goes away if I explicitly remove mynode from its original
> > parent using subChild before adding it to a new parent.  Would it be
> > possibly to fix this so that the appropriate changes get transmitted
> > to the receiving machine or should I just be more careful with my
> > code?
>
> What do you do in terms of begin/endEdits? The logic is that you need to
> call begin/end on Nodes that you manipulate (i.e. for addChild the Node
> that the child is added to). Other than that it should work, as addChild
> correctly edits the other Nodes. Do you have a code snippet that
> demonstrates the problem?
>
> Thanks
>
>         Dirk
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>


--
Terry Welsh - mogumbo 'at' gmail.com
www.reallyslick.com  |  www.infiscape.com  |  www.vrsource.org


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to