diff --git a/README.md b/README.md
index 5112b5efa..f55251ca0 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-jMonkeyEngine
+jMonkeyEngine
=============
[![Build Status](https://github.com/jMonkeyEngine/jmonkeyengine/workflows/Build%20jMonkeyEngine/badge.svg)](https://github.com/jMonkeyEngine/jmonkeyengine/actions)
@@ -37,8 +37,8 @@ Note: The master branch on GitHub is a development version of the engine and is
- NetBeans Platform
- Gradle
-Plus a bunch of awesome libraries & tight integrations like Bullet, Blender, NiftyGUI and other goodies.
-
+Plus a bunch of awesome libraries & tight integrations like Bullet, NiftyGUI and other goodies.
+
### Documentation
Did you miss it? Don't sweat it, [here it is again](https://jmonkeyengine.github.io/wiki).
diff --git a/jme3-blender/build.gradle b/jme3-blender/build.gradle
deleted file mode 100644
index a556d7a65..000000000
--- a/jme3-blender/build.gradle
+++ /dev/null
@@ -1,12 +0,0 @@
-if (!hasProperty('mainClass')) {
- ext.mainClass = ''
-}
-
-dependencies {
- compile project(':jme3-core')
- compile project(':jme3-desktop')
- compile project(':jme3-effects')
- compile ('org.ejml:core:0.27')
- compile ('org.ejml:dense64:0.27')
- compile ('org.ejml:simple:0.27')
-}
\ No newline at end of file
diff --git a/jme3-blender/examples/src/main/java/jme3test/blender/TestBlenderLoader.java b/jme3-blender/examples/src/main/java/jme3test/blender/TestBlenderLoader.java
deleted file mode 100644
index 0ff740bfb..000000000
--- a/jme3-blender/examples/src/main/java/jme3test/blender/TestBlenderLoader.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2009-2012 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package jme3test.blender;
-
-import com.jme3.app.SimpleApplication;
-import com.jme3.light.DirectionalLight;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Vector3f;
-import com.jme3.scene.Spatial;
-
-public class TestBlenderLoader extends SimpleApplication {
-
- public static void main(String[] args){
- TestBlenderLoader app = new TestBlenderLoader();
- app.start();
- }
-
- @Override
- public void simpleInitApp() {
- viewPort.setBackgroundColor(ColorRGBA.DarkGray);
-
- //load model with packed images
- Spatial ogre = assetManager.loadModel("Blender/2.4x/Sinbad.blend");
- rootNode.attachChild(ogre);
-
- //load model with referenced images
- Spatial track = assetManager.loadModel("Blender/2.4x/MountainValley_Track.blend");
- rootNode.attachChild(track);
-
- // sunset light
- DirectionalLight dl = new DirectionalLight();
- dl.setDirection(new Vector3f(-0.1f,-0.7f,1).normalizeLocal());
- dl.setColor(new ColorRGBA(0.44f, 0.30f, 0.20f, 1.0f));
- rootNode.addLight(dl);
-
- // skylight
- dl = new DirectionalLight();
- dl.setDirection(new Vector3f(-0.6f,-1,-0.6f).normalizeLocal());
- dl.setColor(new ColorRGBA(0.10f, 0.22f, 0.44f, 1.0f));
- rootNode.addLight(dl);
-
- // white ambient light
- dl = new DirectionalLight();
- dl.setDirection(new Vector3f(1, -0.5f,-0.1f).normalizeLocal());
- dl.setColor(new ColorRGBA(0.80f, 0.70f, 0.80f, 1.0f));
- rootNode.addLight(dl);
- }
-
- @Override
- public void simpleUpdate(float tpf){
- }
-
-}
diff --git a/jme3-blender/examples/src/main/java/jme3test/light/TestTangentGenBadModels.java b/jme3-blender/examples/src/main/java/jme3test/light/TestTangentGenBadModels.java
deleted file mode 100644
index 63f2c23aa..000000000
--- a/jme3-blender/examples/src/main/java/jme3test/light/TestTangentGenBadModels.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package jme3test.light;
-
-import com.jme3.app.SimpleApplication;
-import com.jme3.font.BitmapText;
-import com.jme3.input.KeyInput;
-import com.jme3.input.controls.ActionListener;
-import com.jme3.input.controls.KeyTrigger;
-import com.jme3.light.DirectionalLight;
-import com.jme3.light.PointLight;
-import com.jme3.material.Material;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.FastMath;
-import com.jme3.math.Vector3f;
-import com.jme3.renderer.queue.RenderQueue.Bucket;
-import com.jme3.scene.*;
-import com.jme3.scene.Spatial.CullHint;
-import com.jme3.scene.shape.Sphere;
-import com.jme3.util.TangentBinormalGenerator;
-
-/**
- *
- * @author Kirusha
- */
-public class TestTangentGenBadModels extends SimpleApplication {
-
- float angle;
- PointLight pl;
- Geometry lightMdl;
-
- public static void main(String[] args){
- TestTangentGenBadModels app = new TestTangentGenBadModels();
- app.start();
- }
-
- @Override
- public void simpleInitApp() {
-// assetManager.registerLocator("http://jme-glsl-shaders.googlecode.com/hg/assets/Models/LightBlow/", UrlLocator.class);
-// assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/", UrlLocator.class);
-
- final Spatial badModel = assetManager.loadModel("Models/TangentBugs/test.blend");
-// badModel.setLocalScale(1f);
-
- Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
- mat.setTexture("NormalMap", assetManager.loadTexture("Models/TangentBugs/test_normal.png"));
-// Material mat = assetManager.loadMaterial("Textures/BumpMapTest/Tangent.j3m");
- badModel.setMaterial(mat);
- rootNode.attachChild(badModel);
-
- // TODO: For some reason blender loader fails to load this.
- // need to check it
-// Spatial model = assetManager.loadModel("test.blend");
-// rootNode.attachChild(model);
-
- final Node debugTangents = new Node("debug tangents");
- debugTangents.setCullHint(CullHint.Always);
- rootNode.attachChild(debugTangents);
-
- final Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
-
- badModel.depthFirstTraversal(new SceneGraphVisitorAdapter(){
- @Override
- public void visit(Geometry g){
- Mesh m = g.getMesh();
- Material mat = g.getMaterial();
-
-// if (mat.getParam("DiffuseMap") != null){
-// mat.setTexture("DiffuseMap", null);
-// }
- TangentBinormalGenerator.generate(m);
-
- Geometry debug = new Geometry(
- "debug tangents geom",
- TangentBinormalGenerator.genTbnLines(g.getMesh(), 0.2f)
- );
- debug.setMaterial(debugMat);
- debug.setCullHint(Spatial.CullHint.Never);
- debug.setLocalTransform(g.getWorldTransform());
- debugTangents.attachChild(debug);
- }
- });
-
- DirectionalLight dl = new DirectionalLight();
- dl.setDirection(new Vector3f(-0.8f, -0.6f, -0.08f).normalizeLocal());
- dl.setColor(new ColorRGBA(1,1,1,1));
- rootNode.addLight(dl);
-
- lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
- lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
- lightMdl.getMesh().setStatic();
- rootNode.attachChild(lightMdl);
-
- pl = new PointLight();
- pl.setColor(ColorRGBA.White);
-// rootNode.addLight(pl);
-
-
- BitmapText info = new BitmapText(guiFont);
- info.setText("Press SPACE to switch between lighting and tangent display");
- info.setQueueBucket(Bucket.Gui);
- info.move(0, settings.getHeight() - info.getLineHeight(), 0);
- rootNode.attachChild(info);
-
- inputManager.addMapping("space", new KeyTrigger(KeyInput.KEY_SPACE));
- inputManager.addListener(new ActionListener() {
-
- private boolean isLit = true;
-
- @Override
- public void onAction(String name, boolean isPressed, float tpf) {
- if (isPressed) return;
- Material mat;
- if (isLit){
- mat = assetManager.loadMaterial("Textures/BumpMapTest/Tangent.j3m");
- debugTangents.setCullHint(CullHint.Inherit);
- }else{
- mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
- mat.setTexture("NormalMap", assetManager.loadTexture("Models/TangentBugs/test_normal.png"));
- debugTangents.setCullHint(CullHint.Always);
- }
- isLit = !isLit;
- badModel.setMaterial(mat);
- }
- }, "space");
- }
-
- @Override
- public void simpleUpdate(float tpf){
- angle += tpf;
- angle %= FastMath.TWO_PI;
-
- pl.setPosition(new Vector3f(FastMath.cos(angle) * 2f, 2f, FastMath.sin(angle) * 2f));
- lightMdl.setLocalTranslation(pl.getPosition());
- }
-
-
-}
diff --git a/jme3-blender/examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java b/jme3-blender/examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java
deleted file mode 100644
index 4cf175da2..000000000
--- a/jme3-blender/examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2009-2020 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package jme3test.model.anim;
-
-import com.jme3.anim.AnimClip;
-import com.jme3.anim.AnimComposer;
-import com.jme3.anim.util.AnimMigrationUtils;
-import com.jme3.app.SimpleApplication;
-import com.jme3.asset.BlenderKey;
-import com.jme3.light.DirectionalLight;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Quaternion;
-import com.jme3.math.Vector3f;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
-
-public class TestBlenderAnim extends SimpleApplication {
-
- public static void main(String[] args) {
- TestBlenderAnim app = new TestBlenderAnim();
- app.start();
- }
-
- @Override
- public void simpleInitApp() {
- flyCam.setMoveSpeed(10f);
- cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));
- cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));
-
- DirectionalLight dl = new DirectionalLight();
- dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
- dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
- rootNode.addLight(dl);
-
- BlenderKey blenderKey = new BlenderKey("Blender/2.4x/BaseMesh_249.blend");
-
- Spatial scene = assetManager.loadModel(blenderKey);
- rootNode.attachChild(scene);
-
- Spatial model = this.findNode(rootNode, "BaseMesh_01");
- AnimMigrationUtils.migrate(model);
- model.center();
-
- AnimComposer animComposer = model.getControl(AnimComposer.class);
- animComposer.getAnimClips().forEach(animClip -> System.out.println("AnimClip name: " + animClip.getName()));
- AnimClip animClip = animComposer.getAnimClip("run_01"); // run_sideway_left, aim, run_sideway_right, base_stand, run_01, base, jump
- animComposer.setCurrentAction(animClip.getName());
- }
-
- /**
- * This method finds a node of a given name.
- *
- * @param rootNode
- * the root node to search
- * @param name
- * the name of the searched node
- * @return the found node or null
- */
- private Spatial findNode(Node rootNode, String name) {
- if (name.equals(rootNode.getName())) {
- return rootNode;
- }
- return rootNode.getChild(name);
- }
-}
diff --git a/jme3-blender/examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java b/jme3-blender/examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java
deleted file mode 100644
index 928ddd79e..000000000
--- a/jme3-blender/examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2009-2020 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package jme3test.model.anim;
-
-import com.jme3.anim.AnimClip;
-import com.jme3.anim.AnimComposer;
-import com.jme3.anim.util.AnimMigrationUtils;
-import com.jme3.app.SimpleApplication;
-import com.jme3.asset.BlenderKey;
-import com.jme3.light.DirectionalLight;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Quaternion;
-import com.jme3.math.Vector3f;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
-
-public class TestBlenderObjectAnim extends SimpleApplication {
-
- public static void main(String[] args) {
- TestBlenderObjectAnim app = new TestBlenderObjectAnim();
- app.start();
- }
-
- @Override
- public void simpleInitApp() {
- flyCam.setMoveSpeed(10f);
- cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));
- cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));
-
- DirectionalLight dl = new DirectionalLight();
- dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
- dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
- rootNode.addLight(dl);
-
- BlenderKey blenderKey = new BlenderKey("Blender/2.4x/animtest.blend");
-
- Spatial scene = assetManager.loadModel(blenderKey);
- rootNode.attachChild(scene);
-
- Spatial model = this.findNode(rootNode, "Cube");
- model.center();
-
- // Because it's old .blend file need to migrate object.
- AnimMigrationUtils.migrate(model);
-
- AnimComposer animComposer = model.getControl(AnimComposer.class);
- animComposer.getAnimClips().forEach(animClip -> System.out.println("AnimClip name: " + animClip.getName()));
- AnimClip animClip = animComposer.getAnimClip("Action"); // Action, Action.001
- animComposer.setCurrentAction(animClip.getName());
- }
-
- /**
- * This method finds a node of a given name.
- * @param rootNode the root node to search
- * @param name the name of the searched node
- * @return the found node or null
- */
- private Spatial findNode(Node rootNode, String name) {
- if (name.equals(rootNode.getName())) {
- return rootNode;
- }
- return rootNode.getChild(name);
- }
-}
diff --git a/jme3-blender/src/main/java/com/jme3/asset/BlenderKey.java b/jme3-blender/src/main/java/com/jme3/asset/BlenderKey.java
deleted file mode 100644
index 6dbb205b5..000000000
--- a/jme3-blender/src/main/java/com/jme3/asset/BlenderKey.java
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * Copyright (c) 2009-2018 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jme3.asset;
-
-import java.io.IOException;
-
-import com.jme3.export.InputCapsule;
-import com.jme3.export.JmeExporter;
-import com.jme3.export.JmeImporter;
-import com.jme3.export.OutputCapsule;
-import com.jme3.material.Material;
-import com.jme3.material.RenderState.FaceCullMode;
-
-/**
- * Blender key. Contains path of the blender file and its loading properties.
- * @author Marcin Roguski (Kaelthas)
- */
-public class BlenderKey extends ModelKey {
- protected static final int DEFAULT_FPS = 25;
- /**
- * FramesPerSecond parameter describe how many frames there are in each second. It allows to calculate the time
- * between the frames.
- */
- protected int fps = DEFAULT_FPS;
- /**
- * This variable is a bitwise flag of FeatureToLoad interface values; By default everything is being loaded.
- */
- protected int featuresToLoad = FeaturesToLoad.ALL;
- /** The variable that tells if content of the file (along with data unlinked to any feature on the scene) should be stored as 'user data' in the result spatial. */
- protected boolean loadUnlinkedAssets;
- /** The root path for all the assets. */
- protected String assetRootPath;
- /** This variable indicate if Y axis is UP axis. If not then Z is up. By default set to true. */
- protected boolean fixUpAxis = true;
- /** Generated textures resolution (PPU - Pixels Per Unit). */
- protected int generatedTexturePPU = 128;
- /**
- * The name of world settings that the importer will use. If not set or specified name does not occur in the file
- * then the first world settings in the file will be used.
- */
- protected String usedWorld;
- /**
- * User's default material that is set for objects that have no material definition in blender. The default value is
- * null. If the value is null the importer will use its own default material (gray color - like in blender).
- */
- protected Material defaultMaterial;
- /** Face cull mode. By default it is disabled. */
- protected FaceCullMode faceCullMode = FaceCullMode.Back;
- /**
- * Variable describes which layers will be loaded. N-th bit set means N-th layer will be loaded.
- * If set to -1 then the current layer will be loaded.
- */
- protected int layersToLoad = -1;
- /** A variable that toggles the object custom properties loading. */
- protected boolean loadObjectProperties = true;
- /**
- * Maximum texture size. Might be dependant on the graphic card.
- * This value is taken from org.lwjgl.opengl.GL11.GL_MAX_TEXTURE_SIZE.
- */
- protected int maxTextureSize = 8192;
- /** Allows to toggle generated textures loading. Disabled by default because it very often takes too much memory and needs to be used wisely. */
- protected boolean loadGeneratedTextures;
- /** Tells if the mipmaps will be generated by jme or not. By default generation is dependant on the blender settings. */
- protected MipmapGenerationMethod mipmapGenerationMethod = MipmapGenerationMethod.GENERATE_WHEN_NEEDED;
- /**
- * If the sky has only generated textures applied then they will have the following size (both width and height). If 2d textures are used then the generated
- * textures will get their proper size.
- */
- protected int skyGeneratedTextureSize = 1000;
- /** The radius of a shape that will be used while creating the generated texture for the sky. The higher it is the larger part of the texture will be seen. */
- protected float skyGeneratedTextureRadius = 1;
- /** The shape against which the generated texture for the sky will be created. */
- protected SkyGeneratedTextureShape skyGeneratedTextureShape = SkyGeneratedTextureShape.SPHERE;
- /**
- * This field tells if the importer should optimise the use of textures or not. If set to true, then textures of the same mapping type will be merged together
- * and textures that in the final result will never be visible - will be discarded.
- */
- protected boolean optimiseTextures;
- /** The method of matching animations to skeletons. The default value is: AT_LEAST_ONE_NAME_MATCH. */
- protected AnimationMatchMethod animationMatchMethod = AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH;
- /** The size of points that are loaded and do not belong to any edge of the mesh. */
- protected float pointsSize = 1;
- /** The width of edges that are loaded from the mesh and do not belong to any face. */
- protected float linesWidth = 1;
-
- /**
- * Constructor used by serialization mechanisms.
- */
- public BlenderKey() {
- }
-
- /**
- * Constructor. Creates a key for the given file name.
- * @param name
- * the name (path) of a file
- */
- public BlenderKey(String name) {
- super(name);
- }
-
- /**
- * This method returns frames per second amount. The default value is BlenderKey.DEFAULT_FPS = 25.
- * @return the frames per second amount
- */
- public int getFps() {
- return fps;
- }
-
- /**
- * This method sets frames per second amount.
- * @param fps
- * the frames per second amount
- */
- public void setFps(int fps) {
- this.fps = fps;
- }
-
- /**
- * This method returns the face cull mode.
- * @return the face cull mode
- */
- public FaceCullMode getFaceCullMode() {
- return faceCullMode;
- }
-
- /**
- * This method sets the face cull mode.
- * @param faceCullMode
- * the face cull mode
- */
- public void setFaceCullMode(FaceCullMode faceCullMode) {
- this.faceCullMode = faceCullMode;
- }
-
- /**
- * This method sets layers to be loaded.
- * @param layersToLoad
- * layers to be loaded
- */
- public void setLayersToLoad(int layersToLoad) {
- this.layersToLoad = layersToLoad;
- }
-
- /**
- * This method returns layers to be loaded.
- * @return layers to be loaded
- */
- public int getLayersToLoad() {
- return layersToLoad;
- }
-
- /**
- * This method sets the properies loading policy.
- * By default the value is true.
- * @param loadObjectProperties
- * true to load properties and false to suspend their loading
- */
- public void setLoadObjectProperties(boolean loadObjectProperties) {
- this.loadObjectProperties = loadObjectProperties;
- }
-
- /**
- * @return the current properties loading properties
- */
- public boolean isLoadObjectProperties() {
- return loadObjectProperties;
- }
-
- /**
- * The default value for this parameter is the same as defined by: org.lwjgl.opengl.GL11.GL_MAX_TEXTURE_SIZE.
- * If by any means this is too large for user's hardware configuration use the 'setMaxTextureSize' method to change that.
- * @return maximum texture size (width/height)
- */
- public int getMaxTextureSize() {
- return maxTextureSize;
- }
-
- /**
- * This method sets the maximum texture size.
- * @param maxTextureSize
- * the maximum texture size
- */
- public void setMaxTextureSize(int maxTextureSize) {
- this.maxTextureSize = maxTextureSize;
- }
-
- /**
- * This method sets the flag that toggles the generated textures loading.
- * @param loadGeneratedTextures
- * true if generated textures should be loaded and false otherwise
- */
- public void setLoadGeneratedTextures(boolean loadGeneratedTextures) {
- this.loadGeneratedTextures = loadGeneratedTextures;
- }
-
- /**
- * @return tells if the generated textures should be loaded (false is the default value)
- */
- public boolean isLoadGeneratedTextures() {
- return loadGeneratedTextures;
- }
-
- /**
- * Not used any more.
- * This method sets the asset root path.
- * @param assetRootPath
- * the assets root path
- */
- @Deprecated
- public void setAssetRootPath(String assetRootPath) {
- this.assetRootPath = assetRootPath;
- }
-
- /**
- * Not used any more.
- * This method returns the asset root path.
- * @return the asset root path
- */
- @Deprecated
- public String getAssetRootPath() {
- return assetRootPath;
- }
-
- /**
- * This method adds features to be loaded.
- * @param featuresToLoad
- * bitwise flag of FeaturesToLoad interface values
- */
- @Deprecated
- public void includeInLoading(int featuresToLoad) {
- this.featuresToLoad |= featuresToLoad;
- }
-
- /**
- * This method removes features from being loaded.
- * @param featuresNotToLoad
- * bitwise flag of FeaturesToLoad interface values
- */
- @Deprecated
- public void excludeFromLoading(int featuresNotToLoad) {
- featuresToLoad &= ~featuresNotToLoad;
- }
-
- @Deprecated
- public boolean shouldLoad(int featureToLoad) {
- return (featuresToLoad & featureToLoad) != 0;
- }
-
- /**
- * This method returns bitwise value of FeaturesToLoad interface value. It describes features that will be loaded by
- * the blender file loader.
- * @return features that will be loaded by the blender file loader
- */
- @Deprecated
- public int getFeaturesToLoad() {
- return featuresToLoad;
- }
-
- /**
- * This method determines if unlinked assets should be loaded.
- * If not then only objects on selected layers will be loaded and their assets if required.
- * If yes then all assets will be loaded even if they are on inactive layers or are not linked
- * to anything.
- * @return true if unlinked assets should be loaded and false otherwise
- */
- public boolean isLoadUnlinkedAssets() {
- return loadUnlinkedAssets;
- }
-
- /**
- * This method sets if unlinked assets should be loaded.
- * If not then only objects on selected layers will be loaded and their assets if required.
- * If yes then all assets will be loaded even if they are on inactive layers or are not linked
- * to anything.
- * @param loadUnlinkedAssets
- * true if unlinked assets should be loaded and false otherwise
- */
- public void setLoadUnlinkedAssets(boolean loadUnlinkedAssets) {
- this.loadUnlinkedAssets = loadUnlinkedAssets;
- }
-
- /**
- * This method sets the fix up axis state. If set to true then Y is up axis. Otherwise the up i Z axis. By default Y
- * is up axis.
- * @param fixUpAxis
- * the up axis state variable
- */
- public void setFixUpAxis(boolean fixUpAxis) {
- this.fixUpAxis = fixUpAxis;
- }
-
- /**
- * This method returns the fix up axis state. If set to true then Y is up axis. Otherwise the up i Z axis. By
- * default Y is up axis.
- * @return the up axis state variable
- */
- public boolean isFixUpAxis() {
- return fixUpAxis;
- }
-
- /**
- * This method sets the generated textures resolution.
- * @param generatedTexturePPU
- * the generated textures resolution
- */
- public void setGeneratedTexturePPU(int generatedTexturePPU) {
- this.generatedTexturePPU = generatedTexturePPU;
- }
-
- /**
- * @return the generated textures resolution
- */
- public int getGeneratedTexturePPU() {
- return generatedTexturePPU;
- }
-
- /**
- * @return mipmaps generation method
- */
- public MipmapGenerationMethod getMipmapGenerationMethod() {
- return mipmapGenerationMethod;
- }
-
- /**
- * @param mipmapGenerationMethod
- * mipmaps generation method
- */
- public void setMipmapGenerationMethod(MipmapGenerationMethod mipmapGenerationMethod) {
- this.mipmapGenerationMethod = mipmapGenerationMethod;
- }
-
- /**
- * @return the size of the generated textures for the sky (used if no flat textures are applied)
- */
- public int getSkyGeneratedTextureSize() {
- return skyGeneratedTextureSize;
- }
-
- /**
- * @param skyGeneratedTextureSize
- * the size of the generated textures for the sky (used if no flat textures are applied)
- */
- public void setSkyGeneratedTextureSize(int skyGeneratedTextureSize) {
- if (skyGeneratedTextureSize <= 0) {
- throw new IllegalArgumentException("The texture size must be a positive value (the value given as a parameter: " + skyGeneratedTextureSize + ")!");
- }
- this.skyGeneratedTextureSize = skyGeneratedTextureSize;
- }
-
- /**
- * @return the radius of a shape that will be used while creating the generated texture for the sky, the higher it is the larger part of the texture will be seen
- */
- public float getSkyGeneratedTextureRadius() {
- return skyGeneratedTextureRadius;
- }
-
- /**
- * @param skyGeneratedTextureRadius
- * the radius of a shape that will be used while creating the generated texture for the sky, the higher it is the larger part of the texture will be seen
- */
- public void setSkyGeneratedTextureRadius(float skyGeneratedTextureRadius) {
- this.skyGeneratedTextureRadius = skyGeneratedTextureRadius;
- }
-
- /**
- * @return the shape against which the generated texture for the sky will be created (by default it is a sphere).
- */
- public SkyGeneratedTextureShape getSkyGeneratedTextureShape() {
- return skyGeneratedTextureShape;
- }
-
- /**
- * @param skyGeneratedTextureShape
- * the shape against which the generated texture for the sky will be created
- */
- public void setSkyGeneratedTextureShape(SkyGeneratedTextureShape skyGeneratedTextureShape) {
- if (skyGeneratedTextureShape == null) {
- throw new IllegalArgumentException("The sky generated shape type cannot be null!");
- }
- this.skyGeneratedTextureShape = skyGeneratedTextureShape;
- }
-
- /**
- * If set to true, then textures of the same mapping type will be merged together
- * and textures that in the final result will never be visible - will be discarded.
- * @param optimiseTextures
- * the variable that tells if the textures should be optimised or not
- */
- public void setOptimiseTextures(boolean optimiseTextures) {
- this.optimiseTextures = optimiseTextures;
- }
-
- /**
- * @return the variable that tells if the textures should be optimised or not (by default the optimisation is disabled)
- */
- public boolean isOptimiseTextures() {
- return optimiseTextures;
- }
-
- /**
- * Sets the way the animations will be matched with skeletons.
- *
- * @param animationMatchMethod
- * the way the animations will be matched with skeletons
- */
- public void setAnimationMatchMethod(AnimationMatchMethod animationMatchMethod) {
- this.animationMatchMethod = animationMatchMethod;
- }
-
- /**
- * @return the way the animations will be matched with skeletons
- */
- public AnimationMatchMethod getAnimationMatchMethod() {
- return animationMatchMethod;
- }
-
- /**
- * @return the size of points that are loaded and do not belong to any edge of the mesh
- */
- public float getPointsSize() {
- return pointsSize;
- }
-
- /**
- * Sets the size of points that are loaded and do not belong to any edge of the mesh.
- * @param pointsSize
- * The size of points that are loaded and do not belong to any edge of the mesh
- */
- public void setPointsSize(float pointsSize) {
- this.pointsSize = pointsSize;
- }
-
- /**
- * @return the width of edges that are loaded from the mesh and do not belong to any face
- */
- public float getLinesWidth() {
- return linesWidth;
- }
-
- /**
- * Sets the width of edges that are loaded from the mesh and do not belong to any face.
- * @param linesWidth
- * the width of edges that are loaded from the mesh and do not belong to any face
- */
- public void setLinesWidth(float linesWidth) {
- this.linesWidth = linesWidth;
- }
-
- /**
- * This method sets the name of the WORLD data block that should be used during file loading. By default the name is
- * not set. If no name is set or the given name does not occur in the file - the first WORLD data block will be used
- * during loading (assuming any exists in the file).
- * @param usedWorld
- * the name of the WORLD block used during loading
- */
- public void setUsedWorld(String usedWorld) {
- this.usedWorld = usedWorld;
- }
-
- /**
- * This method returns the name of the WORLD data block that should be used during file loading.
- * @return the name of the WORLD block used during loading
- */
- public String getUsedWorld() {
- return usedWorld;
- }
-
- /**
- * This method sets the default material for objects.
- * @param defaultMaterial
- * the default material
- */
- public void setDefaultMaterial(Material defaultMaterial) {
- this.defaultMaterial = defaultMaterial;
- }
-
- /**
- * This method returns the default material.
- * @return the default material
- */
- public Material getDefaultMaterial() {
- return defaultMaterial;
- }
-
- @Override
- public void write(JmeExporter e) throws IOException {
- super.write(e);
- OutputCapsule oc = e.getCapsule(this);
- oc.write(fps, "fps", DEFAULT_FPS);
- oc.write(featuresToLoad, "features-to-load", FeaturesToLoad.ALL);
- oc.write(loadUnlinkedAssets, "load-unlinked-assets", false);
- oc.write(assetRootPath, "asset-root-path", null);
- oc.write(fixUpAxis, "fix-up-axis", true);
- oc.write(generatedTexturePPU, "generated-texture-ppu", 128);
- oc.write(usedWorld, "used-world", null);
- oc.write(defaultMaterial, "default-material", null);
- oc.write(faceCullMode, "face-cull-mode", FaceCullMode.Off);
- oc.write(layersToLoad, "layers-to-load", -1);
- oc.write(mipmapGenerationMethod, "mipmap-generation-method", MipmapGenerationMethod.GENERATE_WHEN_NEEDED);
- oc.write(skyGeneratedTextureSize, "sky-generated-texture-size", 1000);
- oc.write(skyGeneratedTextureRadius, "sky-generated-texture-radius", 1f);
- oc.write(skyGeneratedTextureShape, "sky-generated-texture-shape", SkyGeneratedTextureShape.SPHERE);
- oc.write(optimiseTextures, "optimise-textures", false);
- oc.write(animationMatchMethod, "animation-match-method", AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH);
- oc.write(pointsSize, "points-size", 1);
- oc.write(linesWidth, "lines-width", 1);
- }
-
- @Override
- public void read(JmeImporter e) throws IOException {
- super.read(e);
- InputCapsule ic = e.getCapsule(this);
- fps = ic.readInt("fps", DEFAULT_FPS);
- featuresToLoad = ic.readInt("features-to-load", FeaturesToLoad.ALL);
- loadUnlinkedAssets = ic.readBoolean("load-unlinked-assets", false);
- assetRootPath = ic.readString("asset-root-path", null);
- fixUpAxis = ic.readBoolean("fix-up-axis", true);
- generatedTexturePPU = ic.readInt("generated-texture-ppu", 128);
- usedWorld = ic.readString("used-world", null);
- defaultMaterial = (Material) ic.readSavable("default-material", null);
- faceCullMode = ic.readEnum("face-cull-mode", FaceCullMode.class, FaceCullMode.Off);
- layersToLoad = ic.readInt("layers-to=load", -1);
- mipmapGenerationMethod = ic.readEnum("mipmap-generation-method", MipmapGenerationMethod.class, MipmapGenerationMethod.GENERATE_WHEN_NEEDED);
- skyGeneratedTextureSize = ic.readInt("sky-generated-texture-size", 1000);
- skyGeneratedTextureRadius = ic.readFloat("sky-generated-texture-radius", 1f);
- skyGeneratedTextureShape = ic.readEnum("sky-generated-texture-shape", SkyGeneratedTextureShape.class, SkyGeneratedTextureShape.SPHERE);
- optimiseTextures = ic.readBoolean("optimise-textures", false);
- animationMatchMethod = ic.readEnum("animation-match-method", AnimationMatchMethod.class, AnimationMatchMethod.AT_LEAST_ONE_NAME_MATCH);
- pointsSize = ic.readFloat("points-size", 1);
- linesWidth = ic.readFloat("lines-width", 1);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + (animationMatchMethod == null ? 0 : animationMatchMethod.hashCode());
- result = prime * result + (assetRootPath == null ? 0 : assetRootPath.hashCode());
- result = prime * result + (defaultMaterial == null ? 0 : defaultMaterial.hashCode());
- result = prime * result + (faceCullMode == null ? 0 : faceCullMode.hashCode());
- result = prime * result + featuresToLoad;
- result = prime * result + (fixUpAxis ? 1231 : 1237);
- result = prime * result + fps;
- result = prime * result + generatedTexturePPU;
- result = prime * result + layersToLoad;
- result = prime * result + (loadGeneratedTextures ? 1231 : 1237);
- result = prime * result + (loadObjectProperties ? 1231 : 1237);
- result = prime * result + (loadUnlinkedAssets ? 1231 : 1237);
- result = prime * result + maxTextureSize;
- result = prime * result + (mipmapGenerationMethod == null ? 0 : mipmapGenerationMethod.hashCode());
- result = prime * result + (optimiseTextures ? 1231 : 1237);
- result = prime * result + Float.floatToIntBits(skyGeneratedTextureRadius);
- result = prime * result + (skyGeneratedTextureShape == null ? 0 : skyGeneratedTextureShape.hashCode());
- result = prime * result + skyGeneratedTextureSize;
- result = prime * result + (usedWorld == null ? 0 : usedWorld.hashCode());
- result = prime * result + (int) pointsSize;
- result = prime * result + (int) linesWidth;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof BlenderKey) {
- return false;
- }
- BlenderKey other = (BlenderKey) obj;
- if (animationMatchMethod != other.animationMatchMethod) {
- return false;
- }
- if (assetRootPath == null) {
- if (other.assetRootPath != null) {
- return false;
- }
- } else if (!assetRootPath.equals(other.assetRootPath)) {
- return false;
- }
- if (defaultMaterial == null) {
- if (other.defaultMaterial != null) {
- return false;
- }
- } else if (!defaultMaterial.equals(other.defaultMaterial)) {
- return false;
- }
- if (faceCullMode != other.faceCullMode) {
- return false;
- }
- if (featuresToLoad != other.featuresToLoad) {
- return false;
- }
- if (fixUpAxis != other.fixUpAxis) {
- return false;
- }
- if (fps != other.fps) {
- return false;
- }
- if (generatedTexturePPU != other.generatedTexturePPU) {
- return false;
- }
- if (layersToLoad != other.layersToLoad) {
- return false;
- }
- if (loadGeneratedTextures != other.loadGeneratedTextures) {
- return false;
- }
- if (loadObjectProperties != other.loadObjectProperties) {
- return false;
- }
- if (loadUnlinkedAssets != other.loadUnlinkedAssets) {
- return false;
- }
- if (maxTextureSize != other.maxTextureSize) {
- return false;
- }
- if (mipmapGenerationMethod != other.mipmapGenerationMethod) {
- return false;
- }
- if (optimiseTextures != other.optimiseTextures) {
- return false;
- }
- if (Float.floatToIntBits(skyGeneratedTextureRadius) != Float.floatToIntBits(other.skyGeneratedTextureRadius)) {
- return false;
- }
- if (skyGeneratedTextureShape != other.skyGeneratedTextureShape) {
- return false;
- }
- if (skyGeneratedTextureSize != other.skyGeneratedTextureSize) {
- return false;
- }
- if (usedWorld == null) {
- if (other.usedWorld != null) {
- return false;
- }
- } else if (!usedWorld.equals(other.usedWorld)) {
- return false;
- }
- if (pointsSize != other.pointsSize) {
- return false;
- }
- if (linesWidth != other.linesWidth) {
- return false;
- }
- return true;
- }
-
- /**
- * This enum tells the importer if the mipmaps for textures will be generated by jme.
NEVER_GENERATE and ALWAYS_GENERATE are quite understandable
GENERATE_WHEN_NEEDED is an option that checks if the texture had 'Generate mipmaps' option set in blender, mipmaps are generated only when the option is set
- * @author Marcin Roguski (Kaelthas)
- */
- public static enum MipmapGenerationMethod {
- NEVER_GENERATE, ALWAYS_GENERATE, GENERATE_WHEN_NEEDED;
- }
-
- /**
- * This interface describes the features of the scene that are to be loaded.
- * @deprecated this interface is deprecated and is not used anymore; to ensure the loading models consistency
- * everything must be loaded because in blender one feature might depend on another
- * @author Marcin Roguski (Kaelthas)
- */
- @Deprecated
- public static interface FeaturesToLoad {
-
- int SCENES = 0x0000FFFF;
- int OBJECTS = 0x0000000B;
- int ANIMATIONS = 0x00000004;
- int MATERIALS = 0x00000003;
- int TEXTURES = 0x00000001;
- int CAMERAS = 0x00000020;
- int LIGHTS = 0x00000010;
- int WORLD = 0x00000040;
- int ALL = 0xFFFFFFFF;
- }
-
- /**
- * The shape againts which the sky generated texture will be created.
- *
- * @author Marcin Roguski (Kaelthas)
- */
- public static enum SkyGeneratedTextureShape {
- CUBE, SPHERE;
- }
-
- /**
- * This enum describes which animations should be attached to which armature.
- * Blender does not store the mapping between action and armature. That is why the importer
- * will try to match those by comparing bone name of the armature with the channel names
- * int the actions.
- *
- * @author Marcin Roguski (Kaelthas)
- */
- public static enum AnimationMatchMethod {
- /**
- * Animation is matched with skeleton when at leas one bone name matches the name of the action channel.
- * All the bones that do not have their corresponding channel in the animation will not get the proper tracks for
- * this particulat animation.
- * Also the channel will not be used for the animation if it does not find the proper bone name.
- */
- AT_LEAST_ONE_NAME_MATCH,
- /**
- * Animation is matched when all action names are covered by the target names (bone names or the name of the
- * animated spatial.
- */
- ALL_NAMES_MATCH;
- }
-}
diff --git a/jme3-blender/src/main/java/com/jme3/asset/GeneratedTextureKey.java b/jme3-blender/src/main/java/com/jme3/asset/GeneratedTextureKey.java
deleted file mode 100644
index 6bd9017ae..000000000
--- a/jme3-blender/src/main/java/com/jme3/asset/GeneratedTextureKey.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2009-2012 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.jme3.asset;
-
-/**
- * This key is mostly used to distinguish between textures that are loaded from
- * the given assets and those being generated automatically. Every generated
- * texture will have this kind of key attached.
- *
- * @author Marcin Roguski (Kaelthas)
- */
-public class GeneratedTextureKey extends TextureKey {
-
- /**
- * Constructor. Stores the name. Extension and folder name are empty
- * strings.
- *
- * @param name
- * the name of the texture
- */
- public GeneratedTextureKey(String name) {
- super(name);
- }
-
- @Override
- public String getExtension() {
- return "";
- }
-
- @Override
- public String getFolder() {
- return "";
- }
-
- @Override
- public String toString() {
- return "Generated texture [" + name + "]";
- }
-}
diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java
deleted file mode 100644
index 142f757e2..000000000
--- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2009-2012 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jme3.scene.plugins.blender;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.jme3.asset.AssetNotFoundException;
-import com.jme3.asset.BlenderKey;
-import com.jme3.export.Savable;
-import com.jme3.math.FastMath;
-import com.jme3.math.Quaternion;
-import com.jme3.scene.Spatial;
-import com.jme3.scene.plugins.blender.BlenderContext.LoadedDataType;
-import com.jme3.scene.plugins.blender.file.BlenderFileException;
-import com.jme3.scene.plugins.blender.file.Pointer;
-import com.jme3.scene.plugins.blender.file.Structure;
-import com.jme3.scene.plugins.blender.objects.Properties;
-
-/**
- * A purpose of the helper class is to split calculation code into several classes. Each helper after use should be cleared because it can
- * hold the state of the calculations.
- * @author Marcin Roguski
- */
-public abstract class AbstractBlenderHelper {
- private static final Logger LOGGER = Logger.getLogger(AbstractBlenderHelper.class.getName());
-
- /** The blender context. */
- protected BlenderContext blenderContext;
- /** The version of the blend file. */
- protected final int blenderVersion;
- /** This variable indicates if the Y asxis is the UP axis or not. */
- protected boolean fixUpAxis;
- /** Quaternion used to rotate data when Y is up axis. */
- protected Quaternion upAxisRotationQuaternion;
-
- /**
- * This constructor parses the given blender version and stores the result. Some functionalities may differ in different blender
- * versions.
- * @param blenderVersion
- * the version read from the blend file
- * @param blenderContext
- * the blender context
- */
- public AbstractBlenderHelper(String blenderVersion, BlenderContext blenderContext) {
- this.blenderVersion = Integer.parseInt(blenderVersion);
- this.blenderContext = blenderContext;
- fixUpAxis = blenderContext.getBlenderKey().isFixUpAxis();
- if (fixUpAxis) {
- upAxisRotationQuaternion = new Quaternion().fromAngles(-FastMath.HALF_PI, 0, 0);
- }
- }
-
- /**
- * This method loads the properties if they are available and defined for the structure.
- * @param structure
- * the structure we read the properties from
- * @param blenderContext
- * the blender context
- * @return loaded properties or null if they are not available
- * @throws BlenderFileException
- * an exception is thrown when the blend file is somehow corrupted
- */
- protected Properties loadProperties(Structure structure, BlenderContext blenderContext) throws BlenderFileException {
- Properties properties = null;
- Structure id = (Structure) structure.getFieldValue("ID");
- if (id != null) {
- Pointer pProperties = (Pointer) id.getFieldValue("properties");
- if (pProperties.isNotNull()) {
- Structure propertiesStructure = pProperties.fetchData().get(0);
- properties = new Properties();
- properties.load(propertiesStructure, blenderContext);
- }
- }
- return properties;
- }
-
- /**
- * The method applies properties to the given spatial. The Properties
- * instance cannot be directly applied because the end-user might not have
- * the blender plugin jar file and thus receive ClassNotFoundException. The
- * values are set by name instead.
- *
- * @param spatial
- * the spatial that is to have properties applied
- * @param properties
- * the properties to be applied
- */
- public void applyProperties(Spatial spatial, Properties properties) {
- List propertyNames = properties.getSubPropertiesNames();
- if (propertyNames != null && propertyNames.size() > 0) {
- for (String propertyName : propertyNames) {
- Object value = properties.findValue(propertyName);
- if (value instanceof Savable || value instanceof Boolean || value instanceof String || value instanceof Float || value instanceof Integer || value instanceof Long) {
- spatial.setUserData(propertyName, value);
- } else if (value instanceof Double) {
- spatial.setUserData(propertyName, ((Double) value).floatValue());
- } else if (value instanceof int[]) {
- spatial.setUserData(propertyName, Arrays.toString((int[]) value));
- } else if (value instanceof float[]) {
- spatial.setUserData(propertyName, Arrays.toString((float[]) value));
- } else if (value instanceof double[]) {
- spatial.setUserData(propertyName, Arrays.toString((double[]) value));
- }
- }
- }
- }
-
- /**
- * The method loads library of a given ID from linked blender file.
- * @param id
- * the ID of the linked feature (it contains its name and blender path)
- * @return loaded feature or null if none was found
- * @throws BlenderFileException
- * and exception is throw when problems with reading a blend file occur
- */
- protected Object loadLibrary(Structure id) throws BlenderFileException {
- Pointer pLib = (Pointer) id.getFieldValue("lib");
- if (pLib.isNotNull()) {
- String fullName = id.getFieldValue("name").toString();// we need full name with the prefix
- String nameOfFeatureToLoad = id.getName();
- Structure library = pLib.fetchData().get(0);
- String path = library.getFieldValue("filepath").toString();
-
- if (!blenderContext.getLinkedFeatures().keySet().contains(path)) {
- Spatial loadedAsset = null;
- BlenderKey blenderKey = new BlenderKey(path);
- blenderKey.setLoadUnlinkedAssets(true);
- try {
- loadedAsset = blenderContext.getAssetManager().loadAsset(blenderKey);
- } catch (AssetNotFoundException e) {
- LOGGER.log(Level.FINEST, "Cannot locate linked resource at path: {0}.", path);
- }
-
- if (loadedAsset != null) {
- Map> linkedData = loadedAsset.getUserData("linkedData");
-
- for (Entry> entry : linkedData.entrySet()) {
- String linkedDataFilePath = "this".equals(entry.getKey()) ? path : entry.getKey();
- blenderContext.getLinkedFeatures().put(linkedDataFilePath, entry.getValue());
- }
- } else {
- LOGGER.log(Level.WARNING, "No features loaded from path: {0}.", path);
- }
- }
-
- Object result = blenderContext.getLinkedFeature(path, fullName);
- if (result == null) {
- LOGGER.log(Level.WARNING, "Could NOT find asset named {0} in the library of path: {1}.", new Object[] { nameOfFeatureToLoad, path });
- } else {
- blenderContext.addLoadedFeatures(id.getOldMemoryAddress(), LoadedDataType.STRUCTURE, id);
- blenderContext.addLoadedFeatures(id.getOldMemoryAddress(), LoadedDataType.FEATURE, result);
- }
- return result;
- } else {
- LOGGER.warning("Library link points to nothing!");
- }
- return null;
- }
-}
diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/BlenderContext.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/BlenderContext.java
deleted file mode 100644
index fea54f13b..000000000
--- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/BlenderContext.java
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * Copyright (c) 2009-2019 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jme3.scene.plugins.blender;
-
-import java.util.ArrayList;
-import java.util.EmptyStackException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Stack;
-
-import com.jme3.animation.Animation;
-import com.jme3.animation.Bone;
-import com.jme3.animation.Skeleton;
-import com.jme3.asset.AssetManager;
-import com.jme3.asset.BlenderKey;
-import com.jme3.light.Light;
-import com.jme3.material.Material;
-import com.jme3.math.ColorRGBA;
-import com.jme3.post.Filter;
-import com.jme3.renderer.Camera;
-import com.jme3.scene.Node;
-import com.jme3.scene.plugins.blender.animations.BlenderAction;
-import com.jme3.scene.plugins.blender.animations.BoneContext;
-import com.jme3.scene.plugins.blender.constraints.Constraint;
-import com.jme3.scene.plugins.blender.file.BlenderInputStream;
-import com.jme3.scene.plugins.blender.file.DnaBlockData;
-import com.jme3.scene.plugins.blender.file.FileBlockHeader;
-import com.jme3.scene.plugins.blender.file.FileBlockHeader.BlockCode;
-import com.jme3.scene.plugins.blender.file.Structure;
-import com.jme3.scene.plugins.blender.materials.MaterialContext;
-import com.jme3.scene.plugins.blender.meshes.TemporalMesh;
-import com.jme3.texture.Texture;
-
-/**
- * The class that stores temporary data and manages it during loading the belnd
- * file. This class is intended to be used in a single loading thread. It holds
- * the state of loading operations.
- *
- * @author Marcin Roguski (Kaelthas)
- */
-public class BlenderContext {
- /** The blender file version. */
- private int blenderVersion;
- /** The blender key. */
- private BlenderKey blenderKey;
- /** The header of the file block. */
- private DnaBlockData dnaBlockData;
- /** The scene structure. */
- private Structure sceneStructure;
- /** The input stream of the blend file. */
- private BlenderInputStream inputStream;
- /** The asset manager. */
- private AssetManager assetManager;
- /** The blocks read from the file. */
- protected List blocks = new ArrayList();
- /**
- * A map containing the file block headers. The key is the old memory address.
- */
- private Map fileBlockHeadersByOma = new HashMap();
- /** A map containing the file block headers. The key is the block code. */
- private Map> fileBlockHeadersByCode = new HashMap>();
- /**
- * This map stores the loaded features by their old memory address. The
- * first object in the value table is the loaded structure and the second -
- * the structure already converted into proper data.
- */
- private Map> loadedFeatures = new HashMap>();
- /** Features loaded from external blender files. The key is the file path and the value is a map between feature name and loaded feature. */
- private Map> linkedFeatures = new HashMap>();
- /** A stack that hold the parent structure of currently loaded feature. */
- private Stack parentStack = new Stack();
- /** A list of constraints for the specified object. */
- protected Map> constraints = new HashMap>();
- /** Animations loaded for features. */
- private Map> animations = new HashMap>();
- /** Loaded skeletons. */
- private Map skeletons = new HashMap();
- /** A map between skeleton and node it modifies. */
- private Map nodesWithSkeletons = new HashMap();
- /** A map of bone contexts. */
- protected Map boneContexts = new HashMap();
- /** A map og helpers that perform loading. */
- private Map helpers = new HashMap();
- /** Markers used by loading classes to store some custom data. This is made to avoid putting this data into user properties. */
- private Map> markers = new HashMap>();
- /** A map of blender actions. The key is the action name and the value is the action itself. */
- private Map actions = new HashMap();
-
- /**
- * This method sets the blender file version.
- *
- * @param blenderVersion
- * the blender file version
- */
- public void setBlenderVersion(String blenderVersion) {
- this.blenderVersion = Integer.parseInt(blenderVersion);
- }
-
- /**
- * @return the blender file version
- */
- public int getBlenderVersion() {
- return blenderVersion;
- }
-
- /**
- * This method sets the blender key.
- *
- * @param blenderKey
- * the blender key
- */
- public void setBlenderKey(BlenderKey blenderKey) {
- this.blenderKey = blenderKey;
- }
-
- /**
- * This method returns the blender key.
- *
- * @return the blender key
- */
- public BlenderKey getBlenderKey() {
- return blenderKey;
- }
-
- /**
- * This method sets the dna block data.
- *
- * @param dnaBlockData
- * the dna block data
- */
- public void setBlockData(DnaBlockData dnaBlockData) {
- this.dnaBlockData = dnaBlockData;
- }
-
- /**
- * This method returns the dna block data.
- *
- * @return the dna block data
- */
- public DnaBlockData getDnaBlockData() {
- return dnaBlockData;
- }
-
- /**
- * This method sets the scene structure data.
- *
- * @param sceneStructure
- * the scene structure data
- */
- public void setSceneStructure(Structure sceneStructure) {
- this.sceneStructure = sceneStructure;
- }
-
- /**
- * This method returns the scene structure data.
- *
- * @return the scene structure data
- */
- public Structure getSceneStructure() {
- return sceneStructure;
- }
-
- /**
- * This method returns the asset manager.
- *
- * @return the asset manager
- */
- public AssetManager getAssetManager() {
- return assetManager;
- }
-
- /**
- * This method sets the asset manager.
- *
- * @param assetManager
- * the asset manager
- */
- public void setAssetManager(AssetManager assetManager) {
- this.assetManager = assetManager;
- }
-
- /**
- * This method returns the input stream of the blend file.
- *
- * @return the input stream of the blend file
- */
- public BlenderInputStream getInputStream() {
- return inputStream;
- }
-
- /**
- * This method sets the input stream of the blend file.
- *
- * @param inputStream
- * the input stream of the blend file
- */
- public void setInputStream(BlenderInputStream inputStream) {
- this.inputStream = inputStream;
- }
-
- /**
- * This method adds a file block header to the map. Its old memory address
- * is the key.
- *
- * @param oldMemoryAddress
- * the address of the block header
- * @param fileBlockHeader
- * the block header to store
- */
- public void addFileBlockHeader(Long oldMemoryAddress, FileBlockHeader fileBlockHeader) {
- blocks.add(fileBlockHeader);
- fileBlockHeadersByOma.put(oldMemoryAddress, fileBlockHeader);
- List headers = fileBlockHeadersByCode.get(fileBlockHeader.getCode());
- if (headers == null) {
- headers = new ArrayList();
- fileBlockHeadersByCode.put(fileBlockHeader.getCode(), headers);
- }
- headers.add(fileBlockHeader);
- }
-
- /**
- * @return the block headers
- */
- public List getBlocks() {
- return blocks;
- }
-
- /**
- * This method returns the block header of a given memory address. If the
- * header is not present then null is returned.
- *
- * @param oldMemoryAddress
- * the address of the block header
- * @return loaded header or null if it was not yet loaded
- */
- public FileBlockHeader getFileBlock(Long oldMemoryAddress) {
- return fileBlockHeadersByOma.get(oldMemoryAddress);
- }
-
- /**
- * This method returns a list of file blocks' headers of a specified code.
- *
- * @param code
- * the code of file blocks
- * @return a list of file blocks' headers of a specified code
- */
- public List getFileBlocks(BlockCode code) {
- return fileBlockHeadersByCode.get(code);
- }
-
- /**
- * This method adds a helper instance to the helpers' map.
- *
- * @param
- * the type of the helper
- * @param clazz
- * helper's class definition
- * @param helper
- * the helper instance
- */
- public void putHelper(Class clazz, AbstractBlenderHelper helper) {
- helpers.put(clazz.getSimpleName(), helper);
- }
-
- @SuppressWarnings("unchecked")
- public T getHelper(Class> clazz) {
- return (T) helpers.get(clazz.getSimpleName());
- }
-
- /**
- * This method adds a loaded feature to the map. The key is its unique old
- * memory address.
- *
- * @param oldMemoryAddress
- * the address of the feature
- * @param featureDataType
- * @param feature
- * the feature we want to store
- */
- public void addLoadedFeatures(Long oldMemoryAddress, LoadedDataType featureDataType, Object feature) {
- if (oldMemoryAddress == null || featureDataType == null || feature == null) {
- throw new IllegalArgumentException("One of the given arguments is null!");
- }
- Map map = loadedFeatures.get(oldMemoryAddress);
- if (map == null) {
- map = new HashMap();
- loadedFeatures.put(oldMemoryAddress, map);
- }
- map.put(featureDataType, feature);
- }
-
- /**
- * This method returns the feature of a given memory address. If the feature
- * is not yet loaded then null is returned.
- *
- * @param oldMemoryAddress
- * the address of the feature
- * @param loadedFeatureDataType
- * the type of data we want to retrieve it can be either filled
- * structure or already converted feature
- * @return loaded feature or null if it was not yet loaded
- */
- public Object getLoadedFeature(Long oldMemoryAddress, LoadedDataType loadedFeatureDataType) {
- Map result = loadedFeatures.get(oldMemoryAddress);
- if (result != null) {
- return result.get(loadedFeatureDataType);
- }
- return null;
- }
-
- /**
- * The method adds linked content to the blender context.
- * @param blenderFilePath
- * the path of linked blender file
- * @param featureGroup
- * the linked feature group (ie. scenes, materials, meshes, etc.)
- * @param feature
- * the linked feature
- */
- @Deprecated
- public void addLinkedFeature(String blenderFilePath, String featureGroup, Object feature) {
- // the method is deprecated and empty at the moment
- }
-
- /**
- * The method returns linked feature of a given name from the specified blender path.
- * @param blenderFilePath
- * the blender file path
- * @param featureName
- * the feature name we want to get
- * @return linked feature or null if none was found
- */
- @SuppressWarnings("unchecked")
- public Object getLinkedFeature(String blenderFilePath, String featureName) {
- Map linkedFeatures = this.linkedFeatures.get(blenderFilePath);
- if(linkedFeatures != null) {
- String namePrefix = (featureName.charAt(0) + "" + featureName.charAt(1)).toUpperCase();
- featureName = featureName.substring(2);
-
- if("SC".equals(namePrefix)) {
- List scenes = (List) linkedFeatures.get("scenes");
- if(scenes != null) {
- for(Node scene : scenes) {
- if(featureName.equals(scene.getName())) {
- return scene;
- }
- }
- }
- } else if("OB".equals(namePrefix)) {
- List features = (List) linkedFeatures.get("objects");
- if(features != null) {
- for(Node feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- } else if("ME".equals(namePrefix)) {
- List temporalMeshes = (List) linkedFeatures.get("meshes");
- if(temporalMeshes != null) {
- for(TemporalMesh temporalMesh : temporalMeshes) {
- if(featureName.equals(temporalMesh.getName())) {
- return temporalMesh;
- }
- }
- }
- } else if("MA".equals(namePrefix)) {
- List features = (List) linkedFeatures.get("materials");
- if(features != null) {
- for(MaterialContext feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- } else if("TX".equals(namePrefix)) {
- List features = (List) linkedFeatures.get("textures");
- if(features != null) {
- for(Texture feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- } else if("IM".equals(namePrefix)) {
- List features = (List) linkedFeatures.get("images");
- if(features != null) {
- for(Texture feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- } else if("AC".equals(namePrefix)) {
- List features = (List) linkedFeatures.get("animations");
- if(features != null) {
- for(Animation feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- } else if("CA".equals(namePrefix)) {
- List features = (List) linkedFeatures.get("cameras");
- if(features != null) {
- for(Camera feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- } else if("LA".equals(namePrefix)) {
- List features = (List) linkedFeatures.get("lights");
- if(features != null) {
- for(Light feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- } else if("FI".equals(featureName)) {
- List features = (List) linkedFeatures.get("lights");
- if(features != null) {
- for(Filter feature : features) {
- if(featureName.equals(feature.getName())) {
- return feature;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * @return all linked features for the current blend file
- */
- public Map> getLinkedFeatures() {
- return linkedFeatures;
- }
-
- /**
- * This method adds the structure to the parent stack.
- *
- * @param parent
- * the structure to be added to the stack
- */
- public void pushParent(Structure parent) {
- parentStack.push(parent);
- }
-
- /**
- * This method removes the structure from the top of the parent's stack.
- *
- * @return the structure that was removed from the stack
- */
- public Structure popParent() {
- try {
- return parentStack.pop();
- } catch (EmptyStackException e) {
- return null;
- }
- }
-
- /**
- * This method retrieves the structure at the top of the parent's stack but
- * does not remove it.
- *
- * @return the structure from the top of the stack
- */
- public Structure peekParent() {
- try {
- return parentStack.peek();
- } catch (EmptyStackException e) {
- return null;
- }
- }
-
- /**
- * This method adds a new modifier to the list.
- *
- * @param ownerOMA
- * the owner's old memory address
- * @param constraints
- * the object's constraints
- */
- public void addConstraints(Long ownerOMA, List constraints) {
- List objectConstraints = this.constraints.get(ownerOMA);
- if (objectConstraints == null) {
- objectConstraints = new ArrayList();
- this.constraints.put(ownerOMA, objectConstraints);
- }
- objectConstraints.addAll(constraints);
- }
-
- /**
- * Returns constraints applied to the feature of the given OMA.
- * @param ownerOMA
- * the constraints' owner OMA
- * @return a list of constraints or null if no constraints are applied to the feature
- */
- public List getConstraints(Long ownerOMA) {
- return constraints.get(ownerOMA);
- }
-
- /**
- * @return all available constraints
- */
- public List getAllConstraints() {
- List result = new ArrayList();
- for (Entry> entry : constraints.entrySet()) {
- result.addAll(entry.getValue());
- }
- return result;
- }
-
- /**
- * This method adds the animation for the specified OMA of its owner.
- *
- * @param ownerOMA
- * the owner's old memory address
- * @param animation
- * the animation for the feature specified by ownerOMA
- */
- public void addAnimation(Long ownerOMA, Animation animation) {
- List animList = animations.get(ownerOMA);
- if (animList == null) {
- animList = new ArrayList();
- animations.put(ownerOMA, animList);
- }
- animList.add(animation);
- }
-
- /**
- * This method returns the animation data for the specified owner.
- *
- * @param ownerOMA
- * the old memory address of the animation data owner
- * @return the animation or null if none exists
- */
- public List getAnimations(Long ownerOMA) {
- return animations.get(ownerOMA);
- }
-
- /**
- * This method sets the skeleton for the specified OMA of its owner.
- *
- * @param skeletonOMA
- * the skeleton's old memory address
- * @param skeleton
- * the skeleton specified by the given OMA
- */
- public void setSkeleton(Long skeletonOMA, Skeleton skeleton) {
- skeletons.put(skeletonOMA, skeleton);
- }
-
- /**
- * The method stores a binding between the skeleton and the proper armature
- * node.
- *
- * @param skeleton
- * the skeleton
- * @param node
- * the armature node
- */
- public void setNodeForSkeleton(Skeleton skeleton, Node node) {
- nodesWithSkeletons.put(skeleton, node);
- }
-
- /**
- * This method returns the armature node that is defined for the skeleton.
- *
- * @param skeleton
- * the skeleton
- * @return the armature node that defines the skeleton in blender
- */
- public Node getControlledNode(Skeleton skeleton) {
- return nodesWithSkeletons.get(skeleton);
- }
-
- /**
- * This method returns the skeleton for the specified OMA of its owner.
- *
- * @param skeletonOMA
- * the skeleton's old memory address
- * @return the skeleton specified by the given OMA
- */
- public Skeleton getSkeleton(Long skeletonOMA) {
- return skeletons.get(skeletonOMA);
- }
-
- /**
- * This method sets the bone context for the given bone old memory address.
- * If the context is already set it will be replaced.
- *
- * @param boneOMA
- * the bone's old memory address
- * @param boneContext
- * the bones's context
- */
- public void setBoneContext(Long boneOMA, BoneContext boneContext) {
- boneContexts.put(boneOMA, boneContext);
- }
-
- /**
- * This method returns the bone context for the given bone old memory
- * address. If no context exists then null is returned.
- *
- * @param boneOMA
- * the bone's old memory address
- * @return bone's context
- */
- public BoneContext getBoneContext(Long boneOMA) {
- return boneContexts.get(boneOMA);
- }
-
- /**
- * Returns bone by given name.
- *
- * @param skeletonOMA
- * the OMA of the skeleton where the bone will be searched
- * @param name
- * the name of the bone
- * @return found bone or null if none bone of a given name exists
- */
- public BoneContext getBoneByName(Long skeletonOMA, String name) {
- for (Entry entry : boneContexts.entrySet()) {
- if (entry.getValue().getArmatureObjectOMA().equals(skeletonOMA)) {
- Bone bone = entry.getValue().getBone();
- if (bone != null && name.equals(bone.getName())) {
- return entry.getValue();
- }
- }
- }
- return null;
- }
-
- /**
- * Returns bone context for the given bone.
- *
- * @param bone
- * the bone
- * @return the bone's bone context
- */
- public BoneContext getBoneContext(Bone bone) {
- for (Entry entry : boneContexts.entrySet()) {
- if (entry.getValue().getBone().getName().equals(bone.getName())) {
- return entry.getValue();
- }
- }
- throw new IllegalStateException("Cannot find context for bone: " + bone);
- }
-
- /**
- * This metod returns the default material.
- *
- * @return the default material
- */
- public synchronized Material getDefaultMaterial() {
- if (blenderKey.getDefaultMaterial() == null) {
- Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- defaultMaterial.setColor("Color", ColorRGBA.DarkGray);
- blenderKey.setDefaultMaterial(defaultMaterial);
- }
- return blenderKey.getDefaultMaterial();
- }
-
- /**
- * Adds a custom marker for scene's feature.
- *
- * @param marker
- * the marker name
- * @param feature
- * te scene's feature (can be node, material or texture or
- * anything else)
- * @param markerValue
- * the marker value
- */
- public void addMarker(String marker, Object feature, Object markerValue) {
- if (markerValue == null) {
- throw new IllegalArgumentException("The marker's value cannot be null.");
- }
- Map