From: Olyutorskii Date: Sun, 27 Jan 2013 22:28:46 +0000 (+0900) Subject: テストセット整備 X-Git-Tag: fromMercurial~14 X-Git-Url: http://git.osdn.net/view?p=mikutoga%2FPmd2XML.git;a=commitdiff_plain;h=6b02dc790431f16012199924ee36816cef058954 テストセット整備 モーフ数0のデータを読み込めるように --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 539010a..44148b5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -7,6 +7,7 @@ Pmd2XML 変更履歴 X.XXX.X (20XX-XX-XX) ・Maven3対応。 ・XML出力改行コードの指定が可能になる。 + ・モーフ数0のモデルデータを読み書きできないバグに対処。(チケット#23394) 1.102.4 (2010-10-09) ・TogaGem1.105.2のバグ修正(接続ボーンを持たない剛体の件)に対処。 diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/PmdXmlExporter.java b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Exporter.java similarity index 73% rename from src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/PmdXmlExporter.java rename to src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Exporter.java index ff9856d..50f63b9 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/PmdXmlExporter.java +++ b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Exporter.java @@ -5,7 +5,7 @@ * Copyright(c) 2010 MikuToga Partners */ -package jp.sourceforge.mikutoga.pmd.model.xml; +package jp.sfjp.mikutoga.pmd.xml101009; import java.awt.Color; import java.io.IOException; @@ -43,14 +43,13 @@ import jp.sourceforge.mikutoga.xml.BasicXmlExporter; import jp.sourceforge.mikutoga.xml.XmlResourceResolver; /** - * XML形式でPMDモデルデータを出力する。 + * 101009形式XMLでPMDモデルデータを出力する。 */ -public class PmdXmlExporter extends BasicXmlExporter{ +public class Xml101009Exporter extends BasicXmlExporter{ private static final String TOP_COMMENT = - " MikuMikuDance\n model-data(*.pmd) on XML"; - private static final String SCHEMA_LOCATION = - PmdXmlResources.NS_PMDXML + " " + PmdXmlResources.SCHEMA_PMDXML; + " MikuMikuDance\n" + + " model-data(*.pmd) on XML"; /** 改行文字列 CR。 */ private static final String CR = "\r"; // 0x0d @@ -99,7 +98,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ * 文字エンコーディングはUTF-8が用いられる。 * @param stream 出力ストリーム */ - public PmdXmlExporter(OutputStream stream){ + public Xml101009Exporter(OutputStream stream){ super(stream); return; } @@ -134,7 +133,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @throws IOException {@inheritDoc} */ @Override - public PmdXmlExporter ind() throws IOException{ + public Xml101009Exporter ind() throws IOException{ super.ind(); return this; } @@ -145,7 +144,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putUnescapedComment(CharSequence seq) + protected Xml101009Exporter putUnescapedComment(CharSequence seq) throws IOException{ if( ! isBasicLatinOnlyOut() ) return this; if(hasOnlyBasicLatin(seq)) return this; @@ -160,14 +159,14 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putI18nName(I18nText text) throws IOException{ + protected Xml101009Exporter putI18nName(I18nText text) throws IOException{ for(String lang639 : text.lang639CodeList()){ if(lang639.equals(I18nText.CODE639_PRIMARY)) continue; String name = text.getI18nText(lang639); - ind().put(""); + putRawText(" />"); putUnescapedComment(name); ln(); } @@ -182,13 +181,13 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putNumberedIdAttr(CharSequence attrName, + protected Xml101009Exporter putNumberedIdAttr(CharSequence attrName, CharSequence prefix, int num ) throws IOException{ - put(attrName).put("=\""); - put(prefix).put(num); - put('"'); + putRawText(attrName).putRawText("=\""); + putRawText(prefix).putXsdInt(num); + putRawCh('"'); return this; } @@ -200,7 +199,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putNumberedIdAttr(CharSequence attrName, + protected Xml101009Exporter putNumberedIdAttr(CharSequence attrName, CharSequence prefix, SerialNumbered numbered ) throws IOException{ @@ -214,13 +213,13 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putPosition(MkPos3D position) + protected Xml101009Exporter putPosition(MkPos3D position) throws IOException{ - put(""); + putRawText("/>"); return this; } @@ -230,13 +229,13 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putRadRotation(Rad3d rotation) + protected Xml101009Exporter putRadRotation(Rad3d rotation) throws IOException{ - put(""); + putRawText("/>"); return this; } @@ -246,9 +245,12 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putLocalNameComment(I18nText name) + protected Xml101009Exporter putLocalNameComment(I18nText name) throws IOException{ String localName = name.getText(); + if(localName.isEmpty()){ + localName = "[NAMELESS]"; + } ind().putLineComment(localName); return this; } @@ -260,7 +262,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - protected PmdXmlExporter putPrimaryNameAttr(CharSequence attrName, + protected Xml101009Exporter putPrimaryNameAttr(CharSequence attrName, I18nText name) throws IOException{ String primaryName = name.getPrimaryText(); @@ -274,29 +276,32 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @throws IOException 出力エラー */ public void putPmdModel(PmdModel model) throws IOException{ - ind().put("").ln(2); + ind().putRawText("").ln(2); ind().putBlockComment(TOP_COMMENT).ln(2); - /* - ind().put("") - .ln(3); - */ - I18nText modelName = model.getModelName(); ind().putLocalNameComment(modelName).ln(); - ind().put("").ln(2); + putRawText(">").ln(2); putModelInfo(model).flush(); putMetaInfo(model).flush(); @@ -312,8 +317,8 @@ public class PmdXmlExporter extends BasicXmlExporter{ putSurfaceGroupList(model).flush(); putVertexList(model).flush(); - ind().put("").ln(2); - ind().put("").ln(); + ind().putRawText("").ln(2); + ind().putRawText("").ln(); return; } @@ -324,7 +329,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putModelInfo(PmdModel model) + private Xml101009Exporter putModelInfo(PmdModel model) throws IOException{ I18nText modelName = model.getModelName(); putI18nName(modelName); @@ -347,23 +352,22 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putDescription(CharSequence lang639, + private Xml101009Exporter putDescription(CharSequence lang639, CharSequence content) throws IOException{ String text = content.toString(); text = text.replace(CRLF, LF); text = text.replace(CR, LF); - ind().put("").ln(); + putRawText(">").ln(); putBRedContent(text); - ind().put("").ln(); + ind().putRawText("").ln(); if( ! hasOnlyBasicLatin(text) && isBasicLatinOnlyOut() ){ putBlockComment(text); @@ -391,7 +395,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ char ch = content.charAt(idx); if(ch == '\n'){ CharSequence seq = content.subSequence(startPos, idx); - putContent(seq).put("
").ln(); + putContent(seq).putRawText("
").ln(); startPos = idx + 1; } } @@ -410,26 +414,26 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putMetaInfo(PmdModel model) throws IOException{ - ind().put("").ln(); - ind().put("").ln(2); + private Xml101009Exporter putMetaInfo(PmdModel model) throws IOException{ + ind().putRawText("").ln(); + ind().putRawText("").ln(2); - ind().put("").ln(); - ind().put("").ln(2); + ind().putRawText("").ln(); + ind().putRawText("").ln(2); if(this.generator != null){ - ind().put("").ln(); + putRawText(" />").ln(); } - ind().put("").ln(); - ind().put("").ln(); + ind().putRawText("").ln(2); + putRawText(" />").ln(2); return this; } @@ -440,18 +444,22 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putMaterialList(PmdModel model) + private Xml101009Exporter putMaterialList(PmdModel model) throws IOException{ - ind().put("").ln(2); - pushNest(); + ind().putRawText("").ln(); + pushNest(); int ct = 0; - for(Material material : model.getMaterialList()){ + boolean dumped = false; + List materialList = model.getMaterialList(); + for(Material material : materialList){ + if( ! dumped ) ln(); putMaterial(material, ct++); + dumped = true; } - popNest(); - ind().put("").ln(2); + + ind().putRawText("").ln(2); return this; } @@ -463,7 +471,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putMaterial(Material material, int no) + private Xml101009Exporter putMaterial(Material material, int no) throws IOException{ String bool; if(material.getEdgeAppearance()) bool = "true"; @@ -475,7 +483,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ if(local != null && local.length() > 0){ ind().putLineComment(local).ln(); } - ind().put(" 0){ putAttr("name", primary).sp(); } @@ -483,7 +491,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ putAttr("showEdge", bool); sp(); putNumberedIdAttr("surfaceGroupIdRef", PFX_SURFACEGROUP, no); - put('>').ln(); + sp().putRawCh('>').ln(); pushNest(); putI18nName(name); @@ -492,40 +500,40 @@ public class PmdXmlExporter extends BasicXmlExporter{ Color diffuse = material.getDiffuseColor(); diffuse.getRGBComponents(rgba); - ind().put("").ln(); + putRawText("/>").ln(); Color specular = material.getSpecularColor(); specular.getRGBComponents(rgba); float shininess = material.getShininess(); - ind().put("").ln(); + putRawText("/>").ln(); Color ambient = material.getAmbientColor(); ambient.getRGBComponents(rgba); - ind().put("").ln(); + putRawText("/>").ln(); ShadeInfo shade = material.getShadeInfo(); String textureFileName = shade.getTextureFileName(); String spheremapFileName = shade.getSpheremapFileName(); if(shade.isValidToonIndex()){ - ind().put(""); + putRawText(" />"); String toonFileName = shade.getToonFileName(); if(toonFileName != null && toonFileName.length() > 0){ sp().putLineComment(toonFileName); @@ -534,19 +542,19 @@ public class PmdXmlExporter extends BasicXmlExporter{ } if(textureFileName != null && textureFileName.length() > 0){ - ind().put("").ln(); + putRawText(" />").ln(); } if(spheremapFileName != null && spheremapFileName.length() > 0){ - ind().put("").ln(); + putRawText(" />").ln(); } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -557,9 +565,9 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putToonMap(PmdModel model) + private Xml101009Exporter putToonMap(PmdModel model) throws IOException{ - ind().put("").ln(); + ind().putRawText("").ln(); pushNest(); ToonMap map = model.getToonMap(); @@ -568,7 +576,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -579,14 +587,14 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putToon(ToonMap map, int index) + private Xml101009Exporter putToon(ToonMap map, int index) throws IOException{ - put(""); + putRawText(" />"); putUnescapedComment(toonFile); return this; } @@ -597,19 +605,23 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putSurfaceGroupList(PmdModel model) + private Xml101009Exporter putSurfaceGroupList(PmdModel model) throws IOException{ - ind().put("").ln(2); - pushNest(); + ind().putRawText("").ln(); + pushNest(); int ct = 0; - for(Material material : model.getMaterialList()){ + boolean dumped = false; + List materialList = model.getMaterialList(); + for(Material material : materialList){ List surfaceList = material.getSurfaceList(); + if( ! dumped ) ln(); putSurfaceList(surfaceList, ct++); + dumped = true; } - popNest(); - ind().put("").ln(2); + + ind().putRawText("").ln(2); return this; } @@ -621,12 +633,12 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putSurfaceList(List surfaceList, + private Xml101009Exporter putSurfaceList(List surfaceList, int index) throws IOException{ - ind().put("").ln(); + sp().putRawText(">").ln(); pushNest(); for(Surface surface : surfaceList){ @@ -634,7 +646,7 @@ public class PmdXmlExporter extends BasicXmlExporter{ } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -645,9 +657,9 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putSurface(Surface surface) + private Xml101009Exporter putSurface(Surface surface) throws IOException{ - ind().put("").ln(); + putRawText("/>").ln(); return this; } @@ -667,17 +679,21 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putVertexList(PmdModel model) + private Xml101009Exporter putVertexList(PmdModel model) throws IOException{ - ind().put("").ln(2); - pushNest(); + ind().putRawText("").ln(); - for(Vertex vertex : model.getVertexList()){ + pushNest(); + boolean dumped = false; + List vertexList = model.getVertexList(); + for(Vertex vertex : vertexList){ + if( ! dumped ) ln(); putVertex(vertex); + dumped = true; } - popNest(); - ind().put("").ln(2); + + ind().putRawText("").ln(2); return this; } @@ -688,45 +704,45 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putVertex(Vertex vertex) + private Xml101009Exporter putVertex(Vertex vertex) throws IOException{ String bool; if(vertex.getEdgeAppearance()) bool = "true"; else bool = "false"; - ind().put("").ln(); + sp().putRawText(">").ln(); pushNest(); MkPos3D position = vertex.getPosition(); ind().putPosition(position).ln(); MkVec3D normal = vertex.getNormal(); - ind().put("").ln(); + putRawText("/>").ln(); MkPos2D uvPos = vertex.getUVPosition(); - ind().put("").ln(); + putRawText("/>").ln(); BoneInfo boneA = vertex.getBoneA(); BoneInfo boneB = vertex.getBoneB(); int weight = vertex.getWeightA(); - ind().put("").ln(); + putRawText("/>").ln(); popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -737,19 +753,22 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putBoneList(PmdModel model) + private Xml101009Exporter putBoneList(PmdModel model) throws IOException{ - ind().put("").ln(2); + ind().putRawText("").ln(); pushNest(); - putBlockComment(BONETYPE_COMMENT).ln(); - + boolean dumped = false; for(BoneInfo bone : model.getBoneList()){ + if( ! dumped ){ + ln().putBlockComment(BONETYPE_COMMENT).ln(); + } putBone(bone); + dumped = true; } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -760,17 +779,26 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putBone(BoneInfo bone) + private Xml101009Exporter putBone(BoneInfo bone) throws IOException{ I18nText i18nName = bone.getBoneName(); BoneType type = bone.getBoneType(); - putLocalNameComment(i18nName).putLineComment(type.getGuiName()).ln(); - ind().put("").ln(); + sp().putRawText(">").ln(); pushNest(); putI18nName(i18nName); @@ -780,44 +808,53 @@ public class PmdXmlExporter extends BasicXmlExporter{ BoneInfo ikBone = bone.getIKBone(); if(bone.getBoneType() == BoneType.LINKEDROT){ - ind().put("").ln(); + putRawText(" />").ln(); }else if(ikBone != null){ - ind().put(" "); + putRawText(" /> "); String ikBoneName = "Ref:" + ikBone.getBoneName().getText(); putLineComment(ikBoneName); ln(); } - StringBuilder chainComment = new StringBuilder(); - ind().put(" #"); + .append(" >>#"); } if(next != null){ - sp(); - putNumberedIdAttr("nextBoneIdRef", PFX_BONE, next); if(chainComment.length() <= 0) chainComment.append("#"); - chainComment.append(" =>") + chainComment.append(">> ") .append('[') .append(next.getBoneName().getPrimaryText()) .append(']'); } - put(" />").ln(); - ind().putLineComment(chainComment).ln(); + if(chainComment.length() > 0){ + ln(); + ind().putLineComment(chainComment).ln(); + } + + ind().putRawText("").ln(); popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -828,18 +865,22 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putBoneGroupList(PmdModel model) + private Xml101009Exporter putBoneGroupList(PmdModel model) throws IOException{ - ind().put("").ln(2); - pushNest(); + ind().putRawText("").ln(); - for(BoneGroup group : model.getBoneGroupList()){ + pushNest(); + boolean dumped = false; + List groupList = model.getBoneGroupList(); + for(BoneGroup group : groupList){ if(group.isDefaultBoneGroup()) continue; + if( ! dumped ) ln(); putBoneGroup(group); + dumped = true; } - popNest(); - ind().put("").ln(2); + + ind().putRawText("").ln(2); return this; } @@ -850,28 +891,28 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putBoneGroup(BoneGroup group) + private Xml101009Exporter putBoneGroup(BoneGroup group) throws IOException{ I18nText i18nName = group.getGroupName(); putLocalNameComment(i18nName).ln(); - ind().put("").ln(); + sp().putRawText(">").ln(); pushNest(); putI18nName(i18nName); for(BoneInfo bone : group){ - ind().put(" "); + putRawText(" /> "); String boneName = "Ref:" + bone.getBoneName().getText(); putLineComment(boneName).ln(); } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -882,17 +923,21 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putIKChainList(PmdModel model) + private Xml101009Exporter putIKChainList(PmdModel model) throws IOException{ - ind().put("").ln(2); - pushNest(); + ind().putRawText("").ln(); - for(IKChain chain : model.getIKChainList()){ + pushNest(); + boolean dumped = false; + List chainList = model.getIKChainList(); + for(IKChain chain : chainList){ + if( ! dumped ) ln(); putIKChain(chain); + dumped = true; } - popNest(); - ind().put("").ln(2); + + ind().putRawText("").ln(2); return this; } @@ -903,30 +948,30 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putIKChain(IKChain chain) + private Xml101009Exporter putIKChain(IKChain chain) throws IOException{ int depth = chain.getIKDepth(); float weight = chain.getIKWeight(); BoneInfo ikBone = chain.getIkBone(); ind().putLineComment("Ref:" + ikBone.getBoneName().getText()).ln(); - ind().put(" ").ln(); + sp().putRawText(">").ln(); pushNest(); for(BoneInfo bone : chain){ - ind().put(" "); + putRawText(" /> "); putLineComment("Ref:" + bone.getBoneName().getText()); ln(); } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -937,25 +982,28 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putMorphList(PmdModel model) + private Xml101009Exporter putMorphList(PmdModel model) throws IOException{ - ind().put("").ln(2); + ind().putRawText("").ln(); pushNest(); - putBlockComment(MORPHTYPE_COMMENT).ln(); - + boolean dumped = false; Map> morphMap = model.getMorphMap(); for(MorphType type : MorphType.values()){ if(type == MorphType.BASE) continue; List partList = morphMap.get(type); if(partList == null) continue; for(MorphPart part : partList){ + if( ! dumped ){ + ln().putBlockComment(MORPHTYPE_COMMENT).ln(); + } putMorphPart(part); + dumped = true; } } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -966,16 +1014,16 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putMorphPart(MorphPart part) + private Xml101009Exporter putMorphPart(MorphPart part) throws IOException{ I18nText i18nName = part.getMorphName(); String primary = i18nName.getPrimaryText(); - ind().put(""); - putUnescapedComment(primary); + sp().putRawText(">"); ln(); pushNest(); @@ -985,17 +1033,17 @@ public class PmdXmlExporter extends BasicXmlExporter{ MkPos3D offset = mvertex.getOffset(); Vertex base = mvertex.getBaseVertex(); - ind().put(""); + putRawText("/>"); ln(); } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -1006,19 +1054,22 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putRigidList(PmdModel model) + private Xml101009Exporter putRigidList(PmdModel model) throws IOException{ - ind().put("").ln(2); + ind().putRawText("").ln(); pushNest(); - putBlockComment(RIGIDBEHAVIOR_COMMENT).ln(); - + boolean dumped = false; for(RigidInfo rigid : model.getRigidList()){ + if( ! dumped ){ + ln().putBlockComment(RIGIDBEHAVIOR_COMMENT).ln(); + } putRigid(rigid); + dumped = true; } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -1029,26 +1080,26 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putRigid(RigidInfo rigid) + private Xml101009Exporter putRigid(RigidInfo rigid) throws IOException{ BoneInfo linkedBone = rigid.getLinkedBone(); I18nText i18nName = rigid.getRigidName(); String primary = i18nName.getPrimaryText(); putLocalNameComment(i18nName).ln(); - ind().put("").ln(); + sp().putRawText(">").ln(); pushNest(); putI18nName(i18nName); if(linkedBone != null){ - ind().put(" "); + putRawText(" /> "); putLineComment("Ref:" + linkedBone.getBoneName().getText()); ln(2); } @@ -1066,15 +1117,15 @@ public class PmdXmlExporter extends BasicXmlExporter{ putDynamics(dynamics).ln(); for(RigidGroup group : rigid.getThroughGroupColl()){ - ind().put("").ln(); + putRawText(" />").ln(); } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -1085,23 +1136,23 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putRigidShape(RigidShape shape) + private Xml101009Exporter putRigidShape(RigidShape shape) throws IOException{ RigidShapeType type = shape.getShapeType(); switch(type){ case BOX: - ind().put("").ln(); + putRawText("/>").ln(); return this; } @@ -1121,9 +1172,9 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putDynamics(DynamicsInfo dynamics) + private Xml101009Exporter putDynamics(DynamicsInfo dynamics) throws IOException{ - ind().put("").ln(); + ind().putRawText("/>").ln(); return this; } @@ -1144,39 +1195,49 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putRigidGroupList(PmdModel model) + private Xml101009Exporter putRigidGroupList(PmdModel model) throws IOException{ - ind().put("").ln(2); + ind().putRawText("").ln(2); pushNest(); + boolean singleLast = false; for(RigidGroup group : model.getRigidGroupList()){ - ind().put(" rigidList = group.getRigidList(); + if(singleLast && ! rigidList.isEmpty()){ + ln(); + } + ind().putRawText(" rigidList = group.getRigidList(); - if(rigidList.size() <= 0){ - put(" />").ln(2); + if(rigidList.isEmpty()){ + putRawText(" />").ln(); + singleLast = true; continue; } - put(">").ln(); + putRawText(" >").ln(); pushNest(); for(RigidInfo rigid : rigidList){ - ind().put(""); + putRawText("/>"); sp(); putLineComment("Ref:" + rigid.getRigidName().getText()); ln(); } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); + singleLast = false; + } + + if(singleLast){ + ln(); } popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } @@ -1187,17 +1248,21 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putJointList(PmdModel model) + private Xml101009Exporter putJointList(PmdModel model) throws IOException{ - ind().put("").ln(2); - pushNest(); + ind().putRawText("").ln(); - for(JointInfo joint : model.getJointList()){ + pushNest(); + boolean dumped = false; + List jointList = model.getJointList(); + for(JointInfo joint : jointList){ + if( ! dumped ) ln(); putJoint(joint); + dumped = true; } - popNest(); - ind().put("").ln(2); + + ind().putRawText("").ln(2); return this; } @@ -1208,34 +1273,36 @@ public class PmdXmlExporter extends BasicXmlExporter{ * @return this本体 * @throws IOException 出力エラー */ - private PmdXmlExporter putJoint(JointInfo joint) + private Xml101009Exporter putJoint(JointInfo joint) throws IOException{ I18nText i18nName = joint.getJointName(); putLocalNameComment(i18nName).ln(); - ind().put("").ln(); + sp().putRawText(">").ln(); pushNest(); putI18nName(i18nName); RigidInfo rigidA = joint.getRigidA(); RigidInfo rigidB = joint.getRigidB(); - ind().put("").ln(); + ind(); putLineComment("[" + rigidA.getRigidName().getText() + "]" + " <=> [" + rigidB.getRigidName().getText() + "]"); - ln(2); + ln(); + + ind().putRawText("").ln(2); MkPos3D position = joint.getPosition(); ind().putPosition(position).ln(); TripletRange posRange = joint.getPositionRange(); - ind().put("").ln(2); + ind().putRawText("/>").ln(2); Rad3d rotation = joint.getRotation(); ind().putRadRotation(rotation).ln(); TripletRange rotRange = joint.getRotationRange(); - ind().put("").ln(2); + ind().putRawText("/>").ln(2); MkPos3D elaPosition = joint.getElasticPosition(); - ind().put("").ln(); + putRawText("/>").ln(); Deg3d elaRotation = joint.getElasticRotation(); - ind().put("").ln(2); + putRawText("/>").ln(2); popNest(); - ind().put("").ln(2); + ind().putRawText("").ln(2); return this; } diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/Xml2PmdLoader.java b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Loader.java similarity index 99% rename from src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/Xml2PmdLoader.java rename to src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Loader.java index d5235b0..596ac7f 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/Xml2PmdLoader.java +++ b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Loader.java @@ -5,7 +5,7 @@ * Copyright(c) 2010 MikuToga Partners */ -package jp.sourceforge.mikutoga.pmd.model.xml; +package jp.sfjp.mikutoga.pmd.xml101009; import java.awt.Color; import java.io.IOException; @@ -53,9 +53,9 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** - * XML形式でのモデルファイルを読み込む。 + * 101009形式XML形式でのモデルファイルを読み込む。 */ -public class Xml2PmdLoader { +public class Xml101009Loader { private final DocumentBuilder builder; @@ -79,7 +79,7 @@ public class Xml2PmdLoader { * コンストラクタ。 * @param builder ビルダ */ - public Xml2PmdLoader(DocumentBuilder builder){ + public Xml101009Loader(DocumentBuilder builder){ super(); this.builder = builder; return; diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/PmdXmlResources.java b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Resources.java similarity index 92% rename from src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/PmdXmlResources.java rename to src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Resources.java index 6c80df3..b9985fc 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/PmdXmlResources.java +++ b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/Xml101009Resources.java @@ -5,7 +5,7 @@ * Copyright(c) 2010 MikuToga Partners */ -package jp.sourceforge.mikutoga.pmd.model.xml; +package jp.sfjp.mikutoga.pmd.xml101009; import java.net.URI; import java.net.URISyntaxException; @@ -20,9 +20,9 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; /** - * XML各種リソースの定義。 + * 101009形式XML各種リソースの定義。 */ -public final class PmdXmlResources { +public final class Xml101009Resources { public static final String NS_PMDXML = "http://mikutoga.sourceforge.jp/xml/ns/pmdxml/101009"; @@ -42,10 +42,10 @@ public final class PmdXmlResources { public static final URI RES_SCHEMA_PMDXML; public static final URI RES_DTD_PMDXML; - private static final Class THISCLASS = PmdXmlResources.class; + private static final Class THISCLASS = Xml101009Resources.class; static{ - Object dummy = new PmdXmlResources(); + Object dummy = new Xml101009Resources(); try{ RES_SCHEMA_PMDXML = @@ -60,7 +60,7 @@ public final class PmdXmlResources { /** * 隠しコンストラクタ。 */ - private PmdXmlResources(){ + private Xml101009Resources(){ super(); assert this.getClass().equals(THISCLASS); return; diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/package-info.java b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/package-info.java similarity index 52% rename from src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/package-info.java rename to src/main/java/jp/sfjp/mikutoga/pmd/xml101009/package-info.java index 4ae0dda..fce5203 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd/model/xml/package-info.java +++ b/src/main/java/jp/sfjp/mikutoga/pmd/xml101009/package-info.java @@ -6,9 +6,9 @@ */ /** - * PMDモデル内容をXMLで出力するためのライブラリ。 + * PMDモデル内容を101009版XMLで出力するためのライブラリ。 */ -package jp.sourceforge.mikutoga.pmd.model.xml; +package jp.sfjp.mikutoga.pmd.xml101009; /* EOF */ diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/TextBuilder.java b/src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/TextBuilder.java index 51c0ac8..9a720a8 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/TextBuilder.java +++ b/src/main/java/jp/sourceforge/mikutoga/pmd/model/binio/TextBuilder.java @@ -101,10 +101,13 @@ class TextBuilder implements PmdBasicHandler, PmdEngHandler { this.currentBone = this.boneIt.next(); } }else if(stage == PmdEngHandler.ENGMORPH_LIST){ + if(this.morphPartList.isEmpty()){ + return; + } + this.morphPartIt = this.morphPartList.iterator(); // 「base」モーフを読み飛ばす - assert this.morphPartIt.hasNext(); MorphPart part = this.morphPartIt.next(); assert part != null; diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd2xml/ModelFileTypes.java b/src/main/java/jp/sourceforge/mikutoga/pmd2xml/ModelFileTypes.java deleted file mode 100644 index 14d51f7..0000000 --- a/src/main/java/jp/sourceforge/mikutoga/pmd2xml/ModelFileTypes.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * MMD model file types. - * - * License : The MIT License - * Copyright(c) 2012 MikuToga Partners - */ - -package jp.sourceforge.mikutoga.pmd2xml; - -/** - * モデルファイル種別。 - */ -public enum ModelFileTypes { - /** 不明。 */ - NONE, - - /** MikuMikuDance ver7 前後で読み書きが可能なPMDファイル。 */ - PMD, - - /** - * スキーマ - * http://mikutoga.sourceforge.jp/xml/xsd/pmdxml-101009.xsd - * で定義されたXMLファイル。 - */ - XML_101009, - -} diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd2xml/OptInfo.java b/src/main/java/jp/sourceforge/mikutoga/pmd2xml/OptInfo.java index f50f2de..7b8cf71 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd2xml/OptInfo.java +++ b/src/main/java/jp/sourceforge/mikutoga/pmd2xml/OptInfo.java @@ -10,6 +10,7 @@ package jp.sourceforge.mikutoga.pmd2xml; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; +import jp.sourceforge.mikutoga.pmd.ModelFileType; /** * コマンドラインオプション情報。 @@ -50,8 +51,8 @@ final class OptInfo { private String errMsg = null; private boolean needHelp = false; - private ModelFileTypes inTypes = ModelFileTypes.NONE; - private ModelFileTypes outTypes = ModelFileTypes.NONE; + private ModelFileType inTypes = ModelFileType.NONE; + private ModelFileType outTypes = ModelFileType.NONE; private String inFilename = null; private String outFilename = null; private boolean overwrite = false; @@ -97,12 +98,12 @@ final class OptInfo { result.overwrite = true; break; case OPT_PMD2XML: - result.inTypes = ModelFileTypes.PMD; - result.outTypes = ModelFileTypes.XML_101009; + result.inTypes = ModelFileType.PMD; + result.outTypes = ModelFileType.XML_101009; break; case OPT_XML2PMD: - result.inTypes = ModelFileTypes.XML_101009; - result.outTypes = ModelFileTypes.PMD; + result.inTypes = ModelFileType.XML_101009; + result.outTypes = ModelFileType.PMD; break; case OPT_INFILE: argIdx++; @@ -157,8 +158,8 @@ final class OptInfo { * @param result オプション情報 */ private static void checkResult(OptInfo result){ - if( result.getInFileType() == ModelFileTypes.NONE - || result.getOutFileType() == ModelFileTypes.NONE ){ + if( result.getInFileType() == ModelFileType.NONE + || result.getOutFileType() == ModelFileType.NONE ){ result.putErrMsg(ERRMSG_NODIR); return; } @@ -213,7 +214,7 @@ final class OptInfo { * 入力ファイル種別を返す。 * @return 入力ファイル種別 */ - ModelFileTypes getInFileType(){ + ModelFileType getInFileType(){ return this.inTypes; } @@ -221,7 +222,7 @@ final class OptInfo { * 出力ファイル種別を返す。 * @return 出力ファイル種別 */ - ModelFileTypes getOutFileType(){ + ModelFileType getOutFileType(){ return this.outTypes; } diff --git a/src/main/java/jp/sourceforge/mikutoga/pmd2xml/Pmd2XmlConv.java b/src/main/java/jp/sourceforge/mikutoga/pmd2xml/Pmd2XmlConv.java index bd99da5..0d3d468 100644 --- a/src/main/java/jp/sourceforge/mikutoga/pmd2xml/Pmd2XmlConv.java +++ b/src/main/java/jp/sourceforge/mikutoga/pmd2xml/Pmd2XmlConv.java @@ -12,14 +12,15 @@ import java.io.InputStream; import java.io.OutputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; +import jp.sfjp.mikutoga.pmd.xml101009.Xml101009Exporter; +import jp.sfjp.mikutoga.pmd.xml101009.Xml101009Loader; +import jp.sfjp.mikutoga.pmd.xml101009.Xml101009Resources; import jp.sourceforge.mikutoga.parser.MmdFormatException; import jp.sourceforge.mikutoga.pmd.IllegalPmdDataException; +import jp.sourceforge.mikutoga.pmd.ModelFileType; import jp.sourceforge.mikutoga.pmd.model.PmdModel; import jp.sourceforge.mikutoga.pmd.model.binio.PmdExporter; import jp.sourceforge.mikutoga.pmd.model.binio.PmdLoader; -import jp.sourceforge.mikutoga.pmd.model.xml.PmdXmlExporter; -import jp.sourceforge.mikutoga.pmd.model.xml.PmdXmlResources; -import jp.sourceforge.mikutoga.pmd.model.xml.Xml2PmdLoader; import jp.sourceforge.mikutoga.xml.TogaXmlException; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -29,8 +30,8 @@ import org.xml.sax.SAXException; */ public class Pmd2XmlConv { - private ModelFileTypes inTypes = ModelFileTypes.NONE; - private ModelFileTypes outTypes = ModelFileTypes.NONE; + private ModelFileType inTypes = ModelFileType.NONE; + private ModelFileType outTypes = ModelFileType.NONE; private String newLine = "\r\n"; private String generator = null; @@ -44,7 +45,7 @@ public class Pmd2XmlConv { super(); try{ - this.builder = PmdXmlResources.newBuilder(XmlHandler.HANDLER); + this.builder = Xml101009Resources.newBuilder(XmlHandler.HANDLER); }catch(SAXException e){ throw new AssertionError(e); }catch(ParserConfigurationException e){ @@ -59,7 +60,7 @@ public class Pmd2XmlConv { * 入力ファイル種別を設定する。 * @param type ファイル種別 */ - public void setInType(ModelFileTypes type){ + public void setInType(ModelFileType type){ if(type == null) throw new NullPointerException(); this.inTypes = type; return; @@ -69,7 +70,7 @@ public class Pmd2XmlConv { * 入力ファイル種別を返す。 * @return ファイル種別 */ - public ModelFileTypes getInTypes(){ + public ModelFileType getInTypes(){ return this.inTypes; } @@ -77,7 +78,7 @@ public class Pmd2XmlConv { * 出力ファイル種別を設定する。 * @param type ファイル種別 */ - public void setOutType(ModelFileTypes type){ + public void setOutType(ModelFileType type){ if(type == null) throw new NullPointerException(); this.outTypes = type; return; @@ -87,7 +88,7 @@ public class Pmd2XmlConv { * 出力ファイル種別を返す。 * @return ファイル種別 */ - public ModelFileTypes getOutTypes(){ + public ModelFileType getOutTypes(){ return this.outTypes; } @@ -241,7 +242,7 @@ public class Pmd2XmlConv { throws IOException, SAXException, TogaXmlException { - Xml2PmdLoader loader = new Xml2PmdLoader(this.builder); + Xml101009Loader loader = new Xml101009Loader(this.builder); PmdModel model = loader.parse(source); return model; } @@ -270,7 +271,7 @@ public class Pmd2XmlConv { */ private void xmlOut(PmdModel model, OutputStream ostream) throws IOException, IllegalPmdDataException{ - PmdXmlExporter exporter = new PmdXmlExporter(ostream); + Xml101009Exporter exporter = new Xml101009Exporter(ostream); exporter.setNewLine(this.newLine); exporter.setGenerator(this.generator); exporter.putPmdModel(model); diff --git a/src/main/resources/jp/sourceforge/mikutoga/pmd/model/xml/resources/pmdxml-101009.dtd b/src/main/resources/jp/sfjp/mikutoga/pmd/xml101009/resources/pmdxml-101009.dtd similarity index 100% rename from src/main/resources/jp/sourceforge/mikutoga/pmd/model/xml/resources/pmdxml-101009.dtd rename to src/main/resources/jp/sfjp/mikutoga/pmd/xml101009/resources/pmdxml-101009.dtd diff --git a/src/main/resources/jp/sourceforge/mikutoga/pmd/model/xml/resources/pmdxml-101009.xsd b/src/main/resources/jp/sfjp/mikutoga/pmd/xml101009/resources/pmdxml-101009.xsd similarity index 100% rename from src/main/resources/jp/sourceforge/mikutoga/pmd/model/xml/resources/pmdxml-101009.xsd rename to src/main/resources/jp/sfjp/mikutoga/pmd/xml101009/resources/pmdxml-101009.xsd diff --git a/src/test/java/testdata/CnvAssert.java b/src/test/java/testdata/CnvAssert.java index 83ca380..8416560 100644 --- a/src/test/java/testdata/CnvAssert.java +++ b/src/test/java/testdata/CnvAssert.java @@ -11,7 +11,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import jp.sourceforge.mikutoga.pmd2xml.ModelFileTypes; +import jp.sourceforge.mikutoga.pmd.ModelFileType; import jp.sourceforge.mikutoga.pmd2xml.Pmd2XmlConv; import static org.junit.Assert.*; @@ -56,8 +56,8 @@ public class CnvAssert { destOut = new BufferedOutputStream(destOut); Pmd2XmlConv converter = new Pmd2XmlConv(); - converter.setInType(ModelFileTypes.XML_101009); - converter.setOutType(ModelFileTypes.PMD); + converter.setInType(ModelFileType.XML_101009); + converter.setOutType(ModelFileType.PMD); converter.setNewline("\n"); converter.convert(xmlis, destOut); @@ -93,8 +93,8 @@ public class CnvAssert { destOut = new BufferedOutputStream(destOut); Pmd2XmlConv converter = new Pmd2XmlConv(); - converter.setInType(ModelFileTypes.PMD); - converter.setOutType(ModelFileTypes.XML_101009); + converter.setInType(ModelFileType.PMD); + converter.setOutType(ModelFileType.XML_101009); converter.setNewline("\n"); converter.setGenerator(null); diff --git a/src/test/java/testdata/TestDriver.java b/src/test/java/testdata/TestDriver.java new file mode 100644 index 0000000..8b4a952 --- /dev/null +++ b/src/test/java/testdata/TestDriver.java @@ -0,0 +1,47 @@ +/* + */ + +package testdata; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * 使い捨てテスト用ドライバ。 + */ +public class TestDriver { + + static{ + assert Test.class != null; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * 使い捨てテスト本体。 + *

テストが終わったら必ず元に戻して + * アノテーション"Test"をコメントアウトするように。 + * @throws Exception テスト失敗 + */ + //@Test + public void main() throws Exception{ + } + +} diff --git a/src/test/java/testdata/pmd101009/bone/BoneTest.java b/src/test/java/testdata/pmd101009/bone/BoneTest.java new file mode 100644 index 0000000..632c21a --- /dev/null +++ b/src/test/java/testdata/pmd101009/bone/BoneTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.bone; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class BoneTest { + + static Class THISCLASS = BoneTest.class; + + public BoneTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "allbone.pmd", "allbone.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "allbone.xml", "allbone.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/charset/CharsetTest.java b/src/test/java/testdata/pmd101009/charset/CharsetTest.java similarity index 83% rename from src/test/java/testdata/charset/CharsetTest.java rename to src/test/java/testdata/pmd101009/charset/CharsetTest.java index 1185976..ccb2896 100644 --- a/src/test/java/testdata/charset/CharsetTest.java +++ b/src/test/java/testdata/pmd101009/charset/CharsetTest.java @@ -1,7 +1,7 @@ /* */ -package testdata.charset; +package testdata.pmd101009.charset; import org.junit.After; import org.junit.AfterClass; @@ -42,14 +42,14 @@ public class CharsetTest { @Test public void pmd2xml() throws Exception{ System.out.println("pmd2xml"); - assertPmd2Xml(THISCLASS, "test.pmd", "result.xml"); + assertPmd2Xml(THISCLASS, "charset.pmd", "result.xml"); return; } @Test public void xml2pmd() throws Exception{ System.out.println("xml2pmd"); - assertXml2Pmd(THISCLASS, "source.xml", "test.pmd"); + assertXml2Pmd(THISCLASS, "source.xml", "charset.pmd"); return; } diff --git a/src/test/java/testdata/pmd101009/group/GroupTest.java b/src/test/java/testdata/pmd101009/group/GroupTest.java new file mode 100644 index 0000000..adaf40e --- /dev/null +++ b/src/test/java/testdata/pmd101009/group/GroupTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.group; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class GroupTest { + + static Class THISCLASS = GroupTest.class; + + public GroupTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "boneGroup.pmd", "boneGroup.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "boneGroup.xml", "boneGroup.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/pmd101009/i18n/I18nTest.java b/src/test/java/testdata/pmd101009/i18n/I18nTest.java new file mode 100644 index 0000000..ce74931 --- /dev/null +++ b/src/test/java/testdata/pmd101009/i18n/I18nTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.i18n; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class I18nTest { + + static Class THISCLASS = I18nTest.class; + + public I18nTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "i18n.pmd", "i18n.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "i18n.xml", "i18n.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/pmd101009/ik/IkBoneTest.java b/src/test/java/testdata/pmd101009/ik/IkBoneTest.java new file mode 100644 index 0000000..8fbce94 --- /dev/null +++ b/src/test/java/testdata/pmd101009/ik/IkBoneTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.ik; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class IkBoneTest { + + static Class THISCLASS = IkBoneTest.class; + + public IkBoneTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "ikBone.pmd", "ikBone.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "ikBone.xml", "ikBone.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/pmd101009/material/MaterialTest.java b/src/test/java/testdata/pmd101009/material/MaterialTest.java new file mode 100644 index 0000000..05e442c --- /dev/null +++ b/src/test/java/testdata/pmd101009/material/MaterialTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.material; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class MaterialTest { + + static Class THISCLASS = MaterialTest.class; + + public MaterialTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "material.pmd", "material.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "material.xml", "material.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/minimum/MinimumTest.java b/src/test/java/testdata/pmd101009/minimum/MinimumTest.java similarity index 83% rename from src/test/java/testdata/minimum/MinimumTest.java rename to src/test/java/testdata/pmd101009/minimum/MinimumTest.java index 485b204..36658a0 100644 --- a/src/test/java/testdata/minimum/MinimumTest.java +++ b/src/test/java/testdata/pmd101009/minimum/MinimumTest.java @@ -1,7 +1,7 @@ /* */ -package testdata.minimum; +package testdata.pmd101009.minimum; import org.junit.After; import org.junit.AfterClass; @@ -42,14 +42,14 @@ public class MinimumTest { @Test public void pmd2xml() throws Exception{ System.out.println("pmd2xml"); - assertPmd2Xml(THISCLASS, "test.pmd", "test.xml"); + assertPmd2Xml(THISCLASS, "minimum.pmd", "minimum.xml"); return; } @Test public void xml2pmd() throws Exception{ System.out.println("xml2pmd"); - assertXml2Pmd(THISCLASS, "test.xml", "test.pmd"); + assertXml2Pmd(THISCLASS, "minimum.xml", "minimum.pmd"); return; } diff --git a/src/test/java/testdata/pmd101009/morph/MorphTest.java b/src/test/java/testdata/pmd101009/morph/MorphTest.java new file mode 100644 index 0000000..e3625bb --- /dev/null +++ b/src/test/java/testdata/pmd101009/morph/MorphTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.morph; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class MorphTest { + + static Class THISCLASS = MorphTest.class; + + public MorphTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "allmorph.pmd", "allmorph.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "allmorph.xml", "allmorph.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/pmd101009/numeric/NumericTest.java b/src/test/java/testdata/pmd101009/numeric/NumericTest.java new file mode 100644 index 0000000..991a2dd --- /dev/null +++ b/src/test/java/testdata/pmd101009/numeric/NumericTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.numeric; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class NumericTest { + + static Class THISCLASS = NumericTest.class; + + public NumericTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "numeric.pmd", "result.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "source.xml", "numeric.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/pmd101009/rigid/RigidTest.java b/src/test/java/testdata/pmd101009/rigid/RigidTest.java new file mode 100644 index 0000000..e4ebf06 --- /dev/null +++ b/src/test/java/testdata/pmd101009/rigid/RigidTest.java @@ -0,0 +1,56 @@ +/* + */ + +package testdata.pmd101009.rigid; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class RigidTest { + + static Class THISCLASS = RigidTest.class; + + public RigidTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xml() throws Exception{ + System.out.println("pmd2xml"); + assertPmd2Xml(THISCLASS, "allrigid.pmd", "allrigid.xml"); + return; + } + + @Test + public void xml2pmd() throws Exception{ + System.out.println("xml2pmd"); + assertXml2Pmd(THISCLASS, "allrigid.xml", "allrigid.pmd"); + return; + } + +} diff --git a/src/test/java/testdata/pmd101009/small/SmallTest.java b/src/test/java/testdata/pmd101009/small/SmallTest.java new file mode 100644 index 0000000..2e3f031 --- /dev/null +++ b/src/test/java/testdata/pmd101009/small/SmallTest.java @@ -0,0 +1,112 @@ +/* + */ + +package testdata.pmd101009.small; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import static testdata.CnvAssert.*; + +/** + * + */ +public class SmallTest { + + static Class THISCLASS = SmallTest.class; + + public SmallTest() { + assert this.getClass() == THISCLASS; + return; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void pmd2xmlBone() throws Exception{ + System.out.println("pmd2xmlBone"); + assertPmd2Xml(THISCLASS, "onlybone.pmd", "onlybone.xml"); + return; + } + + @Test + public void pmd2xmlTriangle() throws Exception{ + System.out.println("pmd2xmlTriangle"); + assertPmd2Xml(THISCLASS, "onlytriangle.pmd", "onlytriangle.xml"); + return; + } + + @Test + public void pmd2xmlMorph() throws Exception{ + System.out.println("pmd2xmlMorph"); + assertPmd2Xml(THISCLASS, "onlymorph.pmd", "onlymorph.xml"); + return; + } + + @Test + public void pmd2xmlRigid() throws Exception{ + System.out.println("pmd2xmlRigid"); + assertPmd2Xml(THISCLASS, "onlyrigid.pmd", "onlyrigid.xml"); + return; + } + + @Test + public void pmd2xmlJoint() throws Exception{ + System.out.println("pmd2xmlJoint"); + assertPmd2Xml(THISCLASS, "onlyjoint.pmd", "onlyjoint.xml"); + return; + } + + @Test + public void xml2pmdBone() throws Exception{ + System.out.println("xml2pmdBone"); + assertXml2Pmd(THISCLASS, "onlybone.xml", "onlybone.pmd"); + return; + } + + @Test + public void xml2pmdTriangle() throws Exception{ + System.out.println("xml2pmdTriangle"); + assertXml2Pmd(THISCLASS, "onlytriangle.xml", "onlytriangle.pmd"); + return; + } + + @Test + public void xml2pmdMorph() throws Exception{ + System.out.println("xml2pmdMorph"); + assertXml2Pmd(THISCLASS, "onlymorph.xml", "onlymorph.pmd"); + return; + } + + @Test + public void xml2pmdRigid() throws Exception{ + System.out.println("xml2pmdRigid"); + assertXml2Pmd(THISCLASS, "onlyrigid.xml", "onlyrigid.pmd"); + return; + } + + @Test + public void xml2pmdJoint() throws Exception{ + System.out.println("xml2pmdJoint"); + assertXml2Pmd(THISCLASS, "onlyjoint.xml", "onlyjoint.pmd"); + return; + } + +} diff --git a/src/test/resources/testdata/charset/Readme.txt b/src/test/resources/testdata/charset/Readme.txt deleted file mode 100644 index 4a4691b..0000000 --- a/src/test/resources/testdata/charset/Readme.txt +++ /dev/null @@ -1 +0,0 @@ -文字集合、エンコーディング、XML文字エスケープ、空白文字に関するテストデータ。 diff --git a/src/test/resources/testdata/charset/test.pmd b/src/test/resources/testdata/charset/test.pmd deleted file mode 100644 index 6cb6d5d..0000000 Binary files a/src/test/resources/testdata/charset/test.pmd and /dev/null differ diff --git a/src/test/resources/testdata/minimum/Readme.txt b/src/test/resources/testdata/minimum/Readme.txt deleted file mode 100644 index 7fd068b..0000000 --- a/src/test/resources/testdata/minimum/Readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -最小構成のPMDファイル。 -※ XMLの改行コードはLF。ジェネレータ名は非表示。 - -名前は空 -説明文は空 -頂点0 -ボーン0 diff --git a/src/test/resources/testdata/pmd101009/bone/Readme.txt b/src/test/resources/testdata/pmd101009/bone/Readme.txt new file mode 100644 index 0000000..5b53910 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/bone/Readme.txt @@ -0,0 +1,13 @@ +[UTF8 Japanese] + + +10種類全てのボーンを含むPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- allbone.pmd 10種類全てのボーンを含むテストデータ。 +- allbone.xml モデルデータのソースとなったXMLファイル。 + + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/bone/allbone.pmd b/src/test/resources/testdata/pmd101009/bone/allbone.pmd new file mode 100644 index 0000000..1e76145 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/bone/allbone.pmd differ diff --git a/src/test/resources/testdata/pmd101009/bone/allbone.xml b/src/test/resources/testdata/pmd101009/bone/allbone.xml new file mode 100644 index 0000000..b584e31 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/bone/allbone.xml @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/charset/Readme.txt b/src/test/resources/testdata/pmd101009/charset/Readme.txt new file mode 100644 index 0000000..f003f87 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/charset/Readme.txt @@ -0,0 +1,27 @@ +[UTF8 Japanese] + + +文字集合、エンコーディング、空白文字に関するPMDテストデータ。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- charset.pmd モデル名とモデル説明文に色々な字が書き込まれたテストデータ。 +- source.xml モデルデータのソースとなったXMLファイル。 +- result.xml モデルデータをXML化したときのあるべきXMLファイル。 + + +PMDモデルファイル内の文字データは +文字集合「JIS X 0208-1990」に +マイクロソフトによる追加文字を加えた物を +シフトJISで符号化したものと仮定する。 + +この文字コード形式の一般的な規格名は +・Windows-31J +・CP932 +など + +MMDでは、濁点を伴う半角カタカナなどをそのまま識別子に使う機会も多い。 +Unicodeデータとの交換時には、不用意な正規化を行わないよう注意が必要。 + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/charset/charset.pmd b/src/test/resources/testdata/pmd101009/charset/charset.pmd new file mode 100644 index 0000000..cd33fe5 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/charset/charset.pmd differ diff --git a/src/test/resources/testdata/pmd101009/charset/result.xml b/src/test/resources/testdata/pmd101009/charset/result.xml new file mode 100644 index 0000000..44b20cb --- /dev/null +++ b/src/test/resources/testdata/pmd101009/charset/result.xml @@ -0,0 +1,126 @@ + + + + + + + + + + +azAZ09ア
+AZ09あアゑヵヶ
+ヴウ゛ヴパハ゜パ
+ΩωЖж┴
+峠壺壷尭堯凜熙
+\\\¥
+髙⑨≒∵¬㈱Σ
+#$[\]^{|}~
+'"&<>
+<!--fake comment-->
+A B C
+A B C
+A B  C
+AB
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/src/test/resources/testdata/pmd101009/charset/source.xml b/src/test/resources/testdata/pmd101009/charset/source.xml new file mode 100644 index 0000000..4eb03bb --- /dev/null +++ b/src/test/resources/testdata/pmd101009/charset/source.xml @@ -0,0 +1,115 @@ + + + + + + + + + +azAZ09ï½±
+AZ09あアゑヵヶ
+ヴウ゛ヴパハ゜パ
+ΩωЖж┴
+峠壺壷尭堯凜熙
+\\¥¥
+髙⑨≒∵¬㈱Σ
+#$[\]^{|}~
+]]>
+]]>
+A B C
+A B C
+A B  C
+A B
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/src/test/resources/testdata/pmd101009/group/Readme.txt b/src/test/resources/testdata/pmd101009/group/Readme.txt new file mode 100644 index 0000000..1f9a2d1 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/group/Readme.txt @@ -0,0 +1,18 @@ +[UTF8 Japanese] + + +ボーンをグループ分けしたPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- boneGroup.pmd グループ分けされたボーンを有するテストデータ。 +- boneGroup.xml モデルデータのソースとなったXMLファイル。 + + +test0からtest3までの名が付けられた4ボーンが +ボーン枠「偶数ボーン」とボーン枠「奇数ボーン」に2つずつ振り分けられる。 + +ボーン名「test」は0番ボーン扱い。 + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/group/boneGroup.pmd b/src/test/resources/testdata/pmd101009/group/boneGroup.pmd new file mode 100644 index 0000000..5e7ba42 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/group/boneGroup.pmd differ diff --git a/src/test/resources/testdata/pmd101009/group/boneGroup.xml b/src/test/resources/testdata/pmd101009/group/boneGroup.xml new file mode 100644 index 0000000..c33e801 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/group/boneGroup.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/i18n/Readme.txt b/src/test/resources/testdata/pmd101009/i18n/Readme.txt new file mode 100644 index 0000000..31897a9 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/i18n/Readme.txt @@ -0,0 +1,21 @@ +[UTF8 Japanese] + + +各種英語名を記述したPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- i18n.pmd 英語名が記述されたテストデータ。 +- i18n.xml モデルデータのソースとなったXMLファイル。 + + +モデル名「テストモデル」に対応する英語名「TestModel」 +説明文「説明」に対応する英語文「Description」 +ボーン名「センター」に対応する英語名「Center」 +ボーン名「テストボーン」に対応する英語名「TestBone」 +グループ枠「テストグループ」に対応する英語名「TestGroup」 +モーフ名「テストモーフ」に対応する英語名「TestMorph」 + + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/i18n/i18n.pmd b/src/test/resources/testdata/pmd101009/i18n/i18n.pmd new file mode 100644 index 0000000..0c689d1 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/i18n/i18n.pmd differ diff --git a/src/test/resources/testdata/pmd101009/i18n/i18n.xml b/src/test/resources/testdata/pmd101009/i18n/i18n.xml new file mode 100644 index 0000000..4e923df --- /dev/null +++ b/src/test/resources/testdata/pmd101009/i18n/i18n.xml @@ -0,0 +1,190 @@ + + + + + + + + + + + +説明 + + + + +Description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/ik/Readme.txt b/src/test/resources/testdata/pmd101009/ik/Readme.txt new file mode 100644 index 0000000..5a1de37 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/ik/Readme.txt @@ -0,0 +1,21 @@ +[UTF8 Japanese] + + +IKボーンを記述したPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- ikBone.pmd IKボーンが記述されたテストデータ。 +- ikBone.xml モデルデータのソースとなったXMLファイル。 + + +左足首 → 左ひざ → 左足 → センター の順で親ボーンを参照する。 +左足首、左ひざ、左足、いずれのボーン分類も「IK影響下」 + +IKボーン「左足IK」のターゲットは「左足首」。 +IKボーン「左足IK」の影響下にあるボーンは「左ひざ」と「左足」の順。 +IKボーン「左足IK」によるIK処理のループ回数は50、単位は0.5 + + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/ik/ikBone.pmd b/src/test/resources/testdata/pmd101009/ik/ikBone.pmd new file mode 100644 index 0000000..1927925 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/ik/ikBone.pmd differ diff --git a/src/test/resources/testdata/pmd101009/ik/ikBone.xml b/src/test/resources/testdata/pmd101009/ik/ikBone.xml new file mode 100644 index 0000000..fe4251a --- /dev/null +++ b/src/test/resources/testdata/pmd101009/ik/ikBone.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/material/Readme.txt b/src/test/resources/testdata/pmd101009/material/Readme.txt new file mode 100644 index 0000000..52715d8 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/material/Readme.txt @@ -0,0 +1,36 @@ +[UTF8 Japanese] + + +様々なマテリアル設定を含むPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- material.pmd 様々なマテリアル設定を含むテストデータ。 +- material.xml モデルデータのソースとなったXMLファイル。 + + +・マテリアル0番 + エッジ表示フラグがオフな事を確認。 + +・マテリアル1番 + ビルトインのトゥーンマップ名"toon01.bmp"が指定されていることを確認。 + +・マテリアル2番 + カスタムトゥーンマップ名"test.bmp"が指定されていることを確認。 + +・マテリアル3番 + テクスチャマップファイル名に"Test.bmp"が指定されていることを確認。 + +・マテリアル4番 + スフィアマップファイル名に"Test.sph"が指定されていることを確認。 + +・マテリアル5番 + トゥーンマップとテクスチャマップとスフィアマップが + 同時に指定されていることを確認。 + +・マテリアル6番 + 加算スフィアマップファイル名に"Test.spa"が指定されていることを確認。 + + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/material/material.pmd b/src/test/resources/testdata/pmd101009/material/material.pmd new file mode 100644 index 0000000..e405956 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/material/material.pmd differ diff --git a/src/test/resources/testdata/pmd101009/material/material.xml b/src/test/resources/testdata/pmd101009/material/material.xml new file mode 100644 index 0000000..7ed96b1 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/material/material.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/minimum/Readme.txt b/src/test/resources/testdata/pmd101009/minimum/Readme.txt new file mode 100644 index 0000000..9f74f62 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/minimum/Readme.txt @@ -0,0 +1,18 @@ +[UTF8 Japanese] + + +最小構成のPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- minimum.pmd 最小構成のテストデータ。 +- minimum.xml モデルデータのソースとなったXMLファイル。 + + +・名前は空。 +・説明文は空。 +・0頂点。 +・0ボーン。 + + +-- EOF -- diff --git a/src/test/resources/testdata/minimum/test.pmd b/src/test/resources/testdata/pmd101009/minimum/minimum.pmd similarity index 100% rename from src/test/resources/testdata/minimum/test.pmd rename to src/test/resources/testdata/pmd101009/minimum/minimum.pmd diff --git a/src/test/resources/testdata/pmd101009/minimum/minimum.xml b/src/test/resources/testdata/pmd101009/minimum/minimum.xml new file mode 100644 index 0000000..1ccd4c3 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/minimum/minimum.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/morph/Readme.txt b/src/test/resources/testdata/pmd101009/morph/Readme.txt new file mode 100644 index 0000000..ba9ba2d --- /dev/null +++ b/src/test/resources/testdata/pmd101009/morph/Readme.txt @@ -0,0 +1,13 @@ +[UTF8 Japanese] + + +4種類全てのモーフを含むPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- allmorph.pmd 4種類全てのモーフを含むテストデータ。 +- allmorph.xml モデルデータのソースとなったXMLファイル。 + + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/morph/allmorph.pmd b/src/test/resources/testdata/pmd101009/morph/allmorph.pmd new file mode 100644 index 0000000..91f933f Binary files /dev/null and b/src/test/resources/testdata/pmd101009/morph/allmorph.pmd differ diff --git a/src/test/resources/testdata/pmd101009/morph/allmorph.xml b/src/test/resources/testdata/pmd101009/morph/allmorph.xml new file mode 100644 index 0000000..30d90dc --- /dev/null +++ b/src/test/resources/testdata/pmd101009/morph/allmorph.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/numeric/Readme.txt b/src/test/resources/testdata/pmd101009/numeric/Readme.txt new file mode 100644 index 0000000..c0408f1 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/numeric/Readme.txt @@ -0,0 +1,49 @@ +[UTF8 Japanese] + + +きわどい数値データを含むPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- numeric.pmd 様々な数値が書き込まれたテストデータ。 +- source.xml モデルデータのソースとなったXMLファイル。 +- result.xml モデルデータをXML化したときのあるべきXMLファイル。 + + +MMDのモデルファイルでは、実数表現としてIEEE754単精度型を用いる。 +IEEE754単精度型は、Javaのfloat型値や、XML Schemaのfloat型値に該当する。 +参照URL: http://www.w3.org/TR/xmlschema-2/#float + +ソフトウェアによっては、単精度正規数の最小値 + 1.175494350822287507968736537222245677818665556772087521508751706278 + 4172594547271728515625E-38 +を下回る絶対値の値を扱おうとすると、 +演算トラップが発生して異常終了することがあるので注意。 +MMDやPMDEditorでは、このようなデータが出現しても異常終了しない。 + +このモデルデータでは、各ボーンの座標にテスト用の数値を格納する。 + + +test01 + 様々なゼロ表記。z値のゼロ値には負の符号が付かなければならない。 + ※ PMDEditorは負のゼロを解釈できない? + +test02 + 様々な指数形式での表記その1。 + +test03 + 様々な指数形式での表記その2。 + +test04 + 0、およびその次に小さい数、さらにその次に小さい数。 + +test05 + 最小の正符号の正規数、およびその前後値。 + ※ PMDEditorはこれらのデータを区別できない? + +test06 + 1.0、およびその前後値。 + ※ PMDEditorは1.0とその次に大きい値を区別できない? + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/numeric/numeric.pmd b/src/test/resources/testdata/pmd101009/numeric/numeric.pmd new file mode 100644 index 0000000..ee26a4f Binary files /dev/null and b/src/test/resources/testdata/pmd101009/numeric/numeric.pmd differ diff --git a/src/test/resources/testdata/charset/result.xml b/src/test/resources/testdata/pmd101009/numeric/result.xml similarity index 68% rename from src/test/resources/testdata/charset/result.xml rename to src/test/resources/testdata/pmd101009/numeric/result.xml index 68d22ee..3fb0677 100644 --- a/src/test/resources/testdata/charset/result.xml +++ b/src/test/resources/testdata/pmd101009/numeric/result.xml @@ -6,41 +6,20 @@ --> - + -azAZAZ0909あアアゑヵヶΩωЖж
-┐└漢峠凜熙
-ヴウ゛ヴパハ゜パ
-壺壷尭堯
-\\\¥
-髙⑨≒∵¬㈱Σ
-#$[\]^{|}~
-cdata'"&<>test
-<!--fake comment-->
-A B C D E F  GHI
- @@ -52,7 +31,6 @@ A B C␉D␉␉E F  GHI - @@ -84,85 +62,84 @@ Bone types: [9 : LINKEDROT : Linked Rotate: 回転連動 :] --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/test/resources/testdata/pmd101009/numeric/source.xml b/src/test/resources/testdata/pmd101009/numeric/source.xml new file mode 100644 index 0000000..2b59358 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/numeric/source.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/rigid/Readme.txt b/src/test/resources/testdata/pmd101009/rigid/Readme.txt new file mode 100644 index 0000000..c68b8fb --- /dev/null +++ b/src/test/resources/testdata/pmd101009/rigid/Readme.txt @@ -0,0 +1,13 @@ +[UTF8 Japanese] + + +全種類全形状の剛体を含むPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +- allrigid.pmd 全種類全形状の剛体を含むテストデータ。 +- allrigid.xml モデルデータのソースとなったXMLファイル。 + + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/rigid/allrigid.pmd b/src/test/resources/testdata/pmd101009/rigid/allrigid.pmd new file mode 100644 index 0000000..05b2a23 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/rigid/allrigid.pmd differ diff --git a/src/test/resources/testdata/pmd101009/rigid/allrigid.xml b/src/test/resources/testdata/pmd101009/rigid/allrigid.xml new file mode 100644 index 0000000..9fa3b6e --- /dev/null +++ b/src/test/resources/testdata/pmd101009/rigid/allrigid.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/small/Readme.txt b/src/test/resources/testdata/pmd101009/small/Readme.txt new file mode 100644 index 0000000..6866278 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/small/Readme.txt @@ -0,0 +1,103 @@ +[UTF8 Japanese] + + +データの小さいPMDファイル。 +※ XMLの改行コードはLF。ジェネレータ名は非表示。 + + +======================================================================== +onlybone.pmd +onlybone.xml + +ボーンが一つだけ定義されたPMDモデルデータ。 +ボーン名「テストボーン」 +種別「回転/移動」 +座標(0.0, 0.0, 0.0) +親子関係なし + +======================================================================== +onlytriangle.pmd +onlytriangle.xml + +onlybone.pmdに加え、 +三角ポリゴンとマテリアルが一つだけ定義されたPMDモデルデータ。 + +ポリゴンは三頂点(0.0, 0.0, 0.0), (-5.0, 8.0, 0.0), (5.0, 8.0, 0.0) +を結ぶ三角形。 +いずれの頂点も法線ベクトルは(0.0, 0.0, -1.0)。 +いずれの頂点もエッジ表示設定はオン。 +いずれの頂点もuv座標は(0.0, 1.0) +いずれの頂点も唯一のテストボーンへのウェイト100%。 + +マテリアル設定: +Diffuse色 0.75, 0.25, 0.25 +Specular色 0.0, 0.0, 0.0 +Ambient色 0.25, 0.75, 0.26 +Alpha値 1.0 +Shininess値 5 +輪郭表示あり +Toon設定はなし。 + +======================================================================== +onlymorph.pmd +onlymorph.xml + +onlytriangle.pmdに加え、 +頂点モーフが一つだけ定義されたPMDモデルデータ。 + +モーフ名:テストモーフ +モーフ種別:その他 +三角形の一番Y値の低い頂点(0.0, 0.0, 0.0)を +(0.0, 3.0, 0.0)までモーフする。 + +======================================================================== +onlyrigid.pmd +onlyrigid.xml + +onlybone.pmdに加え、 +剛体が一つだけ定義されたPMDモデルデータ。 + +剛体名:テスト剛体 +唯一のテストボーンに追従 + +箱形状(W:1.0 H:2.0 D:3.0) +剛体位置:(0.0, 0.0, 0.0) +剛体姿勢:(0.0, 0.0, 0.0) + +剛体グループ1に所属。 +いかなる剛体グループとも衝突する。 + +質量:0.1 +移動減衰:0.2 +回転減衰:0.3 +反発力:0.4 +摩擦力:0.5 + +======================================================================== +onlyjoint.pmd +onlyjoint.xml + +onlyrigid.pmdに加え、 +接続ボーンを持たない剛体「フリー剛体」を追加し、 +二つになった剛体を結ぶジョイントが一つだけ定義されたPMDモデルデータ。 + +「フリー剛体」は、接続ボーンを持たないことと物理演算属性であること意外は +「テスト剛体」と同じ設定。 + +ジョイント名:テストジョイント +テスト剛体とフリー剛体を結ぶ。 + +ジョイント位置:(0.0,0.0,0.0) +位置制限(0.0-0.0, 0.0-0.0, 0.0-0.0) + +ジョイント姿勢:(0.0,0.0,0.0) +姿勢制限(0.0-0.0, 0.0-0.0, 0.0-0.0) + +バネ移動:(0.0, 0.0, 0.0) +バネ姿勢:(0.0, 0.0, 0.0) + + +======================================================================== + + +-- EOF -- diff --git a/src/test/resources/testdata/pmd101009/small/onlybone.pmd b/src/test/resources/testdata/pmd101009/small/onlybone.pmd new file mode 100644 index 0000000..9f3a3bb Binary files /dev/null and b/src/test/resources/testdata/pmd101009/small/onlybone.pmd differ diff --git a/src/test/resources/testdata/minimum/test.xml b/src/test/resources/testdata/pmd101009/small/onlybone.xml similarity index 86% rename from src/test/resources/testdata/minimum/test.xml rename to src/test/resources/testdata/pmd101009/small/onlybone.xml index 2c33970..e6ff91d 100644 --- a/src/test/resources/testdata/minimum/test.xml +++ b/src/test/resources/testdata/pmd101009/small/onlybone.xml @@ -6,11 +6,12 @@ --> - + - @@ -62,85 +62,54 @@ Bone types: [9 : LINKEDROT : Linked Rotate: 回転連動 :] --> + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/testdata/pmd101009/small/onlyjoint.pmd b/src/test/resources/testdata/pmd101009/small/onlyjoint.pmd new file mode 100644 index 0000000..3d9ca8a Binary files /dev/null and b/src/test/resources/testdata/pmd101009/small/onlyjoint.pmd differ diff --git a/src/test/resources/testdata/pmd101009/small/onlyjoint.xml b/src/test/resources/testdata/pmd101009/small/onlyjoint.xml new file mode 100644 index 0000000..3e61dbe --- /dev/null +++ b/src/test/resources/testdata/pmd101009/small/onlyjoint.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/small/onlymorph.pmd b/src/test/resources/testdata/pmd101009/small/onlymorph.pmd new file mode 100644 index 0000000..e43927e Binary files /dev/null and b/src/test/resources/testdata/pmd101009/small/onlymorph.pmd differ diff --git a/src/test/resources/testdata/pmd101009/small/onlymorph.xml b/src/test/resources/testdata/pmd101009/small/onlymorph.xml new file mode 100644 index 0000000..73d19b2 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/small/onlymorph.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/testdata/pmd101009/small/onlyrigid.pmd b/src/test/resources/testdata/pmd101009/small/onlyrigid.pmd new file mode 100644 index 0000000..b636f57 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/small/onlyrigid.pmd differ diff --git a/src/test/resources/testdata/charset/source.xml b/src/test/resources/testdata/pmd101009/small/onlyrigid.xml similarity index 75% rename from src/test/resources/testdata/charset/source.xml rename to src/test/resources/testdata/pmd101009/small/onlyrigid.xml index 0f80ccc..e39a0b5 100644 --- a/src/test/resources/testdata/charset/source.xml +++ b/src/test/resources/testdata/pmd101009/small/onlyrigid.xml @@ -6,28 +6,19 @@ --> + -azAZAZ0909あアアゑヵヶΩωЖж
-┐└漢峠凜熙
-ヴウ゛ヴパハ゜パ
-壺壷尭堯
-\\¥¥
-髙⑨≒∵¬㈱Σ
-#$[\]^{|}~
-test]]>
-]]>
-A B C D E F  G -H I
@@ -40,7 +31,6 @@ H I - @@ -72,26 +62,21 @@ Bone types: [9 : LINKEDROT : Linked Rotate: 回転連動 :] --> + + + + + + - - - - - @@ -103,54 +88,56 @@ Rigid behavior types: [2 : BONEDDYNAMICS : ボーン位置合わせ ] --> + + + + + + + + + + + - + + + - - - - - - - - - - - - - - - - -
diff --git a/src/test/resources/testdata/pmd101009/small/onlytriangle.pmd b/src/test/resources/testdata/pmd101009/small/onlytriangle.pmd new file mode 100644 index 0000000..daf75c5 Binary files /dev/null and b/src/test/resources/testdata/pmd101009/small/onlytriangle.pmd differ diff --git a/src/test/resources/testdata/pmd101009/small/onlytriangle.xml b/src/test/resources/testdata/pmd101009/small/onlytriangle.xml new file mode 100644 index 0000000..ad34bb1 --- /dev/null +++ b/src/test/resources/testdata/pmd101009/small/onlytriangle.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +