Author Topic: Loader.loadOBJ Problem  (Read 84 times)

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Loader.loadOBJ Problem
« on: October 31, 2017, 08:33:08 pm »
Code: [Select]
System.out.println("\n\n\nWarcraft.loadObject: "+fileName +" Is the mtl null? "+(mtlFile==null));
System.out.println("Is loadOBJ(fileName, mtlFile) null? "+(Loader.loadOBJ(fileName, mtlFile, .5f)==null));

Warcraft.loadObject: buildings\castle_construction0.obj Is the mtl null? false
Exception in thread "main" java.lang.NullPointerException
        at java.util.Hashtable.put(Unknown Source)
        at com.threed.jpct.Loader.loadOBJ(
        at com.threed.jpct.Loader.loadOBJ(
        at Warcraft.loadObject(
        at Worker.moveTowardsDest(
        at Warcraft.loop(
        at Warcraft.<init>(
        at Warcraft.main(

I've opened the file in Blender and it loads just fine.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
Re: Loader.loadOBJ Problem
« Reply #1 on: October 31, 2017, 11:17:32 pm »
mtlFile might be not null, but does the actual file exist? For desktop jPCT, it's best to set the Logger to ON_ERROR_THROW_EXCEPTION, so that it exists early. jPCT-AE already does this, the desktop version just doesn't for compatibility reasons. Maybe that reveals the actual problem.