Hi Paul,
Thanks for the reply,
> What you have looks basically right, except I don't
> understand why you have:
> ref_ptr<Group> group = new Group;
> switchnode->addChild(group.get());
> That seems unnecessary to the task at hand.
Yes, I had tried a few semi-random things to try to understand
what was happening and inadvertantly included one of them
in my posting. What I should have posted is this:
ref_ptr<Switch> switchnode = new Switch;
string name = node->getName();
switchnode->setName(name);
switchnode->addChild(node);
Group* parent = node->getParent(0);
parent->addChild(switchnode.get());
parent->removeChild(node);
>
> How are you determining that you are getting the wrong
> results? What you
> show as the result seems impossible for the code you've
> posted, as 'parent'
> only adds one child: the switch.
I saved the scenegraph to a file and looked at it.
This is the scene graph before:
Group {
name "mviewConeGroup"
nodeMask 0xffffffff
cullingActive TRUE
num_children 1
Group {
name "multiviewCone1"
nodeMask 0xffffffff
cullingActive TRUE
num_children 1
...
Switch {
name "mviewConeGroup"
nodeMask 0xffffffff
cullingActive TRUE
NewChildDefaultValue 0
ValueList {
0
}
num_children 1
Group {
name "mviewConeGroup_old"
nodeMask 0xffffffff
cullingActive TRUE
}
}
The children of mviewConeGroup (Group2 in the example in my earlier post)
are not under mviewConeGroup_old, as I expected they would be.
Thanks
Jim
>
> Inserting a node above another node is a common task and one that is
> somewhat error-prone to implement. I've often wondered if it
> would make
> sense to have Node methods for insertAbove() and
> insertBelow(). This was a
> feature in PEI VisKit and we made frequent use of it at my
> old employer.
>
> Paul Martz
> Skew Matrix Software LLC
> http://www.skew-matrix.com
> +1 303 859 9466
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce
> negraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org