2
0
Эх сурвалжийг харах

Merge pull request #501 from MeFisto94/HwSkinningFixV02

Fixes #499: Fix Hardware Skinning in 3.1
Rémy Bouquet 9 жил өмнө
parent
commit
eefc17428c

+ 2 - 1
jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java

@@ -255,7 +255,8 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
                     // is operating on this material, in that case, user
                     // is operating on this material, in that case, user
                     // is sharing materials between models which is NOT allowed
                     // is sharing materials between models which is NOT allowed
                     // when hardware skinning used.
                     // when hardware skinning used.
-                    throw new UnsupportedOperationException(
+                    
+                    Logger.getLogger(SkeletonControl.class.getName()).log(Level.SEVERE,
                             "Material instances cannot be shared when hardware skinning is used. " +
                             "Material instances cannot be shared when hardware skinning is used. " +
                             "Ensure all models use unique material instances."
                             "Ensure all models use unique material instances."
                     );
                     );

+ 37 - 0
jme3-core/src/main/java/com/jme3/material/MatParam.java

@@ -309,6 +309,8 @@ When arrays can be inserted in J3M files
         } else if (value instanceof Boolean) {
         } else if (value instanceof Boolean) {
             Boolean b = (Boolean) value;
             Boolean b = (Boolean) value;
             oc.write(b.booleanValue(), "value_bool", false);
             oc.write(b.booleanValue(), "value_bool", false);
+        } else if (value.getClass().isArray() && value instanceof Savable[]) {
+            oc.write((Savable[])value, "value_savable_array", null);
         }
         }
     }
     }
 
 
@@ -327,6 +329,41 @@ When arrays can be inserted in J3M files
             case Int:
             case Int:
                 value = ic.readInt("value_int", 0);
                 value = ic.readInt("value_int", 0);
                 break;
                 break;
+            case Vector2Array:
+                Savable[] savableArray = ic.readSavableArray("value_savable_array", null);
+                if (savableArray != null) {
+                    value = new Vector2f[savableArray.length];
+                    System.arraycopy(savableArray, 0, value, 0, savableArray.length);
+                }
+                break;
+            case Vector3Array:
+                savableArray = ic.readSavableArray("value_savable_array", null);
+                if (savableArray != null) {
+                    value = new Vector3f[savableArray.length];
+                    System.arraycopy(savableArray, 0, value, 0, savableArray.length);
+                }
+                break;
+            case Vector4Array:
+                savableArray = ic.readSavableArray("value_savable_array", null);
+                if (savableArray != null) {
+                    value = new Vector4f[savableArray.length];
+                    System.arraycopy(savableArray, 0, value, 0, savableArray.length);
+                }
+                break;
+            case Matrix3Array:
+                savableArray = ic.readSavableArray("value_savable_array", null);
+                if (savableArray != null) {
+                    value = new Matrix3f[savableArray.length];
+                    System.arraycopy(savableArray, 0, value, 0, savableArray.length);
+                }
+                break;
+            case Matrix4Array:
+                savableArray = ic.readSavableArray("value_savable_array", null);
+                if (savableArray != null) {
+                    value = new Matrix4f[savableArray.length];
+                    System.arraycopy(savableArray, 0, value, 0, savableArray.length);
+                }
+                break;
             default:
             default:
                 value = ic.readSavable("value_savable", null);
                 value = ic.readSavable("value_savable", null);
                 break;
                 break;