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

The following examples show how to use com.jme3.export.InputCapsule#readString() . 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: UserData.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);
    type = ic.readByte("type", (byte) 0);

    switch (type) {
        case 0:
            value = ic.readInt("intVal", 0);
            break;
        case 1:
            value = ic.readFloat("floatVal", 0f);
            break;
        case 2:
            value = ic.readBoolean("boolVal", false);
            break;
        case 3:
            value = ic.readString("strVal", null);
            break;
        case 4:
            value = ic.readLong("longVal", 0l);
            break;
        default:
            throw new UnsupportedOperationException();
    }
}
 
Example 2
Source File: TerrainGrid.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule c = im.getCapsule(this);
    name = c.readString("name", null);
    size = c.readInt("size", 0);
    patchSize = c.readInt("patchSize", 0);
    stepScale = (Vector3f) c.readSavable("stepScale", null);
    offset = (Vector2f) c.readSavable("offset", null);
    offsetAmount = c.readFloat("offsetAmount", 0);
    gridTileLoader = (TerrainGridTileLoader) c.readSavable("terrainQuadGrid", null);
    material = (Material) c.readSavable("material", null);
    initData();
    if (gridTileLoader != null) {
        gridTileLoader.setPatchSize(this.patchSize);
        gridTileLoader.setQuadSize(this.quadSize);
    }
}
 
Example 3
Source File: MatParam.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);
    type = ic.readEnum("varType", VarType.class, null);
    name = ic.readString("name", null);
    ffBinding = ic.readEnum("ff_binding", FixedFuncBinding.class, null);
    switch (getVarType()) {
        case Boolean:
            value = ic.readBoolean("value_bool", false);
            break;
        case Float:
            value = ic.readFloat("value_float", 0f);
            break;
        case Int:
            value = ic.readInt("value_int", 0);
            break;
        default:
            value = ic.readSavable("value_savable", null);
            break;
    }
}
 
Example 4
Source File: TerrainGrid.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule c = im.getCapsule(this);
    name = c.readString("name", null);
    size = c.readInt("size", 0);
    patchSize = c.readInt("patchSize", 0);
    stepScale = (Vector3f) c.readSavable("stepScale", null);
    offset = (Vector2f) c.readSavable("offset", null);
    offsetAmount = c.readFloat("offsetAmount", 0);
    gridTileLoader = (TerrainGridTileLoader) c.readSavable("terrainQuadGrid", null);
    material = (Material) c.readSavable("material", null);
    initData();
    if (gridTileLoader != null) {
        gridTileLoader.setPatchSize(this.patchSize);
        gridTileLoader.setQuadSize(this.quadSize);
    }
}
 
Example 5
Source File: BlenderKey.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void read(JmeImporter e) throws IOException {
    super.read(e);
    InputCapsule ic = e.getCapsule(this);
    fps = ic.readInt("fps", DEFAULT_FPS);
    featuresToLoad = ic.readInt("features-to-load", FeaturesToLoad.ALL);
    loadUnlinkedAssets = ic.readBoolean("load-unlinked-assets", false);
    assetRootPath = ic.readString("asset-root-path", null);
    fixUpAxis = ic.readBoolean("fix-up-axis", true);
    generatedTexturePPU = ic.readInt("generated-texture-ppu", 128);
    usedWorld = ic.readString("used-world", null);
    defaultMaterial = (Material) ic.readSavable("default-material", null);
    faceCullMode = ic.readEnum("face-cull-mode", FaceCullMode.class, FaceCullMode.Off);
    layersToLoad = ic.readInt("layers-to=load", -1);
    mipmapGenerationMethod = ic.readEnum("mipmap-generation-method", MipmapGenerationMethod.class, MipmapGenerationMethod.GENERATE_WHEN_NEEDED);
}
 
Example 6
Source File: PositionTrack.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);
    spatialName = ic.readString("spatialName", "");
    endPosition = (Vector3f) ic.readSavable("endPosition", null);
}
 
