Search in sources :

Example 16 with FbxElement

use of com.jme3.scene.plugins.fbx.file.FbxElement in project jmonkeyengine by jMonkeyEngine.

the class FbxAnimCurveNode method fromElement.

@Override
public void fromElement(FbxElement element) {
    super.fromElement(element);
    for (FbxElement prop : element.getFbxProperties()) {
        String propName = (String) prop.properties.get(0);
        String propType = (String) prop.properties.get(1);
        if (propType.equals("Number")) {
            float propValue = ((Double) prop.properties.get(4)).floatValue();
            propertyToDefaultMap.put(propName, propValue);
        }
    }
}
Also used : FbxElement(com.jme3.scene.plugins.fbx.file.FbxElement)

Example 17 with FbxElement

use of com.jme3.scene.plugins.fbx.file.FbxElement in project jmonkeyengine by jMonkeyEngine.

the class FbxMaterialProperties method setPropertyFromElement.

public void setPropertyFromElement(FbxElement propertyElement) {
    String name = (String) propertyElement.properties.get(0);
    FBXMaterialProperty prop = propertyMetaMap.get(name);
    if (prop == null) {
        logger.log(Level.WARNING, "Unknown FBX material property ''{0}''", name);
        return;
    }
    // It is either a color, alpha, or factor. 
    // Textures can only be set via setPropertyTexture.
    // If it is an alias, get the real name of the property.
    String realName = prop.name;
    switch(prop.type) {
        case Alpha:
        case Factor:
        case Texture2DOrFactor:
        case Texture2DOrAlpha:
            double value = (Double) propertyElement.properties.get(4);
            propertyValueMap.put(realName, (float) value);
            break;
        case Color:
        case Texture2DOrColor:
            double x = (Double) propertyElement.properties.get(4);
            double y = (Double) propertyElement.properties.get(5);
            double z = (Double) propertyElement.properties.get(6);
            ColorRGBA color = new ColorRGBA((float) x, (float) y, (float) z, 1f);
            propertyValueMap.put(realName, color);
            break;
        default:
            logger.log(Level.WARNING, "FBX material property ''{0}'' requires a texture.", name);
            break;
    }
}
Also used : ColorRGBA(com.jme3.math.ColorRGBA)

Aggregations

FbxElement (com.jme3.scene.plugins.fbx.file.FbxElement)14 FbxFile (com.jme3.scene.plugins.fbx.file.FbxFile)2 FbxId (com.jme3.scene.plugins.fbx.file.FbxId)2 FbxObject (com.jme3.scene.plugins.fbx.obj.FbxObject)2 FbxObject (com.jme3.scene.plugins.fbx.objects.FbxObject)2 ColorRGBA (com.jme3.math.ColorRGBA)1 Matrix4f (com.jme3.math.Matrix4f)1 Quaternion (com.jme3.math.Quaternion)1 Vector3f (com.jme3.math.Vector3f)1 CullHint (com.jme3.scene.Spatial.CullHint)1 FbxMesh (com.jme3.scene.plugins.fbx.mesh.FbxMesh)1 FbxGlobalSettings (com.jme3.scene.plugins.fbx.misc.FbxGlobalSettings)1 FbxAnimCurve (com.jme3.scene.plugins.fbx.objects.FbxAnimCurve)1 FbxAnimNode (com.jme3.scene.plugins.fbx.objects.FbxAnimNode)1 FbxBindPose (com.jme3.scene.plugins.fbx.objects.FbxBindPose)1 FbxCluster (com.jme3.scene.plugins.fbx.objects.FbxCluster)1 FbxImage (com.jme3.scene.plugins.fbx.objects.FbxImage)1 FbxMaterial (com.jme3.scene.plugins.fbx.objects.FbxMaterial)1 FbxMesh (com.jme3.scene.plugins.fbx.objects.FbxMesh)1 FbxNode (com.jme3.scene.plugins.fbx.objects.FbxNode)1