Jump to content

Problem imported mesh from Blender v2.71 since update Babylon.js v1.9 to v1.12!


Zino54220
 Share

Recommended Posts

Hi Gentlement!

 

I have a big problem since I updated Babylon.js v1.9 to v1.12...

 

When I Imported a mesh now, I get this in debuger :

 

post-6162-0-68017700-1406232451.gif

 

I replace all files of the old exporter by the exporter  v0.99 in Blender "script" -> "addons" file and remade the mesh export but nothing...

 

What's the ..... !!!  :wacko: 

 

Should I make a special handling with Blender ???

 

Help please!!!

 

Zino

Link to comment
Share on other sites

The signature of setVerticesData has changed
 
Bad < 1.11
xxx.setVerticesData(positions, BABYLON.VertexBuffer.PositionKind, true);xxx.setVerticesData(normals, BABYLON.VertexBuffer.NormalKind, true);

 

OK 1.11 and +

xxx.setVerticesData(BABYLON.VertexBuffer.PositionKind, positions, true);xxx.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, true);
Link to comment
Share on other sites

Actually,  it is really 1.12 where it changed, just like the warning says.  Also, that is just a warning, 1.12 & 1.13 switch the order internally, if found the old way.

 

Just to also clear up, that v 0.99 refers to the version of Tower of Babel.  There are 2 Blender exporters in Git right now.  You would have also had to gone into Blender preferences, and turned it on to use TOB.

 

The thing is I am not sure you have a final 1.12 version, because a .babylon DOES not even understand what parameter order is.  That is babylonFileLoader.js problem.  I am pretty sure the order was switched in that module, before 1.12 went final.

Link to comment
Share on other sites

Thanks for your answers...

 

So I had the exporter Tower of Babel in Blender and when I exporte my mesh I have many files (.babylon, .js, .log, .ts and .png).

 

But always the same result in my scene with the same messages in debug...

 

It's always the file .babylon to put in the BABYLON.SceneLoader.ImportMesh(...) function ??

Link to comment
Share on other sites

Yes, the .babylon is always used for Sceneloader.  The .js & .ts are for inline code, which does not need the loader.  Both require 1.13.   You only need  1, but all 3 are generated. 

 

If you looked at the babylon.js you are using do you see this in line 1?

/*! Babylon 2014-06-24 */

If not, you need to get the final 1.12.  I suspect you do, because I just double checked the git history for babylon.babylonFileLoader.js which is called by SceneLoader.  There is a commit on 06-24, and the arguments are specified (kind, data, updateable).  Those warnings should not happen.  This still may not fix, but getting a known build to be final is pretty important.

Link to comment
Share on other sites

Yes I Have.

 

Thanks to you, I don't have BJS signature warning anymore...

 

But I always haven't my mesh and the [WebGLRenderinContext]GL_ERROR... is still here whereas it wasn't before with the precent version...

 

I'm very sad

