Java Code Examples for com.jme3.export.InputCapsule#readStringSavableMap()

The following examples show how to use com.jme3.export.InputCapsule#readStringSavableMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimComposer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    animClipMap = (Map<String, AnimClip>) ic.readStringSavableMap("animClipMap", new HashMap<String, AnimClip>());
    globalSpeed = ic.readFloat("globalSpeed", 1f);
}
 
Example 2
Source File: Shader.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void read(JmeImporter im) throws IOException{
    InputCapsule ic = im.getCapsule(this);
    language = ic.readString("language", null);
    shaderList = ic.readSavableArrayList("shaderList", null);
    attribs = (IntMap<Attribute>) ic.readIntSavableMap("attribs", null);

    HashMap<String, Uniform> uniMap = (HashMap<String, Uniform>) ic.readStringSavableMap("uniforms", null);
    uniforms = new ListMap<String, Uniform>(uniMap);
}
 
Example 3
Source File: Cinematic.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);

    cinematicEvents = ic.readSavableArrayList("cinematicEvents", null);
    cameras = (Map<String, CameraNode>) ic.readStringSavableMap("cameras", null);
    timeLine = (TimeLine) ic.readSavable("timeLine", null);
    niftyXmlPath = ic.readString("niftyXmlPath", null);

}
 
Example 4
Source File: PMDNode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
    public void read(JmeImporter e) throws IOException {
        super.read(e);
        InputCapsule c = e.getCapsule(this);
        pmdModel = (PMDModel)SavableUtil.read(c, "pmdModel", null);
        skeleton = (Skeleton)c.readSavable("skeleton", null);
        skinMap = (Map<String, Skin>)c.readStringSavableMap("skinMap", new HashMap<String, Savable>());
//        skinBoneWeightArray = c.readFloatArray("skinBoneWeightArray", new float[0]);
//        skinBoneArray = c.readIntArray("skinBoneArray", new int[0]);
        edgeSize = c.readFloat("edgeSize", 1.0f);
        int pmdGeometryArrayLength = c.readInt("pmdGeometryArrayLength", 0);
        pmdGeometryArray = new PMDGeometry[pmdGeometryArrayLength];
        targets = new PMDMesh[pmdGeometryArrayLength];
        int skinTargetsLength = c.readInt("skinTargetsLength", 0);
        skinTargets = new PMDSkinMesh[skinTargetsLength];
        VertexBuffer skinvb = (VertexBuffer)c.readSavable("skinvb", null);
        VertexBuffer skinnb = (VertexBuffer)c.readSavable("skinnb", null);
        VertexBuffer skintb = (VertexBuffer)c.readSavable("skintb", null);
        VertexBuffer skinvb2 = skinvb.clone();
        VertexBuffer skinnb2 = skinnb.clone();
        int meshCount = 0;
        int skinMeshCount = 0;
            for(Spatial sp : getChildren()) {
                Spatial newSp = sp;//.clone();
//                newPMDNode.attachChild(newSp);
                if (sp instanceof PMDGeometry) {
                    Mesh mesh = ((Geometry)newSp).getMesh();
                    if (mesh instanceof PMDMesh) {
                        PMDMesh pmdMesh = (PMDMesh)mesh;
                        pmdMesh.setVbBackup(pmdMesh.getBuffer(Type.Position));
                        pmdMesh.setNbBackup(pmdMesh.getBuffer(Type.Normal));
                        pmdGeometryArray[meshCount] = (PMDGeometry)sp;
                        targets[meshCount++] = (PMDMesh)mesh;
                    } else if (mesh instanceof PMDSkinMesh) {
//                        mesh.setMode(Mesh.Mode.Triangles);
                        PMDSkinMesh skinMesh = (PMDSkinMesh)mesh;
                        if (skinMeshCount != 0) {
                            skinMesh.setBuffer(skinvb);
                            skinMesh.setSkinvb2(skinvb2);
                            skinMesh.setBuffer(skinnb);
//                            skinMesh.setSkinnb2(skinnb2);
                            skinMesh.setBuffer(skintb);
                        } else {
                            skinMesh.setBuffer(skinvb);
                            skinMesh.setSkinvb2(skinvb2);
                            skinMesh.setBuffer(skinnb);
//                            skinMesh.setSkinnb2(skinnb2);
                            skinMesh.setBuffer(skintb);
                        }
                        skinTargets[skinMeshCount++] = (PMDSkinMesh)mesh;
                    }
                }
            }
            calcOffsetMatrices();
            Savable[] sa = c.readSavableArray("skinArray", new Skin[0]);
            skinArray = new Skin[sa.length];
            for(int i=0;i<sa.length;i++) {
                Skin skin = (Skin)sa[i];
                skinArray[i] = skin;
                skin.pmdNode = this;
                l2:
                for(int i2=0;i2<pmdModel.getSkinCount();i2++){
                    if (pmdModel.getSkinData()[i2].getSkinName().equals(skin.getSkinName())) {
//                        skin.skinData = pmdModel.getSkinData()[i2];
                        break l2;
                    }
                }
                skin.setWeight(0f);
                skin.setUpdateNeeded(true);
                skinMap.put(skin.skinName, skin);
            }
//            skinPosArray = (javax.vecmath.Vector3f[])SavableUtil.read(c, "skinPosArray", null);
//            skinPosArrayOrig = new javax.vecmath.Vector3f[skinPosArray.length];
//            for(int i=0;i<skinPosArray.length;i++) {
//                skinPosArrayOrig[i] = new javax.vecmath.Vector3f(skinPosArray[i]);
//            }
//            skinNormalArray = (javax.vecmath.Vector3f[])SavableUtil.read(c, "skinNormalArray", null);
//            skinNormalArrayOrig = new javax.vecmath.Vector3f[skinNormalArray.length];
//            for(int i=0;i<skinNormalArray.length;i++) {
//                skinNormalArrayOrig[i] = new javax.vecmath.Vector3f(skinNormalArray[i]);
//            }
//            skinBoneArray = c.readIntArray("skinBoneArray", skinBoneArray);
//            skinBoneWeightArray = c.readFloatArray("skinBoneWeightArray", skinBoneWeightArray);
    }