Browse Source

SDK : Fixed AssetPackLoader so build works again

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7305 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
rem..om 14 years ago
parent
commit
f760a38a45

+ 11 - 3
jme3-assetpack-support/src/com/jme3/gde/assetpack/AssetPackLoader.java

@@ -7,6 +7,7 @@ package com.jme3.gde.assetpack;
 import com.jme3.animation.AnimControl;
 import com.jme3.animation.AnimControl;
 import com.jme3.animation.BoneAnimation;
 import com.jme3.animation.BoneAnimation;
 import com.jme3.animation.BoneTrack;
 import com.jme3.animation.BoneTrack;
+import com.jme3.animation.SkeletonControl;
 import com.jme3.asset.ModelKey;
 import com.jme3.asset.ModelKey;
 import com.jme3.gde.assetpack.actions.AddAssetAction;
 import com.jme3.gde.assetpack.actions.AddAssetAction;
 import com.jme3.gde.assetpack.project.wizards.FileDescription;
 import com.jme3.gde.assetpack.project.wizards.FileDescription;
@@ -47,7 +48,7 @@ public class AssetPackLoader {
         Spatial model = null;
         Spatial model = null;
         Node node = null;
         Node node = null;
         while (fileElement != null) {
         while (fileElement != null) {
-            Logger.getLogger(AssetPackLoader.class.getName()).log(Level.INFO, "Load main file {0}",fileElement.getAttribute("path"));
+            Logger.getLogger(AssetPackLoader.class.getName()).log(Level.INFO, "Load main file {0}", fileElement.getAttribute("path"));
             if (model != null && node == null) {
             if (model != null && node == null) {
                 node = new Node(assetElement.getAttribute("name"));
                 node = new Node(assetElement.getAttribute("name"));
                 node.attachChild(model);
                 node.attachChild(model);
@@ -72,7 +73,14 @@ public class AssetPackLoader {
         AnimControl control = to.getControl(AnimControl.class);
         AnimControl control = to.getControl(AnimControl.class);
         AnimControl control2 = from.getControl(AnimControl.class);
         AnimControl control2 = from.getControl(AnimControl.class);
         if (control == null) {
         if (control == null) {
-            control = new AnimControl(to, control2.getTargets(), control2.getSkeleton());
+            SkeletonControl fromSkeletonControl = from.getControl(SkeletonControl.class);
+            control = new AnimControl(control2.getSkeleton());
+            SkeletonControl toSkeletonControl = to.getControl(SkeletonControl.class);
+            if (toSkeletonControl == null) {
+                toSkeletonControl = new SkeletonControl(fromSkeletonControl.getTargets(), control.getSkeleton());
+            }
+            to.addControl(control);
+            to.addControl(toSkeletonControl);
         }
         }
         Collection<String> names = control.getAnimationNames();
         Collection<String> names = control.getAnimationNames();
         Collection<String> names2 = new LinkedList<String>(control2.getAnimationNames());
         Collection<String> names2 = new LinkedList<String>(control2.getAnimationNames());
@@ -140,7 +148,7 @@ public class AssetPackLoader {
         baseLightExt.setTextureMapping("NormalHeightMap", "NormalMap");
         baseLightExt.setTextureMapping("NormalHeightMap", "NormalMap");
         baseLightExt.setTextureMapping("SpecularMap", "SpecularMap");
         baseLightExt.setTextureMapping("SpecularMap", "SpecularMap");
         matExts.addMaterialExtension(baseLightExt);
         matExts.addMaterialExtension(baseLightExt);
-        
+
         MaterialExtension baseLightExt2 = new MaterialExtension("/base/normalmap",
         MaterialExtension baseLightExt2 = new MaterialExtension("/base/normalmap",
                 "Common/MatDefs/Light/Lighting.j3md");
                 "Common/MatDefs/Light/Lighting.j3md");
         baseLightExt2.setTextureMapping("DiffuseMap", "DiffuseMap");
         baseLightExt2.setTextureMapping("DiffuseMap", "DiffuseMap");