Example 7
Source File: TechniqueDef.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);
    name = ic.readString("name", null);
    vertName = ic.readString("vertName", null);
    fragName = ic.readString("fragName", null);
    shaderLang = ic.readString("shaderLang", null);
    presetDefines = (DefineList) ic.readSavable("presetDefines", null);
    lightMode = ic.readEnum("lightMode", LightMode.class, LightMode.Disable);
    shadowMode = ic.readEnum("shadowMode", ShadowMode.class, ShadowMode.Disable);
    renderState = (RenderState) ic.readSavable("renderState", null);
    usesShaders = ic.readBoolean("usesShaders", false);
}
 
Example 8
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 9
Source File: ShaderKey.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);
    fragName = ic.readString("fragment_name", null);
    language = ic.readString("language", null);
}
 
Example 10
Source File: DefineList.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);

    String[] keys = ic.readStringArray("keys", null);
    String[] vals = ic.readStringArray("vals", null);
    for (int i = 0; i < keys.length; i++){
        defines.put(keys[i], vals[i]);
    }

    compiled = ic.readString("compiled", null);
}
 
Example 11
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 12
Source File: Texture.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void read(JmeImporter e) throws IOException {
    InputCapsule capsule = e.getCapsule(this);
    name = capsule.readString("name", null);
    key = (TextureKey) capsule.readSavable("key", null);
    
    // load texture from key, if available
    if (key != null) {
        // key is available, so try the texture from there.
        Texture loadedTex = e.getAssetManager().loadTexture(key);
        if (loadedTex == null) {
            Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Could not load texture: {0}", key.toString());
        } else {
            image = loadedTex.getImage();
        }
    }else{
        // no key is set on the texture. Attempt to load an embedded image
        image = (Image) capsule.readSavable("image", null);
        if (image == null){
            // TODO: what to print out here? the texture has no key or data, there's no useful information .. 
            // assume texture.name is set even though the key is null
            Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Could not load embedded image: {0}", toString() );
        }
    }

    anisotropicFilter = capsule.readInt("anisotropicFilter", 1);
    minificationFilter = capsule.readEnum("minificationFilter",
            MinFilter.class,
            MinFilter.BilinearNoMipMaps);
    magnificationFilter = capsule.readEnum("magnificationFilter",
            MagFilter.class, MagFilter.Bilinear);
}
 
Example 13
Source File: RotationTrack.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);
    spatialName = ic.readString("spatialName", "");
    endRotation = (Quaternion) ic.readSavable("endRotation", null);
}
 
Example 14
Source File: CameraEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * used internally for serialization
 *
 * @param im
 * @throws IOException
 */
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    cameraName = ic.readString("cameraName", null);
}
 
Example 15
Source File: AnimationTrack.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);
    modelName = ic.readString("modelName", "");
    animationName = ic.readString("animationName", "");
}
 
Example 16
Source File: ShaderNodeVariable.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * jme serialization (not used)
 *
 * @param im the importer
 * @throws IOException
 */
@Override
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);
    name = ic.readString("name", "");
    type = ic.readString("type", "");
    prefix = ic.readString("pefix", "");
    nameSpace = ic.readString("nameSpace", "");
    condition = ic.readString("condition", null);
    shaderOutput = ic.readBoolean("shaderOutput", false);
    multiplicity = ic.readString("multiplicity", null);
    defaultValue = ic.readString("defaultValue", null);
}
 
Example 17
Source File: AssetTileLoader.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    InputCapsule c = im.getCapsule(this);
    manager = im.getAssetManager();
    assetPath = c.readString("assetPath", null);
    name = c.readString("name", null);
}
 
Example 18
Source File: Skin.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    InputCapsule c = im.getCapsule(this);
    skinName = c.readString("skinName", "");
    weight = c.readFloat("weight", 0f);
}
 
Example 19
Source File: AssetTileLoader.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void read(JmeImporter im) throws IOException {
    InputCapsule c = im.getCapsule(this);
    manager = im.getAssetManager();
    assetPath = c.readString("assetPath", null);
    name = c.readString("name", null);
}
 
Example 20
Source File: GuiTrack.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    screen = ic.readString("screen", "");
}