one-few
September 15, 2023, 11:22am
1
I switched AnimControl to AnimComposer not available.
I used the model in testdata 'Models/Jaime/Jaime.j3o"
why is this?
Thanks a lot.
public void getJaimeAnim() {
Spatial spatial = assetManager.loadModel("Models/Jaime/Jaime.j3o");
List<AnimComposer> animComposers = new ArrayList<>();
loadAnimComposer(spatial, animComposers);
System.out.println(animComposers);
// return []
}
// Traverse all nodes to obtain AnimComposer
public void loadAnimComposer(Spatial spatial, List<AnimComposer> animComposers) {
if (spatial instanceof Node) {
Node node = (Node) spatial;
AnimComposer anim = node.getControl(AnimComposer.class);
if (anim != null) {
animComposers.add(anim);
}
for (Spatial spatialChild : node.getChildren()) {
loadAnimComposer(spatialChild, animComposers);
}
}
}
oxplay2
September 15, 2023, 12:03pm
2
Just look at example code in JME Tests. You are using old test model with old control.
There you have:
AnimMigrationUtils.migrate(jaime);
Basically as i know test models have AnimControl to maintain backward versions compatibility.
New JME versons are using AnimComposer
You can see example code yourself:
/*
* Copyright (c) 2009-2021 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
This file has been truncated. show original
Normally you dont need to use this line of code, but when model is in .j3o format with older animation control, then you need reconvert it or use this line of code.
1 Like
one-few
September 15, 2023, 12:09pm
3
Thanks for your help, it’s OK now.
3 Likes