AssertionError while trying to import jpg texture


I’m working on a Panda3D project using Toontown’s models (for personnal use). I created a “Mingler”, and I want to change her/his textures. here’s my code :

self.mingler.find("**/sleeve").setTexture(loader.loadTexture("data/models/cag/s_sleeve.jpg"), 1)
        self.mingler.find("**/blazer").setTexture(loader.loadTexture("data/models/cag/s_blazer.jpg"), 1)
        self.mingler.find("**/legs").setTexture(loader.loadTexture("data/models/cag/s_leg.jpg"), 1)
        self.mingler.find("**/arm").setTexture(loader.loadTexture("data/models/cag/s_arm.jpg"), 1)

It found the textures but I got this error :

AssertionError: !is_empty() at line 3507 of panda/src/pgraph/nodePath.cxx

Where is the problem ?

The problem is that you should’ve asked me on our forum :smiling_imp:

Just kidding.

Try find("**/arms") not 'arm"

The error is not here. Here the entire error :

Traceback (most recent call last):
  File "", line 154, in <module>
  File "C:\Panda3D-1.8.1\direct\showbase\", line 2921, in run
  File "C:\Panda3D-1.8.1\direct\task\", line 502, in run
  File "C:\Panda3D-1.8.1\direct\task\", line 460, in step
  File "*****\", lin
e 96, in _goTask = self)
  File "*****\"
, line 41, in __init__
    self.mingler.find("**/sleeve").setTexture(loader.loadTexture("data/models/cag/s_sleeve.jpg"), 1)
AssertionError: !is_empty() at line 3507 of panda/src/pgraph/nodePath.cxx

Have you edited anything? Commit to the repo and I’ll take look.
This code works for me!

My code still don’t works for me, and you aren’t connected…
Somebody else can help me?
Thanks !

I think loblão was on the right track.

I usually get the !is_empty assertion when I’m doing a find but it can’t find that part of the model. Are you sure there is a part called ‘sleeve’ on your model?

Usually I’d check .find returns something, like:

  #do stuff

Yea it finds the part and the texture, but still !is_empty.

If it gives the !is_empty() error, then find("**/something") returned an empty NodePath, which means that it didn’t find anything.

You can call to show the structure of the model on the command-line, which you can then use to find the proper name of the parts to pass to the find() call.

It could also be that self.mingler itself is an empty NodePath, which means that it perhaps wasn’t loaded successfully (eg if you assign it using self.mingler = loader.loadModel(…)). Are there any other error messages on the command-line?

It’s correctly loaded, IG the Mingler is here.
Will try

It’s works ! Thanks, rdb.