Re: [osg-users] Perform actions when a child node is added
On 26 June 2017 at 13:18, Bruno Oliveirawrote: > a dangling pointer is a probable cause of my problems. Thanks for the hint, > I'll look into it. > > I thought it could be related to me rewriting the node's InitialBound. Modify and reading data like Node::_initialBound on a valid Node would only cause problems with things like culling or positioning incorrectly it is very unlikely to cause a crash. Trying to write to a Node::_initialBound to a node that has been deleted will cause very likely crash, if it doesn't crash it's only a fluke that that freed memory hasn't been reused yet. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Perform actions when a child node is added
Robert, a dangling pointer is a probable cause of my problems. Thanks for the hint, I'll look into it. I thought it could be related to me rewriting the node's InitialBound. Thanks, Bruno 2017-06-26 10:15 GMT+01:00 Robert Osfield: > Hi Bruno, > > On 23 June 2017 at 23:45, Bruno Oliveira > wrote: > > I actually tried it already, in my nodes derived doth from osg::Group* > and > > osg::PagedLOD*. > > However, overloading the PagedLOD's functions made my scene crash the app > > during the cull traversal (my overload was rewriting the node's center, > > radius and InitialBound...) > > If you've got a crash it'll likely be because what you are doing > somewhere is buggy, perhaps an assumption somewhere. Overriding > addChild/insertChild() won't cause a crash if done properly. > > In the case of paged databases nodes are added and removed, the later > can cause problems such as if your code just uses C pointers to these > nodes assuming that they'll always be around. > > I can't say what might have caused the crash for you as I know nothing > about the code you've written or what the crash is, or exactly what > circumstances it happens in. > > You'll have a debugger, your have your code, your data, you're the > person best placed to debug it. > > Robert. > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Perform actions when a child node is added
Hi Bruno, On 23 June 2017 at 23:45, Bruno Oliveirawrote: > I actually tried it already, in my nodes derived doth from osg::Group* and > osg::PagedLOD*. > However, overloading the PagedLOD's functions made my scene crash the app > during the cull traversal (my overload was rewriting the node's center, > radius and InitialBound...) If you've got a crash it'll likely be because what you are doing somewhere is buggy, perhaps an assumption somewhere. Overriding addChild/insertChild() won't cause a crash if done properly. In the case of paged databases nodes are added and removed, the later can cause problems such as if your code just uses C pointers to these nodes assuming that they'll always be around. I can't say what might have caused the crash for you as I know nothing about the code you've written or what the crash is, or exactly what circumstances it happens in. You'll have a debugger, your have your code, your data, you're the person best placed to debug it. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Perform actions when a child node is added
Hi Bruno, What Robert suggested is the correct one. However, I was in your situation where I had to do stuff on PagedLOD children change so I end up with a working hack, and that was an Update callback monitoring the children. Just an idea On Sat, Jun 24, 2017 at 12:45 AM, Bruno Oliveira < bruno.manata.olive...@gmail.com> wrote: > I actually tried it already, in my nodes derived doth from osg::Group* and > osg::PagedLOD*. > However, overloading the PagedLOD's functions made my scene crash the app > during the cull traversal (my overload was rewriting the node's center, > radius and InitialBound...) > > 2017-06-23 15:18 GMT+01:00 Robert Osfield: > >> HI Bruno, >> >> There is no "child added callback" mechanism in osg::Group, but you >> can override the addChild and insertChild methods to catch attempts to >> add children, deferring the implementation to the underlying >> addChild/insertChild method and then doing what extra's you want, >> >> Robert. >> >> On 23 June 2017 at 11:31, Bruno Oliveira >> wrote: >> > Hello, >> > >> > >> > I want to be able to perform some actions inside a node of my own, when >> > someone adds a child node to it. >> > >> > Is this possible via some callback mechanism or so? >> > >> > >> > -- >> > >> > Also, another question. Using osgDB::Registry::ReadFileCallback, I can >> only >> > perform actions after a node is read and before it is added to me >> scene. Is >> > it possible to perform actions AFTER the node is read and added to the >> > scene? >> > >> > >> > Thanks. >> > >> > ___ >> > osg-users mailing list >> > osg-users@lists.openscenegraph.org >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens >> cenegraph.org >> > >> ___ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Perform actions when a child node is added
I actually tried it already, in my nodes derived doth from osg::Group* and osg::PagedLOD*. However, overloading the PagedLOD's functions made my scene crash the app during the cull traversal (my overload was rewriting the node's center, radius and InitialBound...) 2017-06-23 15:18 GMT+01:00 Robert Osfield: > HI Bruno, > > There is no "child added callback" mechanism in osg::Group, but you > can override the addChild and insertChild methods to catch attempts to > add children, deferring the implementation to the underlying > addChild/insertChild method and then doing what extra's you want, > > Robert. > > On 23 June 2017 at 11:31, Bruno Oliveira > wrote: > > Hello, > > > > > > I want to be able to perform some actions inside a node of my own, when > > someone adds a child node to it. > > > > Is this possible via some callback mechanism or so? > > > > > > -- > > > > Also, another question. Using osgDB::Registry::ReadFileCallback, I can > only > > perform actions after a node is read and before it is added to me scene. > Is > > it possible to perform actions AFTER the node is read and added to the > > scene? > > > > > > Thanks. > > > > ___ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > http://lists.openscenegraph.org/listinfo.cgi/osg-users- > openscenegraph.org > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Perform actions when a child node is added
HI Bruno, There is no "child added callback" mechanism in osg::Group, but you can override the addChild and insertChild methods to catch attempts to add children, deferring the implementation to the underlying addChild/insertChild method and then doing what extra's you want, Robert. On 23 June 2017 at 11:31, Bruno Oliveirawrote: > Hello, > > > I want to be able to perform some actions inside a node of my own, when > someone adds a child node to it. > > Is this possible via some callback mechanism or so? > > > -- > > Also, another question. Using osgDB::Registry::ReadFileCallback, I can only > perform actions after a node is read and before it is added to me scene. Is > it possible to perform actions AFTER the node is read and added to the > scene? > > > Thanks. > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Perform actions when a child node is added
Hello, I want to be able to perform some actions inside a node of my own, when someone adds a child node to it. Is this possible via some callback mechanism or so? -- Also, another question. Using osgDB::Registry::ReadFileCallback, I can only perform actions after a node is read and before it is added to me scene. Is it possible to perform actions AFTER the node is read and added to the scene? Thanks. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org