<div dir="ltr">Hi Julien,<div><br></div><div>yes, removeTextureAttribute did the job. Thanks a bunch!!!  I should have consulted the header too</div><div><br></div><div>Cheers,</div><div>Nick</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 13, 2018 at 10:02 PM, Julien Valentin <span dir="ltr"><<a href="mailto:julienvalentin51@gmail.com" target="_blank">julienvalentin51@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">oups i post too fast<br>
I wanted to write<br>
<br>
Code:<br>
StateSet::<wbr>removeTextureAttribute(unit,<wbr>texatt)<br>
<span class=""><br>
<br>
<br>
<br>
mp3butcher wrote:<br>
> Hi Nickolov<br>
> use<br>
><br>
> Code:<br>
</span>> StateSet::<wbr>removeTextureAttribute(unit,<wbr>texatt)<br>
<div><div class="h5">><br>
><br>
> to remove a texture.<br>
> Moreover when you erase you iterator it invalidates it ...so don't do like this<br>
><br>
> Cheers<br>
><br>
><br>
><br>
> Trajce Nikolov NICK wrote:<br>
> > Hi Community,<br>
> ><br>
> > this should be simple, but I can not make it work. I have ive file with embedded texture and it is big file. All I want is to remove the texture and save it back. When I do this with the code bellow, and save the file, the file is not changing it's size. Any clue/hint?<br>
> ><br>
> ><br>
> > Thanks a bunch as always!!!!<br>
> ><br>
> ><br>
> > Nick<br>
> ><br>
> ><br>
> > code<br>
> > struct RemoveTextureVisitor : public osg::NodeVisitor <br>
> > {<br>
> >     RemoveTextureVisitor()<br>
> >             : osg::NodeVisitor(osg::<wbr>NodeVisitor::TRAVERSE_ALL_<wbr>CHILDREN)<br>
> >     {<br>
> >     }<br>
> ><br>
> ><br>
> >     virtual void apply(osg::Node& node)<br>
> >     {<br>
> >             osg::ref_ptr<osg::StateSet> ss = node.getStateSet();<br>
> >             if (ss.valid())<br>
> >             {<br>
> >                     osg::StateSet::AttributeList& attrs = ss->getAttributeList();<br>
> >                     osg::StateSet::AttributeList::<wbr>iterator itr = attrs.begin();<br>
> >                     for (; itr != attrs.end(); ++itr)<br>
> >                     {<br>
> >                             const osg::StateSet::<wbr>RefAttributePair& attrp = itr->second;<br>
> >                             const osg::ref_ptr<osg::<wbr>StateAttribute>& attr = attrp.first;<br>
> ><br>
> ><br>
> >                             osg::ref_ptr<osg::Texture2D> texture = dynamic_cast<osg::Texture2D*>(<wbr>attr.get());<br>
> >                             if (texture.valid())<br>
> >                             {<br>
> >                                     attrs.erase(itr);<br>
> >                                     break;<br>
> >                             }<br>
> >                     }<br>
> >             }<br>
> ><br>
> ><br>
> >             traverse(node);<br>
> >     }<br>
> > };<br>
> ><br>
> ><br>
> > --<br>
> > trajce nikolov nick<br>
> ><br>
> >  ------------------<br>
> > Post generated by Mail2Forum<br>
><br>
<br>
<br>
------------------<br>
Read this topic online here:<br>
</div></div><a href="http://forum.openscenegraph.org/viewtopic.php?p=72751#72751" rel="noreferrer" target="_blank">http://forum.openscenegraph.<wbr>org/viewtopic.php?p=72751#<wbr>72751</a><br>
<div class="HOEnZb"><div class="h5"><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>
<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><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">trajce nikolov nick<br></div>
</div>