Texture Stages Are Over Powered

I ran into an issue, that seems to have no solution. I have an actor that has objects attached to it, like clothing or a weapon; When ever I give the Actor’s body (without clothing, weapon, etc) a texture stage, all objects that get attached to it will undergo the changes as well.

(I’ve even had animation of some objects stop working correctly and other texture errors.)

But that isn’t what I want! I noticed that about P3D; it will just assume the same texture stage is suppose to be on any object attached to the main Actor.

There are too many situations where you would not want this to happen and I’ve already named one, clothing. If I gave my Actor several texture stages to finish off its skin, I don’t want my Actor’s armor to receive the same changes.

It doesn’t matter if an object was not parented to the Actor at the time of the texture stage change. Once an object gets attached, that’s it! It will undergo any coded texture changes the Actor went through.

Please tell me there is a way to stop this behavior and please don’t say egg-opt or that other one. Egg-opt never worked for me and will never. This is the first engine I’ve used that doesn’t have built in APIs that take care of sub level objects, under a Parent object, as it’s own parent.

Mr. Drwr, I’m hurt.

:cry: :cry: :cry: :cry: :cry:

The loader does some automagic optimalisations so you really need to tag your geometry. If you don’t like egg-optchar or it breaks your models then you can always tag’em by hand. It’s not that hard. Here’s an example:

not taged:

<Polygon> {
      <RGBA> { 1 1 1 0.27 }
      <TRef> { Tex7 }
      <TRef> { Tex8 }
      <VertexRef> { 62 46 33 <Ref> { buble.verts } }
    }
    <Polygon> {
      <RGBA> { 1 1 1 0.27 }
      <TRef> { Tex7 }
      <TRef> { Tex8 }
      <VertexRef> { 63 33 28 <Ref> { buble.verts } }
    }
    <Polygon> {
      <RGBA> { 1 1 1 0.27 }
      <TRef> { Tex7 }
      <TRef> { Tex8 }
      <VertexRef> { 64 28 21 <Ref> { buble.verts } }
    }

taged as “buble”

<Polygon> buble {
      <RGBA> { 1 1 1 0.27 }
      <TRef> { Tex7 }
      <TRef> { Tex8 }
      <VertexRef> { 62 46 33 <Ref> { buble.verts } }
    }
    <Polygon> buble {
      <RGBA> { 1 1 1 0.27 }
      <TRef> { Tex7 }
      <TRef> { Tex8 }
      <VertexRef> { 63 33 28 <Ref> { buble.verts } }
    }
    <Polygon> buble {
      <RGBA> { 1 1 1 0.27 }
      <TRef> { Tex7 }
      <TRef> { Tex8 }
      <VertexRef> { 64 28 21 <Ref> { buble.verts } }
    }

You can override texture settings on sub-nodes by applying an attribute with an override value. For instance, if you don’t want an attached object to have a texture, you can use setTextureOff(1) or so.

Another approach is to realize that the Actor root node is different from the actual geometry. When you apply a texture to the Actor root node, you apply it to every node at that level and below, which does indeed include the actor’s geometry, as well as everything else that you’ve attached to the actor (including swords, clothing, and whatever).

But if all you wanted was to apply a texture to the actor’s geometry, and not to everything else you attached to the actor, then you should apply the texture directly to the actor’s geometry node, and not to the actor’s root node.

In the case of an Actor, that probably means you wanted to apply it to actor.getGeomNode() instead.

David

Does actor.getGeomNode() take a string argument?

actor.getGeomNode("bodygeometry")

From Actor.py:

    def getGeomNode(self):
        """
        Return the node that contains all actor geometry
        """
        return self.__geomNode

Looks like it doesn’t.

I had Actor.getGeomNode() print to the console. The only thing it returned was the name of my Actor’s skeleton used for deformation.

:question:

It’s a node within your Actor structure.

This is all part of Panda’s structured scene graph. It can take a while, if you don’t have previous experience with a scene-graph based engine, to get a full grasp of these concepts, but it will come with time.

The Actor consists of multiple nodes within it, which you can view by running:

myActor.ls()

One of those nodes is myActor.getGeomNode(), which is usually a node right below the root node, and which is the actual root of your actor’s geometry. You can see this node with and its children with:

myActor.getGeomNode().ls()

Generally, anything you do to one node affects that node and everything below it (unless you use overrides on the lower nodes, as rdb hinted at above, but that’s a more advanced topic). So if you wanted to apply a texture to your actor’s root node and also to everything else that you’d attached to that same root node, you would do:

myActor.setTexture(myTexture)

But if you wanted to apply a texture only to your actor’s geometry, and not to other things that you’d attached to the actor’s root node, you would do:

myActor.getGeomNode().setTexture(myTexture)

which is a more specific operation because you’re applying the texture to a more specific (lower) node.

David

Didn’t work.

None to matter though. I must look for another method to accomplish the task. I have an idea, but I’m not going to test it now. I’ll save it for later.