|
@@ -409,7 +409,23 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
|
|
|
// Not automatic set cloning yet
|
|
|
Set<Material> newMaterials = new HashSet<Material>();
|
|
|
for( Material m : this.materials ) {
|
|
|
- newMaterials.add(cloner.clone(m));
|
|
|
+ Material mClone = cloner.clone(m);
|
|
|
+ newMaterials.add(mClone);
|
|
|
+ if( mClone != m ) {
|
|
|
+ // Material was really cloned so clear the bone matrices in case
|
|
|
+ // this is hardware skinned. This allows a local version to be
|
|
|
+ // used and will be reset on the material. Really this just avoids
|
|
|
+ // the 'safety' check in controlRenderHardware(). Right now material
|
|
|
+ // doesn't clone itself with the cloner (and doesn't clone its parameters)
|
|
|
+ // else this would be unnecessary.
|
|
|
+ MatParam boneMatrices = mClone.getParam("BoneMatrices");
|
|
|
+
|
|
|
+ // ...because for some strange reason you can't clear a non-existant
|
|
|
+ // parameter.
|
|
|
+ if( boneMatrices != null ) {
|
|
|
+ mClone.clearParam("BoneMatrices");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
this.materials = newMaterials;
|
|
|
}
|