Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor refactor to allow for saving AnimLayers #2307

Merged
merged 5 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion jme3-core/src/main/java/com/jme3/anim/AnimLayer.java
Copy link
Contributor Author

@neph1 neph1 Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to only save name and mask. The other fields felt like they're only interesting for runtime.

Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ public Object jmeClone() {
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(name, "name", null);
oc.write(mask, "mask", null);
if(mask instanceof ArmatureMask) {
neph1 marked this conversation as resolved.
Show resolved Hide resolved
oc.write((ArmatureMask) mask, "mask", null);
}
}

@Override
Expand Down
4 changes: 1 addition & 3 deletions jme3-core/src/main/java/com/jme3/anim/AnimationMask.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@
*/
package com.jme3.anim;

import com.jme3.export.Savable;

/**
* Created by Nehon
* An AnimationMask is defining a subset of elements on which an animation will be applied.
* Most used implementation is the ArmatureMask that defines a subset of joints in an Armature.
*/
public interface AnimationMask extends Savable {
public interface AnimationMask {

/**
* Test whether the animation should be applied to the specified element.
Expand Down
3 changes: 2 additions & 1 deletion jme3-core/src/main/java/com/jme3/anim/ArmatureMask.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.export.Savable;
import java.io.IOException;
import java.util.BitSet;

/**
* An AnimationMask to select joints from a single Armature.
*/
public class ArmatureMask implements AnimationMask {
public class ArmatureMask implements AnimationMask, Savable {

private BitSet affectedJoints = new BitSet();

Expand Down
2 changes: 0 additions & 2 deletions jme3-core/src/test/java/com/jme3/anim/AnimComposerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
package com.jme3.anim;

import com.jme3.anim.tween.action.Action;
import com.jme3.anim.tween.action.ClipAction;
import com.jme3.export.JmeExporter;
import java.util.Set;
import java.util.TreeSet;
import org.junit.Assert;
Expand Down
Loading