<div dir="ltr">Hi Community,<div><br></div><div>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?</div><div><br></div><div>Thanks a bunch as always!!!!</div><div><br></div><div>Nick</div><div><br></div><div>code</div><div><div>struct RemoveTextureVisitor : public osg::NodeVisitor </div><div>{</div><div><span style="white-space:pre"> </span>RemoveTextureVisitor()</div><div><span style="white-space:pre"> </span>: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>virtual void apply(osg::Node& node)</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>osg::ref_ptr<osg::StateSet> ss = node.getStateSet();</div><div><span style="white-space:pre"> </span>if (ss.valid())</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>osg::StateSet::AttributeList& attrs = ss->getAttributeList();</div><div><span style="white-space:pre"> </span>osg::StateSet::AttributeList::iterator itr = attrs.begin();</div><div><span style="white-space:pre"> </span>for (; itr != attrs.end(); ++itr)</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>const osg::StateSet::RefAttributePair& attrp = itr->second;</div><div><span style="white-space:pre"> </span>const osg::ref_ptr<osg::StateAttribute>& attr = attrp.first;</div><div><br></div><div><span style="white-space:pre"> </span>osg::ref_ptr<osg::Texture2D> texture = dynamic_cast<osg::Texture2D*>(attr.get());</div><div><span style="white-space:pre"> </span>if (texture.valid())</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>attrs.erase(itr);</div><div><span style="white-space:pre"> </span>break;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>traverse(node);</div><div><span style="white-space:pre"> </span>}</div><div>};</div><div><br></div>-- <br><div class="gmail_signature">trajce nikolov nick<br></div>
</div></div>