Adding the ClipAction.getAnimClip() method

Hello everyone,
I am writing tools for animated 3D models and I want to access the AnimClip variable of the ClipAction class. Although the constructor of the ClipAction class requires an AnimClip, there is no getter method ClipAction.getAnimClip().
Could this be added? If you agree, I will open an issue on the engine.

Here is a use case:

        StringBuilder sb = new StringBuilder();
        Action action = animComposer.getCurrentAction();

        if (action != null) {
            sb.append("ActionType=").append(action.getClass()).append('\n');
            sb.append("Length=").append(timeLength).append('\n');
            sb.append("Speed=").append(action.getSpeed()).append('\n');

            if (action instanceof ClipAction) {
                ClipAction ca = (ClipAction) action;

                try {
                    // Use reflection because the ClipAction.getAnimClip() method does not exist
                    AnimClip clip = (AnimClip) FieldUtils.readField(ca, "clip", true);
                    sb.append("ClipName=").append(clip.getName()).append('\n');
                    sb.append("Duration (sec)=").append(clip.getLength()).append('\n');
                    sb.append("Tracks=").append(clip.getTracks().length).append('\n');

                } catch (ReflectiveOperationException e) {
                    e.printStackTrace();
                }

                sb.append("TransitionLength=").append(ca.getTransitionLength()).append('\n');
                sb.append("MaxTransitionWeight=").append(ca.getMaxTransitionWeight()).append('\n');
                sb.append("Weight=").append(ca.getWeight()).append('\n');
                sb.append("TargetTransforms=").append(ca.getTargets().size()).append('\n');
            }
        }

Also could you remove the ClipAction.reset() method which does nothing?

4 Likes

I just borrow this thread, because of similar topic:

I saw that com.jme3.scene.shape.Sphere misses getters for the two boolean values. Public getter for the unscaled height and radius of BetterCharacterControl could also be useful, I think.

Added also an Issues to Lemur: StyleLoader#loadStyle(URL) doesn't close the stream. · Issue #121 · jMonkeyEngine-Contributions/Lemur · GitHub

2 Likes

Note: I have seen the issue and plan to incorporate a fix into the next release… but it is a very minor issue and unrelated to anything in this thread.

1 Like

Thanks for the suggestion; coming soon to Minie.

1 Like