Skip to content

Commit 41c6ef4

Browse files
authored
Deprecate FBX loading support (#2715)
1 parent 3923ffb commit 41c6ef4

15 files changed

Lines changed: 97 additions & 10 deletions

File tree

jme3-core/src/main/resources/com/jme3/asset/General.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ LOADER com.jme3.scene.plugins.ogre.SkeletonLoader : skeletonxml, skeleton.xml
2121
LOADER com.jme3.scene.plugins.ogre.MaterialLoader : material
2222
LOADER com.jme3.scene.plugins.ogre.SceneLoader : scene
2323
LOADER com.jme3.shader.plugins.GLSLLoader : vert, frag, geom, tsctrl, tseval, glsl, glsllib, comp
24-
LOADER com.jme3.scene.plugins.fbx.FbxLoader : fbx
2524
LOADER com.jme3.scene.plugins.gltf.GltfLoader : gltf
2625
LOADER com.jme3.scene.plugins.gltf.BinLoader : bin
2726
LOADER com.jme3.scene.plugins.gltf.GlbLoader : glb

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/AnimationList.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
* <code>firstFrame</code> and <code>lastFrame</code> defines animation time interval.<br>
4242
* Use <code>layerName</code> also to define source animation layer in the case of multiple layers in the scene.<br>
4343
* Skeletal animations will be created if only scene contain skeletal bones</p>
44+
*
45+
* @deprecated FBX support is deprecated and will be removed in a future release.
46+
* Prefer glTF assets instead.
4447
*/
48+
@Deprecated
4549
public class AnimationList {
4650

4751
List<AnimInverval> list = new ArrayList<>();

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/ContentTextureKey.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@
4141
import java.io.IOException;
4242

4343
/**
44-
* Used to load textures from image binary content.
44+
* Texture key used by the FBX loader for embedded textures.
4545
* <p>Filename is required to acquire proper type asset loader according to extension.</p>
46+
*
47+
* @deprecated FBX support is deprecated and will be removed in a future release.
48+
* Prefer glTF assets instead.
4649
*/
50+
@Deprecated
4751
public class ContentTextureKey extends TextureKey {
4852

4953
private byte[] content;

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/ContentTextureLocator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343

4444
/**
4545
* Used to locate a resource based on a {@link ContentTextureKey}.
46+
*
47+
* @deprecated FBX support is deprecated and will be removed in a future release.
48+
* Prefer glTF assets instead.
4649
*/
50+
@Deprecated
4751
public class ContentTextureLocator implements AssetLocator {
4852

4953
private static final Logger logger = Logger.getLogger(ContentTextureLocator.class.getName());
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.jme3.scene.plugins.fbx;
2+
3+
import java.util.logging.Level;
4+
import java.util.logging.Logger;
5+
6+
final class FbxDeprecationWarnings {
7+
8+
private static volatile boolean logged;
9+
10+
private FbxDeprecationWarnings() {
11+
}
12+
13+
static void log(Logger logger) {
14+
if (!logged) {
15+
synchronized (FbxDeprecationWarnings.class) {
16+
if (!logged) {
17+
logger.log(Level.WARNING,
18+
"FBX support is deprecated and will be removed in a future release. "
19+
+ "Prefer glTF assets instead.");
20+
logged = true;
21+
}
22+
}
23+
}
24+
}
25+
}

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/FbxLoader.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@
7070
import java.util.logging.Level;
7171
import java.util.logging.Logger;
7272

73+
/**
74+
* Loads FBX scene assets.
75+
*
76+
* @deprecated FBX support is deprecated and will be removed in a future release.
77+
* Prefer glTF assets instead.
78+
*/
79+
@Deprecated
7380
public class FbxLoader implements AssetLoader {
7481

7582
private static final Logger logger = Logger.getLogger(FbxLoader.class.getName());
@@ -87,6 +94,7 @@ public class FbxLoader implements AssetLoader {
8794

8895
@Override
8996
public Object load(AssetInfo assetInfo) throws IOException {
97+
FbxDeprecationWarnings.log(logger);
9098
this.assetManager = assetInfo.getManager();
9199
AssetKey<?> assetKey = assetInfo.getKey();
92100
if (!(assetKey instanceof ModelKey)) {
@@ -138,7 +146,7 @@ public Object load(AssetInfo assetInfo) throws IOException {
138146
private void reset() {
139147
globalSettings = new FbxGlobalSettings();
140148
}
141-
149+
142150
private void releaseObjects() {
143151
globalSettings = null;
144152
objectMap.clear();

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneKey.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
import com.jme3.asset.ModelKey;
3535
import java.util.Objects;
3636

37+
/**
38+
* Asset key for FBX scene loading.
39+
*
40+
* @deprecated FBX support is deprecated and will be removed in a future release.
41+
* Prefer glTF assets instead.
42+
*/
43+
@Deprecated
3744
public class SceneKey extends ModelKey {
3845

3946
private final AnimationList animList;
@@ -75,4 +82,4 @@ public int hashCode() {
7582
return 413 + Objects.hashCode(animList);
7683
}
7784

78-
}
85+
}

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646
* <p> Loads scene meshes, materials, textures, skeleton and skeletal animation.
4747
* Multiple animations can be defined with {@link AnimationList} passing into {@link SceneKey}
4848
* or loaded from different animation layer.</p>
49+
*
50+
* @deprecated FBX support is deprecated and will be removed in a future release.
51+
* Prefer glTF assets instead.
4952
*/
53+
@Deprecated
5054
public class SceneLoader implements AssetLoader {
5155

5256
private static final Logger logger = Logger.getLogger(SceneLoader.class.getName());
@@ -87,6 +91,7 @@ public void warning(String warning) {
8791

8892
@Override
8993
public Object load(AssetInfo assetInfo) throws IOException {
94+
FbxDeprecationWarnings.log(logger);
9095
this.currentAssetInfo = assetInfo;
9196
this.assetManager = assetInfo.getManager();
9297
AssetKey<?> assetKey = assetInfo.getKey();

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneWithAnimationLoader.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
import com.jme3.asset.AssetLoader;
1515
import com.jme3.asset.ModelKey;
1616

17+
/**
18+
* Loads FBX scenes using an auxiliary animation-list descriptor.
19+
*
20+
* @deprecated FBX support is deprecated and will be removed in a future release.
21+
* Prefer glTF assets instead.
22+
*/
23+
@Deprecated
1724
public class SceneWithAnimationLoader implements AssetLoader {
1825

1926
private Pattern splitStrings = Pattern.compile("([^\"]\\S*|\".+?\")\\s*");

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/anim/package-info.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232
/**
33-
* import animations from an FBX asset
33+
* Import animations from an FBX asset.
34+
*
35+
* @deprecated FBX support is deprecated and will be removed in a future release.
36+
* Prefer glTF assets instead.
3437
*/
38+
@Deprecated
3539
package com.jme3.scene.plugins.fbx.anim;

0 commit comments

Comments
 (0)