Java Code Examples for com.jme3.export.OutputCapsule#writeSavableArrayList()

The following examples show how to use com.jme3.export.OutputCapsule#writeSavableArrayList() . 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: PhysicsRigidBody.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);

    capsule.write(getMass(), "mass", 1.0f);

    capsule.write(getGravity(), "gravity", Vector3f.ZERO);
    capsule.write(getFriction(), "friction", 0.5f);
    capsule.write(getRestitution(), "restitution", 0);
    capsule.write(getAngularFactor(), "angularFactor", 1);
    capsule.write(kinematic, "kinematic", false);

    capsule.write(constructionInfo.linearDamping, "linearDamping", 0);
    capsule.write(constructionInfo.angularDamping, "angularDamping", 0);
    capsule.write(constructionInfo.linearSleepingThreshold, "linearSleepingThreshold", 0.8f);
    capsule.write(constructionInfo.angularSleepingThreshold, "angularSleepingThreshold", 1.0f);

    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);

    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());

    capsule.writeSavableArrayList(joints, "joints", null);
}
 
Example 2
Source File: PhysicsRigidBody.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);

    capsule.write(getMass(), "mass", 1.0f);

    capsule.write(getGravity(), "gravity", Vector3f.ZERO);
    capsule.write(getFriction(), "friction", 0.5f);
    capsule.write(getRestitution(), "restitution", 0);
    capsule.write(getAngularFactor(), "angularFactor", 1);
    capsule.write(kinematic, "kinematic", false);

    capsule.write(getLinearDamping(), "linearDamping", 0);
    capsule.write(getAngularDamping(), "angularDamping", 0);
    capsule.write(getLinearSleepingThreshold(), "linearSleepingThreshold", 0.8f);
    capsule.write(getAngularSleepingThreshold(), "angularSleepingThreshold", 1.0f);

    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);

    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());

    capsule.writeSavableArrayList(joints, "joints", null);
}
 
Example 3
Source File: PhysicsRigidBody.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this body, for example when saving to a J3O file.
 *
 * @param e exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);

    capsule.write(getMass(), "mass", 1.0f);

    capsule.write(getGravity(), "gravity", Vector3f.ZERO);
    capsule.write(isContactResponse(), "contactResponse", true);
    capsule.write(getFriction(), "friction", 0.5f);
    capsule.write(getRestitution(), "restitution", 0);
    Vector3f angularFactor = getAngularFactor(null);
    if (angularFactor.x == angularFactor.y && angularFactor.y == angularFactor.z) {
        capsule.write(getAngularFactor(), "angularFactor", 1);
    } else {
        capsule.write(getAngularFactor(null), "angularFactor", Vector3f.UNIT_XYZ);
        capsule.write(getLinearFactor(), "linearFactor", Vector3f.UNIT_XYZ);
    }
    capsule.write(kinematic, "kinematic", false);

    capsule.write(getLinearDamping(), "linearDamping", 0);
    capsule.write(getAngularDamping(), "angularDamping", 0);
    capsule.write(getLinearSleepingThreshold(), "linearSleepingThreshold", 0.8f);
    capsule.write(getAngularSleepingThreshold(), "angularSleepingThreshold", 1.0f);

    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);

    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());
    capsule.write(getLinearVelocity(), "linearVelocity", null);
    capsule.write(getAngularVelocity(), "angularVelocity", null);

    capsule.writeSavableArrayList(joints, "joints", null);
}
 
Example 4
Source File: Cinematic.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);

    oc.writeSavableArrayList((ArrayList) cinematicEvents, "cinematicEvents", null);
    oc.writeStringSavableMap(cameras, "cameras", null);
    oc.write(timeLine, "timeLine", null);
    oc.write(niftyXmlPath, "niftyXmlPath", null);


}
 
Example 5
Source File: Shader.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void write(JmeExporter ex) throws IOException{
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(language, "language", null);
    oc.writeSavableArrayList(shaderList, "shaderList", null);
    oc.writeIntSavableMap(attribs, "attribs", null);
    oc.writeStringSavableMap(uniforms, "uniforms", null);
}
 
Example 6
Source File: Technique.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(def, "def", null);
    // TODO:
    // oc.write(owner, "owner", null);
    oc.writeSavableArrayList(worldBindUniforms, "worldBindUniforms", null);
    oc.write(defines, "defines", null);
    oc.write(shader, "shader", null);
}
 
Example 7
Source File: PhysicsVehicle.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(tuning.frictionSlip, "frictionSlip", 10.5f);
    capsule.write(tuning.maxSuspensionTravelCm, "maxSuspensionTravelCm", 500f);
    capsule.write(tuning.maxSuspensionForce, "maxSuspensionForce", 6000f);
    capsule.write(tuning.suspensionCompression, "suspensionCompression", 0.83f);
    capsule.write(tuning.suspensionDamping, "suspensionDamping", 0.88f);
    capsule.write(tuning.suspensionStiffness, "suspensionStiffness", 5.88f);
    capsule.writeSavableArrayList(wheels, "wheelsList", new ArrayList<VehicleWheel>());
    super.write(ex);
}
 
