Package com.jme3.scene.plugins.blender.objects

Examples of com.jme3.scene.plugins.blender.objects.ObjectHelper.toObject()


                    Pointer pCurveOb = (Pointer) modifierStructure.getFieldValue("curve_ob");
                    float length = 0;
                    if (pCurveOb.isNotNull()) {
                        Structure curveStructure = pCurveOb.fetchData().get(0);
                        ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
                        Node curveObject = (Node) objectHelper.toObject(curveStructure, blenderContext);
                        Set<Number> referencesToCurveLengths = new HashSet<Number>(curveObject.getChildren().size());
                        for (Spatial spatial : curveObject.getChildren()) {
                            if (spatial instanceof Geometry) {
                                Mesh mesh = ((Geometry) spatial).getMesh();
                                if (mesh instanceof Curve) {
View Full Code Here


                    } else {
                        FileBlockHeader capBlock = blenderContext.getFileBlock(pOffsetObject.getOldMemoryAddress());
                        try {// we take the structure in case the object was not yet loaded
                            Structure capStructure = capBlock.getStructure(blenderContext);
                            ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
                            caps[i] = (Node) objectHelper.toObject(capStructure, blenderContext);
                            if (caps[i] == null) {
                                LOGGER.log(Level.WARNING, "Cap object ''{0}'' couldn''t be loaded!", capStructure.getName());
                            }
                        } catch (BlenderFileException e) {
                            LOGGER.log(Level.WARNING, "Problems in blender file structure! Cap object cannot be applied! The problem: {0}", e.getMessage());
View Full Code Here

            if (pMirrorObject.isNotNull()) {
                Structure objectStructure;
                try {
                    objectStructure = pMirrorObject.fetchData().get(0);
                    ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
                    Node object = (Node) objectHelper.toObject(objectStructure, blenderContext);
                    if (object != null) {
                        // compute the mirror object coordinates in node's local space
                        mirrorPlaneCenter = this.getWorldMatrix(node).invertLocal().mult(object.getWorldTranslation());
                    }
                } catch (BlenderFileException e) {
View Full Code Here

           
            for (FileBlockHeader block : blocks) {
                switch (block.getCode()) {
                    case FileBlockHeader.BLOCK_OB00:// Object
                        ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
                        Object object = objectHelper.toObject(block.getStructure(blenderContext), blenderContext);
                        if (object instanceof LightNode) {
                            loadingResults.addLight((LightNode) object);
                        } else if (object instanceof CameraNode) {
                            loadingResults.addCamera((CameraNode) object);
                        } else if (object instanceof Node) {
View Full Code Here

            for (Structure b : base) {
                Pointer pObject = (Pointer) b.getFieldValue("object");
                if (pObject.isNotNull()) {
                    Structure objectStructure = pObject.fetchData().get(0);

                    Object object = objectHelper.toObject(objectStructure, blenderContext);
                    if (object instanceof LightNode) {
                        result.addLight(((LightNode) object).getLight());
                        result.attachChild((LightNode) object);
                    } else if (object instanceof Node) {
                        if (LOGGER.isLoggable(Level.FINE)) {
View Full Code Here

            BlenderKey blenderKey = blenderContext.getBlenderKey();
            List<Node> rootObjects = new ArrayList<Node>();
            for (FileBlockHeader block : blocks) {
                if (block.getCode() == FileBlockHeader.BLOCK_OB00) {
                    ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
                    Object object = objectHelper.toObject(block.getStructure(blenderContext), blenderContext);
                    if (object instanceof LightNode && (blenderKey.getFeaturesToLoad() & FeaturesToLoad.LIGHTS) != 0) {
                        rootObjects.add((LightNode) object);
                    } else if (object instanceof Node && (blenderKey.getFeaturesToLoad() & FeaturesToLoad.OBJECTS) != 0) {
                        LOGGER.log(Level.FINE, "{0}: {1}--> {2}", new Object[] { ((Node) object).getName(), ((Node) object).getLocalTranslation().toString(), ((Node) object).getParent() == null ? "null" : ((Node) object).getParent().getName() });
                        if (((Node) object).getParent() == null) {
View Full Code Here

        if(blenderContext.getBlenderKey().isFixUpAxis()) {
            // then make sure it is rotated in a proper way to fit the jme bone transformation conventions
            globalBoneMatrix.multLocal(BONE_ARMATURE_TRANSFORMATION_MATRIX);
        }

        Spatial armature = (Spatial) objectHelper.toObject(blenderContext.getFileBlock(armatureObjectOMA).getStructure(blenderContext), blenderContext);
        ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
        Matrix4f armatureWorldMatrix = constraintHelper.toMatrix(armature.getWorldTransform(), new Matrix4f());

        // and now compute the final bone matrix in world space
        globalBoneMatrix = armatureWorldMatrix.mult(globalBoneMatrix);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.