Hi Julien, yes, removeTextureAttribute did the job. Thanks a bunch!!! I should have consulted the header too
Cheers, Nick On Sat, Jan 13, 2018 at 10:02 PM, Julien Valentin < julienvalenti...@gmail.com> wrote: > oups i post too fast > I wanted to write > > Code: > StateSet::removeTextureAttribute(unit,texatt) > > > > > mp3butcher wrote: > > Hi Nickolov > > use > > > > Code: > > StateSet::removeTextureAttribute(unit,texatt) > > > > > > to remove a texture. > > Moreover when you erase you iterator it invalidates it ...so don't do > like this > > > > Cheers > > > > > > > > Trajce Nikolov NICK wrote: > > > Hi Community, > > > > > > 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? > > > > > > > > > Thanks a bunch as always!!!! > > > > > > > > > Nick > > > > > > > > > code > > > struct RemoveTextureVisitor : public osg::NodeVisitor > > > { > > > RemoveTextureVisitor() > > > : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_ > CHILDREN) > > > { > > > } > > > > > > > > > virtual void apply(osg::Node& node) > > > { > > > osg::ref_ptr<osg::StateSet> ss = node.getStateSet(); > > > if (ss.valid()) > > > { > > > osg::StateSet::AttributeList& attrs = > ss->getAttributeList(); > > > osg::StateSet::AttributeList::iterator itr = > attrs.begin(); > > > for (; itr != attrs.end(); ++itr) > > > { > > > const osg::StateSet::RefAttributePair& > attrp = itr->second; > > > const osg::ref_ptr<osg::StateAttribute>& > attr = attrp.first; > > > > > > > > > osg::ref_ptr<osg::Texture2D> texture = > dynamic_cast<osg::Texture2D*>(attr.get()); > > > if (texture.valid()) > > > { > > > attrs.erase(itr); > > > break; > > > } > > > } > > > } > > > > > > > > > traverse(node); > > > } > > > }; > > > > > > > > > -- > > > trajce nikolov nick > > > > > > ------------------ > > > Post generated by Mail2Forum > > > > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=72751#72751 > > > > > > _______________________________________________ > 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