Re: [osg-users] StateSet issues with parent\child node
On Jul 1, 11:27 am, "Fuesz, Matthew" <[EMAIL PROTECTED]> wrote: > Judie, > > The default behavior is for States/StateSets to be inherited down the > scene graph, from parent to child. However, in the default > configuration, setting the StateSet of the child directly should cause > that child (and any children that it itself has) to use the new StateSet > parameters. This inheritance method is controlled by the OverrideValue > flag, which can be set when attributes and modes are enabled or disabled > on a StateSet. > > It sounds like what you're doing should work (set the state on the > parent, then reset the state on the child), but I don't understand why > you're creating and adding another group node in between the parent and > child, as this is completely unnecessary to manipulate state changes. OK, I thought someone had told me this needed to be done but that was a while ago. It works as you say. > > All you need to do is to query the StateSet from the parent (using > getOrCreateStateSet() ) and make any appropriate changes. Then get the > StateSet from the child, and remove/reverse any changes (e.g., disable > materials, or apply 'empty' Programs in the case of shaders). > Alternatively, you could set the child's OverrideValue to PROTECTED in > order to prevent the parent's state values from being inherited. This did the trick! Thanks, Judie ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] StateSet issues with parent\child node
Judie, The default behavior is for States/StateSets to be inherited down the scene graph, from parent to child. However, in the default configuration, setting the StateSet of the child directly should cause that child (and any children that it itself has) to use the new StateSet parameters. This inheritance method is controlled by the OverrideValue flag, which can be set when attributes and modes are enabled or disabled on a StateSet. It sounds like what you're doing should work (set the state on the parent, then reset the state on the child), but I don't understand why you're creating and adding another group node in between the parent and child, as this is completely unnecessary to manipulate state changes. All you need to do is to query the StateSet from the parent (using getOrCreateStateSet() ) and make any appropriate changes. Then get the StateSet from the child, and remove/reverse any changes (e.g., disable materials, or apply 'empty' Programs in the case of shaders). Alternatively, you could set the child's OverrideValue to PROTECTED in order to prevent the parent's state values from being inherited. -- Matthew W. Fuesz Software Engineer Asc. Lockheed Martin STS 1210 Massillon Road Akron, OH 44315 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judie Sent: Tuesday, July 01, 2008 1:57 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] StateSet issues with parent\child node Hi, I must be doing something wrong. I have a function that adds a sphere map and material to a node. When I apply this function to a parent, it also affects the child. How can I make it just affect the parent and not the child? Also, if I call the same function with different settings for the child, it still gets the parent's settings even if I call the function on the child last. In the algorithm I do the following: find the node by name that I want to apply the state to - currNode. make a new group node (gnode) and insert that between the currNode and it's parent. I use this "gnode" to get or create the state. Then I add my settings to this state. I also give it a unique name. I have also tried just applying the state to the currNode directly and I get the same behavior no matter what. Judie ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] StateSet issues with parent\child node
Hi, I must be doing something wrong. I have a function that adds a sphere map and material to a node. When I apply this function to a parent, it also affects the child. How can I make it just affect the parent and not the child? Also, if I call the same function with different settings for the child, it still gets the parent's settings even if I call the function on the child last. In the algorithm I do the following: find the node by name that I want to apply the state to - currNode. make a new group node (gnode) and insert that between the currNode and it's parent. I use this "gnode" to get or create the state. Then I add my settings to this state. I also give it a unique name. I have also tried just applying the state to the currNode directly and I get the same behavior no matter what. Judie ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org