Package com.jme3.animation

Examples of com.jme3.animation.Animation


  public void setDefault(String animset, String defaultset){
    defaultAnimations.put(animset, defaultset);
  }
 
  public Animation getAnimation(String path){
    Animation a ;
    //FIXME remove this !=!
    if(path.endsWith(".j3o"))
      a = (Animation) Singleton.get().getAssetManager().getJmeAssetMan().loadAsset(path);
    else
      a = (Animation) Singleton.get().getAssetManager().getJmeAssetMan().loadAsset(path+".j3o")
View Full Code Here


    }

    @Override
    public Animation getAnimation(String name, AnimControl control) {
      PartSet p = anims.get(name);
      Animation anim = null;
      if (p != null) {
        anim = Singleton.get().getAnimManager().getAnimation(
            p.getNext());
      }
      if(anim == null){
        //try default substitute
        if(defaultSet != null){
          AnimationProvider an = Singleton.get().getAnimManager().getAnimationProvider(defaultSet);
          anim = an.getAnimation(name, control);
        }
      }
      if (anim != null && control != null)
        anim.rewireBoneTracks(control.getSkeleton());
      return anim;
    }
View Full Code Here

      try {
        loader = new com.jme3.scene.plugins.ogre.SkeletonLoader();
        AnimData ad = (AnimData) loader.load(name.toURI().toURL().openStream());
        //special case we just have only singled out anims
        if(ad.anims.size() == 1 ){
          Animation anim = ad.anims.get(0);
          BinaryExporter.getInstance().save(anim,
              new File(path + File.separatorChar + file.getName() + File.separatorChar + anim.getName().toLowerCase() + ".j3o"));
          appendMegaSet(new String[]{"anim",file.getName(),truncateEndNumbers(anim.getName().toLowerCase()),"anims/"+file.getName()+"/"+anim.getName().toLowerCase()+ ".j3o"});
        }

      } catch (Exception e) {
        e.printStackTrace();
        return -100;
View Full Code Here

      AnimationManager.get().setDefault("MTW2_Sword", "MTW2_Knifeman");
     
      AnimationProvider ap = AnimationManager.get().getAnimationProvider("MTW2_Sword");
      assertNotNull("MTW2_Sword animation package not found",ap);
     
       Animation a = ap.getAnimation("charge_jump_attack", null);
       assertNotNull("Animation charge_jump_attack not found",a);
       a = ap.getAnimation("ready_idle", null);
       assertNotNull("Substitutue animation ready_idle not found",a);
//      if(aData.anims.size() == 1)
//        aData.anims.get(0).getName();
      if(a != null)
        a.getName();

    }
View Full Code Here

            for (String animationName : animationNames) {
                BlenderAction action = actions.get(animationName);
                if (action != null) {
                    SpatialTrack[] tracks = action.toTracks(node);
                    if (tracks != null && tracks.length > 0) {
                        Animation spatialAnimation = new Animation(animationName, action.getAnimationTime());
                        spatialAnimation.setTracks(tracks);
                        animations.add(spatialAnimation);
                        blenderContext.addAnimation((Long) node.getUserData(ObjectHelper.OMA_MARKER), spatialAnimation);
                    }
                } else {
                    LOGGER.log(Level.WARNING, "Cannot find animation named: {0}.", animationName);
                }
            }

            if (animations.size() > 0) {
                AnimControl control = new AnimControl();
                HashMap<String, Animation> anims = new HashMap<String, Animation>(animations.size());
                for (int i = 0; i < animations.size(); ++i) {
                    Animation animation = animations.get(i);
                    anims.put(animation.getName(), animation);
                }
                control.setAnimations(anims);
                node.addControl(control);
            }
        }
View Full Code Here

            for (String animationName : animationNames) {
                BlenderAction action = actions.get(animationName);
                if (action != null) {
                    BoneTrack[] tracks = action.toTracks(skeleton);
                    if (tracks != null && tracks.length > 0) {
                        Animation boneAnimation = new Animation(animationName, action.getAnimationTime());
                        boneAnimation.setTracks(tracks);
                        animations.add(boneAnimation);
                        Long animatedNodeOMA = ((Number)blenderContext.getMarkerValue(ObjectHelper.OMA_MARKER, node)).longValue();
                        blenderContext.addAnimation(animatedNodeOMA, boneAnimation);
                    }
                } else {
                    LOGGER.log(Level.WARNING, "Cannot find animation named: {0}.", animationName);
                }
            }
            if (animations.size() > 0) {
                AnimControl control = new AnimControl(skeleton);
                HashMap<String, Animation> anims = new HashMap<String, Animation>(animations.size());
                for (int i = 0; i < animations.size(); ++i) {
                    Animation animation = animations.get(i);
                    anims.put(animation.getName(), animation);
                }
                control.setAnimations(anims);
                node.addControl(control);
               
                //make sure that SkeletonControl is added AFTER the AnimControl
View Full Code Here

            tracks.clear();
        } else if (qName.equals("animation")) {
            assert elementStack.peek().equals("animations");
            String name = SAXUtil.parseString(attribs.getValue("name"));
            float length = SAXUtil.parseFloat(attribs.getValue("length"));
            animation = new Animation(name, length);
        } else if (qName.equals("bonehierarchy")) {
            assert elementStack.peek().equals("skeleton");
        } else if (qName.equals("animations")) {
            assert elementStack.peek().equals("skeleton");
            animations = new ArrayList<Animation>();
View Full Code Here

            // Put the animations in the AnimControl
            HashMap<String, Animation> anims = new HashMap<String, Animation>();
            ArrayList<Animation> animList = animData.anims;
            for (int i = 0; i < animList.size(); i++) {
                Animation anim = animList.get(i);
                anims.put(anim.getName(), anim);
            }

            AnimControl ctrl = new AnimControl(animData.skeleton);
            ctrl.setAnimations(anims);
            model.addControl(ctrl);
View Full Code Here

  public static void startApp(){
    app.startCanvas();
    app.enqueue(new Callable<Void>(){
      public Void call(){
        if (app instanceof SimpleApplication){
          SimpleApplication simpleApp = (SimpleApplication) app;
          simpleApp.getFlyByCamera().setDragToRotate(true);
          String assdir =  new File(workspace).getAbsolutePath();
          app.setAssetsPath(assdir);
        }
        return null;
      }
View Full Code Here

     * Attaches Statistics View to guiNode and displays it on the screen
     * above FPS statistics line.
     *
     */
    public void loadStatsView() {
        statsView = new StatsView("Statistics View", assetManager, renderer.getStatistics());
//         move it up so it appears above fps text
        statsView.setLocalTranslation(0, fpsText.getLineHeight(), 0);
        guiNode.attachChild(statsView);
    }
View Full Code Here

TOP

Related Classes of com.jme3.animation.Animation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.