Moving all of the blender-related stuff under the jme3-blender subdirectory

to make it easier to move to its own repository and keep all of the history.
This commit is contained in:
pspeed42 2020-04-19 17:53:24 -04:00
parent 7212f9b2b2
commit 94451c4d35
41 changed files with 19 additions and 16 deletions

View File

Before

Width:  |  Height:  |  Size: 453 KiB

After

Width:  |  Height:  |  Size: 453 KiB

View File

Before

Width:  |  Height:  |  Size: 768 KiB

After

Width:  |  Height:  |  Size: 768 KiB

View File

Before

Width:  |  Height:  |  Size: 768 KiB

After

Width:  |  Height:  |  Size: 768 KiB

View File

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View File

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 257 KiB

View File

@ -58,11 +58,11 @@ import java.util.logging.Logger;
public class SavableClassUtil { public class SavableClassUtil {
private final static HashMap<String, String> CLASS_REMAPPINGS = new HashMap<>(); private final static HashMap<String, String> CLASS_REMAPPINGS = new HashMap<>();
private static void addRemapping(String oldClass, Class<? extends Savable> newClass){ private static void addRemapping(String oldClass, Class<? extends Savable> newClass){
CLASS_REMAPPINGS.put(oldClass, newClass.getName()); CLASS_REMAPPINGS.put(oldClass, newClass.getName());
} }
static { static {
addRemapping("com.jme3.effect.EmitterSphereShape", EmitterSphereShape.class); addRemapping("com.jme3.effect.EmitterSphereShape", EmitterSphereShape.class);
addRemapping("com.jme3.effect.EmitterBoxShape", EmitterBoxShape.class); addRemapping("com.jme3.effect.EmitterBoxShape", EmitterBoxShape.class);
@ -73,9 +73,13 @@ public class SavableClassUtil {
addRemapping("com.jme3.material.Material$MatParamTexture", MatParamTexture.class); addRemapping("com.jme3.material.Material$MatParamTexture", MatParamTexture.class);
addRemapping("com.jme3.animation.BoneAnimation", Animation.class); addRemapping("com.jme3.animation.BoneAnimation", Animation.class);
addRemapping("com.jme3.animation.SpatialAnimation", Animation.class); addRemapping("com.jme3.animation.SpatialAnimation", Animation.class);
// Even though we no longer include Blender loading as part of the engine,
// we leave this line in so that old j3os will still work and just not
// load that data. -pspeed:2020-04-19
addRemapping("com.jme3.scene.plugins.blender.objects.Properties", NullSavable.class); addRemapping("com.jme3.scene.plugins.blender.objects.Properties", NullSavable.class);
} }
private static String remapClass(String className) throws ClassNotFoundException { private static String remapClass(String className) throws ClassNotFoundException {
String result = CLASS_REMAPPINGS.get(className); String result = CLASS_REMAPPINGS.get(className);
if (result == null) { if (result == null) {
@ -84,7 +88,7 @@ public class SavableClassUtil {
return result; return result;
} }
} }
public static boolean isImplementingSavable(Class clazz){ public static boolean isImplementingSavable(Class clazz){
boolean result = Savable.class.isAssignableFrom(clazz); boolean result = Savable.class.isAssignableFrom(clazz);
return result; return result;
@ -98,21 +102,21 @@ public class SavableClassUtil {
versionList.add(getSavableVersion(superclass)); versionList.add(getSavableVersion(superclass));
superclass = superclass.getSuperclass(); superclass = superclass.getSuperclass();
} while (superclass != null && SavableClassUtil.isImplementingSavable(superclass)); } while (superclass != null && SavableClassUtil.isImplementingSavable(superclass));
int[] versions = new int[versionList.size()]; int[] versions = new int[versionList.size()];
for (int i = 0; i < versionList.size(); i++){ for (int i = 0; i < versionList.size(); i++){
versions[i] = versionList.get(i); versions[i] = versionList.get(i);
} }
return versions; return versions;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static int getSavableVersion(Class<? extends Savable> clazz) throws IOException{ public static int getSavableVersion(Class<? extends Savable> clazz) throws IOException{
try { try {
Field field = clazz.getField("SAVABLE_VERSION"); Field field = clazz.getField("SAVABLE_VERSION");
Class<? extends Savable> declaringClass = (Class<? extends Savable>) field.getDeclaringClass(); Class<? extends Savable> declaringClass = (Class<? extends Savable>) field.getDeclaringClass();
if (declaringClass == clazz){ if (declaringClass == clazz){
return field.getInt(null); return field.getInt(null);
}else{ }else{
return 0; // This class doesn't declare this field, e.g. version == 0 return 0; // This class doesn't declare this field, e.g. version == 0
} }
@ -126,11 +130,11 @@ public class SavableClassUtil {
return 0; // not using versions return 0; // not using versions
} }
} }
public static int getSavedSavableVersion(Object savable, Class<? extends Savable> desiredClass, int[] versions, int formatVersion){ public static int getSavedSavableVersion(Object savable, Class<? extends Savable> desiredClass, int[] versions, int formatVersion){
Class thisClass = savable.getClass(); Class thisClass = savable.getClass();
int count = 0; int count = 0;
while (thisClass != desiredClass) { while (thisClass != desiredClass) {
thisClass = thisClass.getSuperclass(); thisClass = thisClass.getSuperclass();
if (thisClass != null && SavableClassUtil.isImplementingSavable(thisClass)){ if (thisClass != null && SavableClassUtil.isImplementingSavable(thisClass)){
@ -141,26 +145,26 @@ public class SavableClassUtil {
} }
if (thisClass == null){ if (thisClass == null){
throw new IllegalArgumentException(savable.getClass().getName() + throw new IllegalArgumentException(savable.getClass().getName() +
" does not extend " + " does not extend " +
desiredClass.getName() + "!"); desiredClass.getName() + "!");
}else if (count >= versions.length){ }else if (count >= versions.length){
if (formatVersion <= 1){ if (formatVersion <= 1){
return 0; // for buggy versions of j3o return 0; // for buggy versions of j3o
}else{ }else{
throw new IllegalArgumentException(savable.getClass().getName() + throw new IllegalArgumentException(savable.getClass().getName() +
" cannot access version of " + " cannot access version of " +
desiredClass.getName() + desiredClass.getName() +
" because it doesn't implement Savable"); " because it doesn't implement Savable");
} }
} }
return versions[count]; return versions[count];
} }
/** /**
* fromName creates a new Savable from the provided class name. First registered modules * fromName creates a new Savable from the provided class name. First registered modules
* are checked to handle special cases, if the modules do not handle the class name, the * are checked to handle special cases, if the modules do not handle the class name, the
* class is instantiated directly. * class is instantiated directly.
* @param className the class name to create. * @param className the class name to create.
* @return the Savable instance of the class. * @return the Savable instance of the class.
* @throws InstantiationException thrown if the class does not have an empty constructor. * @throws InstantiationException thrown if the class does not have an empty constructor.

View File

@ -20,7 +20,6 @@ LOADER com.jme3.scene.plugins.ogre.MeshLoader : meshxml, mesh.xml
LOADER com.jme3.scene.plugins.ogre.SkeletonLoader : skeletonxml, skeleton.xml LOADER com.jme3.scene.plugins.ogre.SkeletonLoader : skeletonxml, skeleton.xml
LOADER com.jme3.scene.plugins.ogre.MaterialLoader : material LOADER com.jme3.scene.plugins.ogre.MaterialLoader : material
LOADER com.jme3.scene.plugins.ogre.SceneLoader : scene LOADER com.jme3.scene.plugins.ogre.SceneLoader : scene
LOADER com.jme3.scene.plugins.blender.BlenderModelLoader : blend
LOADER com.jme3.shader.plugins.GLSLLoader : vert, frag, geom, tsctrl, tseval, glsl, glsllib LOADER com.jme3.shader.plugins.GLSLLoader : vert, frag, geom, tsctrl, tseval, glsl, glsllib
LOADER com.jme3.scene.plugins.fbx.FbxLoader : fbx LOADER com.jme3.scene.plugins.fbx.FbxLoader : fbx
LOADER com.jme3.scene.plugins.gltf.GltfLoader : gltf LOADER com.jme3.scene.plugins.gltf.GltfLoader : gltf