3ds and controllers

Hi, I'm trying to get a controller for animation from a 3ds model that I've loaded but it keeps saying there isn't one.  :? I find it weird because as soon as I load the model it cycles through the complete animation.  :expressionless: Maybe I'm trying the wrong way? Or maybe I should just use Collada? Any opinions, suggestions? Here's the code I'm using to load the model and the temporary line to try to find a controller:


private Node loadMax(String file) throws Exception    {
      File maxModel = new File("G:\eclipse\workspace\GUI\" + file + ".3DS");
      MaxToJme converter = new MaxToJme();
      URL url = maxModel.toURI().toURL();
        converter.setProperty( "texurl", url );
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        converter.convert( url.openStream(), bos );
        Node model = (Node) BinaryImporter.getInstance().load( new ByteArrayInputStream( bos.toByteArray() ) );
        temp = converter.findController(model);
        if(temp == null)
         System.out.println("no luck");
        return model;
   }



I'd appreciate any help. Thanks, Chris

I would suggest trying Collada.

maybe you need this from TestMd2JmeWrite:

private KeyframeController kc;
kc=(KeyframeController) freakmd2.getChild(0).getController(0);



not sure just guessing 

or maybe try this, to find your controller:

public void printTree(Spatial i, int level) {
      
      for (int j = 0; j < level; j++) {
         System.out.print(" ");
      }
      if (i.getControllers().isEmpty()) {
         System.out.println(i.getName());
      } else {
         System.out.println(i.getName() + " - has controllers !");

      }
      if (i.getClass().getName().equalsIgnoreCase("com.jme.scene.Node")) {
         for (int k = 0; k < ((Node) i).getChildren().size(); k++) {
            printTree(((Node) i).getChild(k), ++level);
         }

      }

   }

darkfrog - thanks for the advice, I plan on using Collada in the future since I'm limited right now as far as skinned models and bones



mud2005 - thanks for the code. Since I'm still a beginner I hadn't looked into how to traverse the spatials to actually look for the controller. It didn't even occur to me to cast it as a node.  :stuck_out_tongue: Anyways, I found the controller and I'm about to use it.  :slight_smile: Thanks again!

IT'S ALIVE!!!  :smiley: