[SOLVED] setTexScale modifies all models from same file

Hey, guys! I’m back again.

I’m trying to make a city generator, that builds buildings at random. The problem is whenever I use setTexScale on a model, it changes all models of the same.

My building class looks like this:

class CityBuilding(NodePath):
  def __init__(self, height, name):
    NodePath.__init__(self, name)
    self._building = loader.loadModel('building.egg')
    self._building.reparentTo(self)
    self._building.setScale(1,1,height)
    self._building.find('**/sides').setTexScale(TextureStage.getDefault(), 0, height)

Now, this works great for only one building, but if I try to build 5 or so, every building becomes the same number of stories high, just stretched to different lengths.

Any help appreciated very much,
thanks!

panda.egg

Hmm, it doesn’t seem to happen that way for me, when I try to do a similar thing.

Either it’s (a) a bug we never knew about, that’s been fixed with the current version of Panda, or (b) a subtle bug that only occurs in certain circumstances, which your code just happens to be triggering and my code is not, or © a misunderstanding due to some different cause (for instance, you’re definitely using loadModel(), and not loadModelOnce(), right? And you’re sure that you’re actually passing different values of height each time?)

The fact that the second parameter to setTexScale in your example code above is 0 troubles me, since scaling the U parameter to 0 would usually completely obliterate a texture. If that’s pasted from your actual code, and not a typo in the forum, and you’re still seeing a texture, it must be that the setTexScale() isn’t getting applied for some reason. Maybe your setTexScale() isn’t actually getting called, or if it is, maybe it’s not working for some other reason.

David

Heh. Forum typo. Sorry about that.

Another little tidbit was that I was using pandadx9 as my display pipe.

Thanks for your help!
panda.egg

Does the behavior change if you use OpenGL?

David

This just in: Runs beautifully under OpenGL, but DirectX9 has that bug.

I guess I’ll just use OpenGL only until a fix comes out.

(No rush to fix this bug, I don’t mind. :wink:)

panda.egg

Got the fix in. It should be part of the next Panda release.

Thanks!

David

Glad I could be of assistance. I switched this to [SOLVED], though I think it should probably even be deleted.

Oh, well… This topic is under full control of any moderator who will sort it.

panda.egg