<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Robert,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><div class="gmail_default"></div><div class="gmail_default">I know there are many things already going on toward OSG 3.6.0,</div><div class="gmail_default">but if you get a change to take a look to the sample I've sent, it might be worth considering possible fixes before the new release is out.</div><div class="gmail_default"><br></div><div class="gmail_default">Thank you,</div><div class="gmail_default">Riccardo</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 29, 2016 at 6:45 PM, Robert Osfield <span dir="ltr"><<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Riccardo. I'm currently submerged in refactoring osgParticle,<br>
once this is completed I'll have a look at the modified<br>
osgcallback.cpp.<br>
<div class="HOEnZb"><div class="h5"><br>
On 29 August 2016 at 16:20, Riccardo Corsi <<a href="mailto:riccardo.corsi@kairos3d.it">riccardo.corsi@kairos3d.it</a>> wrote:<br>
> Hi Robert,<br>
><br>
> please find attached a simple example that shows the issues I was trying to<br>
> explain:<br>
> - launch with no args to see the initial issue<br>
> - launch with "--crash" to get the crash i ran into when implementing the<br>
> callback deriving from osg::Callback<br>
> - launch with "--fix" to see the way I fixed it with the NodeCallback:<br>
> comments on the run() and operator() methods explain some concerns for this<br>
> solution<br>
><br>
> Hope this clarifies things :)<br>
> Ricky<br>
><br>
><br>
> On Mon, Aug 29, 2016 at 4:29 PM, Robert Osfield <<a href="mailto:robert.osfield@gmail.com">robert.osfield@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hi Ricky,<br>
>><br>
>> The changes to Drawable and the knock on effect to the callbacks is an<br>
>> awkward one - it would be easy if it we could just discard backwards<br>
>> compatibility, so it's a far from ideal code, but alas you can't<br>
>> rewrite history once it's happened.<br>
>><br>
>> From your description I don't have a clear idea of what is being<br>
>> called twice and whether this is a problem. Could you create a small<br>
>> example that illustrates the problem, once I can see first hand I can<br>
>> review the behaviour and decide whether this is acceptable or is an<br>
>> bug.<br>
>><br>
>> Thanks,<br>
>> Robert.<br>
>><br>
>> On 29 August 2016 at 15:00, Riccardo Corsi <<a href="mailto:riccardo.corsi@kairos3d.it">riccardo.corsi@kairos3d.it</a>><br>
>> wrote:<br>
>> > Hi all,<br>
>> ><br>
>> > I report what I believe could be considered a bug, probably introduced<br>
>> > after<br>
>> > the promotion of the Drawable class to a node, together with the new<br>
>> > callback system.<br>
>> ><br>
>> > I have a GUIEventHandler derived class installed on a Drawable.<br>
>> > After some digging I've realized that it's called twice for every event<br>
>> > due<br>
>> > to the EventVisitor code here:<br>
>> ><br>
>> > <a href="https://github.com/openscenegraph/OpenSceneGraph/blob/master/include/osgGA/EventVisitor#L86" rel="noreferrer" target="_blank">https://github.com/<wbr>openscenegraph/OpenSceneGraph/<wbr>blob/master/include/osgGA/<wbr>EventVisitor#L86</a><br>
>> ><br>
>> > GUIEventHandler happens to derive both from NodeCallback and<br>
>> > DrawableEventCallback, resulting in it being called twice. I think this<br>
>> > might be considered as a bug if the intended behavior was to keep using<br>
>> > the<br>
>> > old GUIEventHandler interface the way it was (when attached to the<br>
>> > viewer<br>
>> > for instance, it is called only once as expected).<br>
>> ><br>
>> > Relate issue:<br>
>> > I've re-implemented my callback deriving from osg::Callback, but this<br>
>> > results in a crash as the osg::CallbackObject interface is used even if<br>
>> > the<br>
>> > cast does not succeed (first if condition)<br>
>> ><br>
>> > <a href="https://github.com/openscenegraph/OpenSceneGraph/blob/master/include/osgGA/EventVisitor#L93" rel="noreferrer" target="_blank">https://github.com/<wbr>openscenegraph/OpenSceneGraph/<wbr>blob/master/include/osgGA/<wbr>EventVisitor#L93</a><br>
>> ><br>
>> > I fixed that by deriving from osg::NodeCallback, but I had to<br>
>> > reimplement<br>
>> > the operator() method instead of run(), as the second is not called by<br>
>> > the<br>
>> > visitor - that also it's a bit counter-intuitive with respect to the<br>
>> > osg::Callback class interface.<br>
>> ><br>
>> > Ricky<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > osg-users mailing list<br>
>> > <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
>> ><br>
>> > <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
>> ><br>
>> ______________________________<wbr>_________________<br>
>> osg-users mailing list<br>
>> <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
>> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> osg-users mailing list<br>
> <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
><br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</div></div></blockquote></div><br></div>