Hi there
Because of a project I'm planning, I have studied some of the sourcecode of the animation system in jme3.
I found out, that AnimControl has got all the information about animation in it.
My problem is that I need to get direct access to this information.
So I just made a little hack for it:
package com.jme3.animation;
import com.jme3.scene.Mesh;
import com.jme3.scene.Node;
/**
* A hacked class to get more control over the used animations.
*
*/
public class AnimControlHacked
extends AnimControl
{
/**
* Does exactly the same as the original constructor.
*
* @param model
* @param meshes
* @param skeleton
*/
public AnimControlHacked(Node model, Mesh[] meshes, Skeleton skeleton)
{
super(model, meshes, skeleton);
}
/**
* "Casts" the AnimControl control to a AnimControlHacked.
*
* @param model
* @param control
*/
public AnimControlHacked(Node model, AnimControl control)
{
super(model, control.getTargets(), control.getSkeleton());
this.animationMap = control.animationMap;
this.channels = control.channels;
}
/**
* Adds a new animation to the animationMap.
* @param key
* @param value
*/
public void addAnimation(String key, BoneAnimation value)
{
if(animationMap.get(key) == null)
animationMap.put(key, value);
else
throw new RuntimeException("key for new entry in animationMap already exists.");
}
/**
* Deletes a animation out of animationMap.
* @param key
*/
public void removeAnimation(String key)
{
animationMap.remove(key);
}
}
The reason is that I need to make a new animation for my model in runtime, so it's necessary that I can add and remove a new temporary animation.
But it would also be possible to just add these functions in the original file, wouldn't it? ;)
Or did I get something completely wrong? :P
Greetings
kolibri7