diff options
Diffstat (limited to 'ardor3d-collada')
2 files changed, 33 insertions, 36 deletions
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java index d20278c..03173d8 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java @@ -181,7 +181,6 @@ public class ColladaAnimUtils { * @param skin * our <skin> element. */ - @SuppressWarnings("unchecked") private void buildSkinMeshes(final Node ardorParentNode, final Element instanceController, final Element controller, final Element skin) { final String skinSource = skin.getAttributeValue("source"); @@ -646,7 +645,6 @@ public class ColladaAnimUtils { * * @param entry */ - @SuppressWarnings("unchecked") private void buildAnimations(final Element parentElement, final Collection<TargetChannel> targetList) { final List<Element> elementTransforms = new ArrayList<Element>(); @@ -767,42 +765,45 @@ public class ColladaAnimUtils { finalTransformList.add(transform); } - final float[] time = new float[finalTimeList.size()]; - for (int i = 0; i < finalTimeList.size(); i++) { - time[i] = finalTimeList.get(i); - } - final Transform[] transforms = finalTransformList.toArray(new Transform[finalTransformList.size()]); - - AnimationClip animationClip = animationItemRoot.getAnimationClip(); - if (animationClip == null) { - animationClip = new AnimationClip(animationItemRoot.getName()); - animationItemRoot.setAnimationClip(animationClip); - } + if (animationItemRoot != null) { - // Make an animation channel - first find if we have a matching joint - Joint joint = _dataCache.getElementJointMapping().get(parentElement); - if (joint == null) { - String nodeName = parentElement.getAttributeValue("name", (String) null); - if (nodeName == null) { // use id if name doesn't exist - nodeName = parentElement.getAttributeValue("id", parentElement.getName()); + final float[] time = new float[finalTimeList.size()]; + for (int i = 0; i < finalTimeList.size(); i++) { + time[i] = finalTimeList.get(i); } - if (nodeName != null) { - joint = _dataCache.getExternalJointMapping().get(nodeName); + final Transform[] transforms = finalTransformList.toArray(new Transform[finalTransformList.size()]); + + AnimationClip animationClip = animationItemRoot.getAnimationClip(); + if (animationClip == null) { + animationClip = new AnimationClip(animationItemRoot.getName()); + animationItemRoot.setAnimationClip(animationClip); } + // Make an animation channel - first find if we have a matching joint + Joint joint = _dataCache.getElementJointMapping().get(parentElement); if (joint == null) { - // no joint still, so make a transform channel. - final TransformChannel transformChannel = new TransformChannel(nodeName, time, transforms); - animationClip.addChannel(transformChannel); - _colladaStorage.getAnimationChannels().add(transformChannel); - return; + String nodeName = parentElement.getAttributeValue("name", (String) null); + if (nodeName == null) { // use id if name doesn't exist + nodeName = parentElement.getAttributeValue("id", parentElement.getName()); + } + if (nodeName != null) { + joint = _dataCache.getExternalJointMapping().get(nodeName); + } + + if (joint == null) { + // no joint still, so make a transform channel. + final TransformChannel transformChannel = new TransformChannel(nodeName, time, transforms); + animationClip.addChannel(transformChannel); + _colladaStorage.getAnimationChannels().add(transformChannel); + return; + } } - } - // create joint channel - final JointChannel jointChannel = new JointChannel(joint, time, transforms); - animationClip.addChannel(jointChannel); - _colladaStorage.getAnimationChannels().add(jointChannel); + // create joint channel + final JointChannel jointChannel = new JointChannel(joint, time, transforms); + animationClip.addChannel(jointChannel); + _colladaStorage.getAnimationChannels().add(jointChannel); + } } /** @@ -836,7 +837,6 @@ public class ColladaAnimUtils { * @param animationRoot * @param animationItemRoot */ - @SuppressWarnings("unchecked") private void parseAnimations(final Multimap<Element, TargetChannel> channelMap, final Element animationRoot, final AnimationItem animationItemRoot) { if (animationRoot.getChild("animation") != null) { @@ -1116,7 +1116,6 @@ public class ColladaAnimUtils { return str.toString(); } - @SuppressWarnings("unchecked") private static void getElementString(final Element e, final StringBuilder str, final int depth, final int maxDepth, final boolean showDots) { addSpacing(str, depth); @@ -1138,7 +1137,7 @@ public class ColladaAnimUtils { str.append('>'); if (depth < maxDepth) { str.append('\n'); - for (final Element child : (List<Element>) e.getChildren()) { + for (final Element child : e.getChildren()) { getElementString(child, str, depth + 1, maxDepth, showDots); } if (!"".equals(e.getText())) { diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java index 2bff121..a881fc5 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java @@ -299,7 +299,6 @@ public class ColladaDOMUtil { public void stripNamespace(final Element rootElement) { rootElement.setNamespace(null); - @SuppressWarnings("unchecked") final List<Element> children = rootElement.getChildren(); final Iterator<Element> i = children.iterator(); while (i.hasNext()) { @@ -362,7 +361,6 @@ public class ColladaDOMUtil { * @param v * @return */ - @SuppressWarnings("unchecked") public Element getPositionSource(final Element v) { for (final Element input : v.getChildren("input")) { if ("POSITION".equals(input.getAttributeValue("semantic"))) { |