Wouldn't this endEdit be invalid?
endEditCP(childP->getParent(), Node::ChildrenFieldMask);
After the child is subtracted, childP->getParent() should not be able
to return the correct node. I would test this theory myself, except
I'm working in Windows without OpenSG source code right now :P
On 12/6/05, Dirk Reiners <[EMAIL PROTECTED]> wrote:
>
> Hi Terry,
>
> On Tue, 2005-12-06 at 13:33 -0600, Terry Welsh wrote:
> > 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);
>
> hm, that's confusing. That's pretty exactly what addChild does
> internally anyway:
>
> void Node::addChild(const NodePtr &childP)
> {
> ...
> // already somebody else's child?
> if(childP->getParent() != NullFC)
> {
> beginEditCP(childP->getParent(), Node::ChildrenFieldMask);
> childP->getParent()->subChild(childP);
> endEditCP(childP->getParent(), Node::ChildrenFieldMask);
> }
>
> _mfChildren.push_back(childP);
>
> beginEditCP(childP, Node::ParentFieldMask);
> {
> childP->setParent(getPtr());
> }
> endEditCP (childP, Node::ParentFieldMask);
> ...
> }
>
> I'm a little lost, anybody else have an idea?
>
> 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