Fast texture modify on model?

Hi, I have a 3D model with its texture loaded with “loadModel”. Now, how can I do to change the parameters “setWrapV” and “setWrapU” of the texture directly from the 3D model?

Thank you all for your help.

Hi

there is a getTexture() function on NodePath,
have you tired that one yet, and then the setWrap calls on the texture returned…

i use this code:

      lp = loader.loadModel(MAINPATH+MODFOLDER+"/gui/left_panel.x")
      lp.getTexture().setWrapU(Texture.WMClamp)
      lp.getTexture().setWrapV(Texture.WMClamp)

and the output is:

    lp.getTexture().setWrapU(Texture.WMClamp)
AttributeError: 'NoneType' object has no attribute 'setWrapU'

so i think that the command is valid only if you use “setTexture” too.

There is another metod for access the default texture directly from the model?

thanks again.

You can use this (affects all textures on the model):

      lp = loader.loadModel(MAINPATH+MODFOLDER+"/gui/left_panel.x") 
      for tex in lp.findAllTextures():
        tex.setWrapU(Texture.WMClamp) 
        tex.setWrapV(Texture.WMClamp) 

However, why not use x2egg to convert the model to .egg, and then editing the .egg file so that it uses the correct “clamp” mode in the first place? This is recommended over loading .x directly in Panda anyway.

because i’m afraid to lose something in the conversion, but if you are sure that this method converts all right, so most likely I will use the second one.

thanks

I decide to use your method, but can you explain me how modify the .egg file for edit “clamp”?

thanks