How would i clear a textures from a node path?

How would i clear a textures from a node path?

I tried:

 sn.clearTexture()
        sn.clearAttrib(TextureAttrib.getClassType())
        sn.node().clearAttrib(TextureAttrib.getClassType())
        sn.getParent().clearAttrib(TextureAttrib.getClassType())

        print "at=",sn.node().getAttrib(TextureAttrib.getClassType())

        for ts in sn.findAllTextureStages():
            print "texture stage found:",ts
            sn.clearTexture(ts)

        for c in sn.findAllMatches("**/*"):
            print "child found:",c
            c.clearAttrib(TextureAttrib.getClassType())

But nothing helps, Node still says:

GeomNode  (1 geoms: S:(TextureAttrib)) E:(ShowBoundsEffect)

It does not look like the Geoms can have textures and it does not look like it gets applied from above because its shown in the ls definition.

You’re seeing the per-Geom TextureAttrib that is stored within the GeomNode itself. If you really want to remove it completely, you have to get to the Geom and strip it off by hand, e.g.:

for c in sn.findAllMatches("**/+GeomNode"):
  gn = c.node()
  for i in range(gn.getNumGeoms()):
    state = gn.getGeomState(i)
    state = state.removeAttrib(TextureAttrib.getClassType())
    gn.setGeomState(i, state)

But you rarely need to go through that much trouble. If all you want is to make the geometry untextured, you can do that with an override:

sn.setTextureOff(1)

David

Thanks! I really want to strip the all of the textures this been great help.

You can also do:

sn.setTextureOff(1)
sn.flattenLight()

Which applies the off texture attribute onto the Geoms, effectively removing the existing texture attributes from the Geom and replacing them with the off attribute, in just two lines of code. There are other side-effects of this approach, though (like the fact that an override value of 1 also gets flattened down with the off attribute, requiring a higher override in the future).

David