<div dir="ltr">Hi Diego,<div><br></div><div>can you post your Visitor code? It can be something like missing calling ->dirty() on the color array or such</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 26, 2018 at 8:30 PM Diego Mancilla <<a href="mailto:dmancillac@gmail.com">dmancillac@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I have tried Eran's suggestion with no success. I have successfully created the handler, and it gets called but no color change...<br>
<br>
My current code:<br>
<br>
On main:<br>
<br>
Code:<br>
_lines = osgDB::readNodeFile("lines.dxf");<br>
_topo->setDataVariance(osg::Object::DYNAMIC);<br>
osg::Geode* geode = new osg::Geode;<br>
<br>
_mViewer->addEventHandler(new ColorHandler);<br>
<br>
ColorVisitor newColor;<br>
newColor.setColor( 1.0f, 0.0f, 0.0f );<br>
_lines->accept(newColor);<br>
geode->addChild(_lines);<br>
_mViewer->realize();<br>
<br>
<br>
<br>
<br>
The handler:<br>
<br>
<br>
Code:<br>
bool ColorHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)<br>
{<br>
        if (ea.getEventType() == ea.USER)<br>
        {<br>
                auto changeColorEvent = dynamic_cast<const ChangeColorEvent*>(ea.getUserData());<br>
                if (changeColorEvent != nullptr)<br>
                {<br>
                        std::cout << "Hola Handler!!!" << std::endl;<br>
                        std::cout << "new color: " << changeColorEvent->r<<" "<< changeColorEvent->g<< " "<< changeColorEvent->b<<std::endl;<br>
                        ColorVisitor newColor;<br>
                        newColor.setColor(changeColorEvent->r, changeColorEvent->g, changeColorEvent->b);<br>
                        changeColorEvent->node->accept(newColor);<br>
                        return true;<br>
                }<br>
        }<br>
        return false;<br>
<br>
<br>
<br>
Thank you!<br>
<br>
Cheers,<br>
Diego<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=75245#75245" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=75245#75245</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">trajce nikolov nick<br></div>