:(  :(

Link to comment
Share on other sites

So I have news....

 

The problem is not the SceneLoader.ImporteMesh(...) but a function which link the mesh with a skeleton that I get in this forum...

 

Here this function :

// Monte un objet 3d (mesh) sur un squelette (skeleton)function monterObjSurSkel(obj,ske,boneName){    var matricesWeights = new Array();    var floatIndices = new Array();    var boneIndice = -1;                        for (var i = 0; i < ske.bones.length; i++) {        if (ske.bones[i].name == boneName) {            boneIndice=i;            break;        }    }    if (boneIndice == -1) {return;}                        for (var ii = 0; ii < obj._totalVertices; ii++) {        matricesWeights[ii*4+0] = 1.0;        matricesWeights[ii*4+1] = 0.0;        matricesWeights[ii*4+2] = 0.0;        matricesWeights[ii*4+3] = 0.0;        floatIndices[ii*4+0] = boneIndice;        floatIndices[ii*4+1] = boneIndice;        floatIndices[ii*4+2] = boneIndice;        floatIndices[ii*4+3] = boneIndice;    }                        obj.skeleton = ske;    obj.setVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind, matricesWeights, false);    obj.setVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind, floatIndices,  false);}

Thanks to Dad72, I corrected the setVerticesData warnings... Before the 1.12 version, the two last code's lines were :

obj.setVerticesData(matricesWeights, BABYLON.VertexBuffer.MatricesWeightsKind, false);obj.setVerticesData(floatIndices, BABYLON.VertexBuffer.MatricesIndicesKind, false);

I don't see where is the problem in this function....

Link to comment
Share on other sites

I use this same function with the same code and I have no problem.

 

I think that the problem is that assign you in the signature of function (obj, ske, boneName) Display also your code SceneLoader.ImportMesh(...)

Link to comment
Share on other sites

Here my code of mesh's import :

var nomBlenderPiece = tabParamsPiece[i].NomBlender;                var chemVersFichierPiece = tabParamsPiece[i].ChemVersFichier;                var nomFichierPiece = tabParamsPiece[i].NomFichier;                var piece;                var nomOs = tabParamsPiece[i].NomOs;                                var pos = tabMeshImportes.indexOf(nomBlenderPiece);                if(pos == -1)                {                                        var skelAtelier = scene.getMeshByID(nameLastSkelAtelier);                            if(skelAtelier != null)                    {                                                // Import the mesh                        BABYLON.SceneLoader.ImportMesh(nomBlenderPiece, "../../" + chemVersFichierPiece, nomFichierPiece, scene,                         function (newMeshes) {                            piece = setupMeshWithPosFix(piece,newMeshes,posXSkel, posYSkel+3.5, posZSkel-2.0);                            piece.name = nomBlenderPiece;                            monterObjSurSkel(newMeshes[0], skelAtelier.skeleton, nomOs);                        });                        tabMeshImportes.push(nomBlenderPiece);                    }                                    }

This code was good before...

 

 

Thanks you very much Dad72 for your help  :)

Link to comment
Share on other sites

This should better work  ;)

 

BABYLON.SceneLoader.ImportMesh(nomBlenderPiece, "../../" + chemVersFichierPiece, nomFichierPiece, scene, function (newMeshes, particleSystems, skeletons) {

 

piece = setupMeshWithPosFix(piece,newMeshes,posXSkel, posYSkel+3.5, posZSkel-2.0);

piece.name = nomBlenderPiece;

monterObjSurSkel(newMeshes[0], skeletons[0], nomOs);

 

});

Link to comment
Share on other sites

Yes it's work but my mesh is not link to the skeleton and it's normal because I want that the mesh be link to skelAtelier and the mesh hasn't a skeleton so is useless to put "skeleton" in parameter no ??

 

Why when I use skelAtelier.skeleton that's doesn't work ??

 

In debug, the parameter "skeleton" of skelAtelier looks correct....

 

PS :

 

Is not skeleton[0] in your example Dad72 ???

Link to comment
Share on other sites

yes skeleton[0] (désoler j'ai oublier le 0: j'ai corriger le post)
 
and

monterObjSurSkel(skelAtelier, skeleton[0], nomOs);

Vous voulez attacher "skelAtelier" sur le squelette "skeleton[0]ayant le nom de l'os "nomOs".

 

It'll work like this

Link to comment
Share on other sites

Yes, with this code my mesh appears but it 's not link to the good skeleton...

 

SkelAtelier is a mesh with a skeleton and I want link the newMesh with the skeleton of skelAtelier.

 

This code worked with the Babylon.1.9...

Link to comment
Share on other sites

Indeed, there is of the above changes, because at mee this works does more evenly.
This has be replace by something else.
 
yes :
 
getTotalVertices() for 1.12
 
remplace obj._totalVertices par obj.getTotalVertices()

Link to comment
Share on other sites

Yeah !!

 

Well done Dad72!

 

:)

 

this function is good for me :

// Monte un objet "obj", sur un squelette "ske" selon l'os "bone"function monterObjSurSkel(obj,ske,boneName){    var matricesWeights = new Array();    var floatIndices = new Array();    var boneIndice = -1;                        for (var i = 0; i < ske.bones.length; i++) {        if (ske.bones[i].name == boneName) {            boneIndice=i;            break;        }    }    if (boneIndice == -1) {return;}                        for (var ii = 0; ii < obj.getTotalVertices(); ii++) {        matricesWeights[ii*4+0] = 1.0;        matricesWeights[ii*4+1] = 0.0;        matricesWeights[ii*4+2] = 0.0;        matricesWeights[ii*4+3] = 0.0;        floatIndices[ii*4+0] = boneIndice;        floatIndices[ii*4+1] = boneIndice;        floatIndices[ii*4+2] = boneIndice;        floatIndices[ii*4+3] = boneIndice;    }                        obj.skeleton = ske;    obj.setVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind, matricesWeights, false);    obj.setVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind, floatIndices,  false);}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...