Example 8
Source File: ShaderGenerationInfo.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.writeSavableArrayList((ArrayList) attributes, "attributes", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) vertexUniforms, "vertexUniforms", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) varyings, "varyings", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) fragmentUniforms, "fragmentUniforms", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) fragmentGlobals, "fragmentGlobals", new ArrayList<ShaderNodeVariable>());
    oc.write(vertexGlobal, "vertexGlobal", null);
}
 
Example 9
Source File: AssetLinkNode.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    SafeArrayList<Spatial> childs = children;
    children = new SafeArrayList<>(Spatial.class);
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.writeSavableArrayList(assetLoaderKeys, "assetLoaderKeyList", null);
    children = childs;
}
 
Example 10
Source File: ShaderNodeDefinition.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * jme serialization (not used)
 *
 * @param ex the exporter
 * @throws IOException
 */
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(name, "name", "");
    String[] str = new String[shadersLanguage.size()];
    oc.write(shadersLanguage.toArray(str), "shadersLanguage", null);
    oc.write(shadersPath.toArray(str), "shadersPath", null);
    oc.write(type, "type", null);
    oc.writeSavableArrayList((ArrayList) inputs, "inputs", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) outputs, "inputs", new ArrayList<ShaderNodeVariable>());
}
 
Example 11
Source File: AssetLinkNode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    SafeArrayList<Spatial> childs = children;
    children = new SafeArrayList<Spatial>(Spatial.class);
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.writeSavableArrayList(assetLoaderKeys, "assetLoaderKeyList", null);
    children = childs;
}
 
Example 12
Source File: PhysicsRigidBody.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this body, for example when saving to a J3O file.
 *
 * @param e exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);

    capsule.write(getMass(), "mass", 1.0f);

    capsule.write(getGravity(), "gravity", Vector3f.ZERO);
    capsule.write(getFriction(), "friction", 0.5f);
    capsule.write(getRestitution(), "restitution", 0);
    capsule.write(getAngularFactor(), "angularFactor", 1);
    capsule.write(kinematic, "kinematic", false);

    capsule.write(constructionInfo.linearDamping, "linearDamping", 0);
    capsule.write(constructionInfo.angularDamping, "angularDamping", 0);
    capsule.write(constructionInfo.linearSleepingThreshold, "linearSleepingThreshold", 0.8f);
    capsule.write(constructionInfo.angularSleepingThreshold, "angularSleepingThreshold", 1.0f);

    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);

    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());
    capsule.write(getLinearVelocity(), "linearVelocity", null);
    capsule.write(getAngularVelocity(), "angularVelocity", null);

    capsule.writeSavableArrayList(joints, "joints", null);
}
 
Example 13
Source File: LightList.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
        OutputCapsule oc = ex.getCapsule(this);
//        oc.write(owner, "owner", null);

        ArrayList<Light> lights = new ArrayList<Light>();
        for (int i = 0; i < listSize; i++){
            lights.add(list[i]);
        }
        oc.writeSavableArrayList(lights, "lights", null);
    }
 
Example 14
Source File: PhysicsVehicle.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this vehicle, for example when saving to a J3O file.
 *
 * @param ex exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(tuning.frictionSlip, "frictionSlip", 10.5f);
    capsule.write(tuning.maxSuspensionTravelCm, "maxSuspensionTravelCm", 500f);
    capsule.write(tuning.maxSuspensionForce, "maxSuspensionForce", 6000f);
    capsule.write(tuning.suspensionCompression, "suspensionCompression", 0.83f);
    capsule.write(tuning.suspensionDamping, "suspensionDamping", 0.88f);
    capsule.write(tuning.suspensionStiffness, "suspensionStiffness", 5.88f);
    capsule.writeSavableArrayList(wheels, "wheelsList", new ArrayList<VehicleWheel>());
    super.write(ex);
}
 
Example 15
Source File: CompoundCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this shape, for example when saving to a J3O file.
 *
 * @param ex exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.writeSavableArrayList(children, "children", new ArrayList<ChildCollisionShape>());
}
 
Example 16
Source File: KeyFrame.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.writeSavableArrayList((ArrayList) cinematicEvents, "cinematicEvents", null);
    oc.write(index, "index", 0);
}
 
Example 17
Source File: CompoundCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.writeSavableArrayList(children, "children", new ArrayList<ChildCollisionShape>());
}
 
Example 18
Source File: CompoundCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.writeSavableArrayList(children, "children", new ArrayList<ChildCollisionShape>());
}
 
Example 19
Source File: CompoundCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.writeSavableArrayList(children, "children", new ArrayList<ChildCollisionShape>());
}
 
Example 20
Source File: TimeLine.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    ArrayList list = new ArrayList();
    list.addAll(values());
    oc.writeSavableArrayList(list, "keyFrames", null);
}