EamonnMR

Loading bones asynchronously [solved]

Recommended Posts

I'm using addMeshTask to load my models, and I'd like to start loading bones from them as well. Is there a similar function for loading bones asynchronously? (The documentation seems silent on this point.)

Share this post


Link to post
Share on other sites

They don't need to be separate from the model, so I just put them in an armature in blender alongside the mesh itself. Will these load when I load the model then? They don't seem to show up in

task.loadedSkeletons

but they also don't show up in

task.loadedMeshes[0].skeleton

or

task.loadedMeshes[0].subMeshes[0].skeleton

I guess I can't tell if I've made the mesh wrong (which is no big deal, I really just wanna get the workflow down) or if I'm trying to load it wrong.

2018-08-13-085058_1366x768_scrot.png

Share this post


Link to post
Share on other sites

The first thing to check is the exporter.log file.  If an armature was exported, it will list it.  Next thing to check is that the mesh it is wanted for has skeleton weights & indices exported.

Checking at run time, as you are doing, gives the final verdict, but checking your upstream workflow is wise.

Share this post


Link to post
Share on other sites

So according to the exporter it processed a skeleton with two bones. It should be noted that the armature/skeleton isn't really associated with the mesh in any way in blender since I really just want the bones to attach further models to at this stage. If it matters, I'm still on 3.1.1 (but I suppose I'll upgrade bones weren't implemented back then or some such.)

Full log file:

Exporter version: 5.6.3, Blender version: 2.79 (sub 0)
========= Conversion from Blender to Babylon.js =========
	Scene settings used :
		export scope        :  ALL
		inline textures     :  false
		Positions Precision :  4
		Normals Precision   :  3
		UVs Precision       :  3
		Vert Color Precision:  3
		Mat Weight Precision:  2
		texture directory   :  /home/eamonn/Flythrough.Space/assets/
	Python World class constructor completed
	processing begun of skeleton:  Armature, id:  0
		processing begun of bone:  Bone, index:  0
		processing begun of bone:  Bone.001, index:  1
	processing begun of mesh:  Cube
		processing begun of Standard material:  Material
		num positions      :  110
		num normals        :  110
		num uvs            :  0
		num uvs2           :  0
		num colors         :  0
		num indices        :  636
	processing begun of camera (UniversalCamera):  Camera
	processing begun of light (POINT):  Lamp
========= Writing of scene file started =========
========= Writing of scene file completed =========
========= end of processing =========
elapsed time:  0 min, 0.0337 secs

Share this post


Link to post
Share on other sites

If you wish to get the bones loaded, they have to be attached to a mesh in the JSON file, per what @Deltakoshsaid above.  Then you have to load this shame mesh.  You might either export it as not visible, or even better, disabled for the custom export properties.

If you are just going to throw this mesh away, make it a plane with 2 faces.  Your cube is wasting 209 faces (636 / 3).

Share this post


Link to post
Share on other sites

So I guess I should clarify, the bones should belong to the mesh, I was just indicating that if I need to start the mesh or bones over from scratch that would be fine. Here's the exported json (you'll notice that the skeleton is in there.)

{"producer":{"name":"Blender","version":"2.79 (sub 0)","exporter_version":"5.6.3","file":"casamance_fighter_backswept.babylon"},
"autoClear":true,"clearColor":[0.0509,0.0509,0.0509],"ambientColor":[0,0,0],"gravity":[0,-9.81,0],
"materials":[{"name":"casamance_fighter_backswept.Material","id":"casamance_fighter_backswept.Material","ambient":[0.8,0.8,0.8],"diffuse":[0.64,0.64,0.64],"specular":[0.5,0.5,0.5],"emissive":[0,0,0],"specularPower":50,"alpha":1,"backFaceCulling":true,"checkReadyOnlyOnce":false,"maxSimultaneousLights":4}],
"multiMaterials":[],
"skeletons":[{"name":"Armature","id":0,"dimensionsAtRest":[0,2.5875,4.6049],"bones":[
{"name":"Bone","index":0,"matrix":[1,0,0,0,0,0.9989,0.0477,0,0,0.0477,-0.9989,0,-2.6517,-1.7937,-2.3025,1],"rest":[1,0,0,0,0,0.9989,0.0477,0,0,0.0477,-0.9989,0,-2.6517,-1.7937,-2.3025,1],"parentBoneIndex":-1,"length":2.5904},
{"name":"Bone.001","index":1,"matrix":[1,0,0,0,0,0.9989,-0.0477,0,0,-0.0477,-0.9989,0,-2.6517,-1.7937,2.3025,1],"rest":[1,0,0,0,0,0.9989,-0.0477,0,0,-0.0477,-0.9989,0,-2.6517,-1.7937,2.3025,1],"parentBoneIndex":-1,"length":2.5904}]}],
"meshes":[{"name":"Cube","id":"Cube","materialId":"casamance_fighter_backswept.Material","billboardMode":0,"position":[0,0,0],"rotation":[0,0,0],"scaling":[1,1,1],"isVisible":true,"freezeWorldMatrix":false,"isEnabled":true,"checkCollisions":false,"receiveShadows":false,"pickable":true,"tags":""
,"positions":[2.4708,-1,-0.3458,-2.9477,-0.8308,0,2.5552,-0.9302,0,2.2696,0.2966,0,-2.5599,-0.0548,-1,2.8815,-0.0548,-1,-2.6553,-0.7523,-1,-2.1431,-0.3225,-1.3821,-3.2548,-0.4747,-0.7901,-3.2548,-0.5801,-0.7901,2.3439,-0.3225,-1.3543,-1.6869,-0.5284,-1.603,1.8877,-0.5284,-1.603,2.3439,-0.7324,-1.0728,-2.1431,-0.7324,-1.5161,-1.9135,-0.8585,-1.6409,-1.7006,-0.8314,-1.6669
,-1.164,-0.1334,-1.1771,-1.6869,-0.5834,-1.603,-1.0798,-0.5284,-2.4392,1.8877,-0.5834,-1.603,-1.7577,-0.6945,-1.5499,1.1926,-0.5834,-2.4392,0.5974,-0.5772,-4.4953,-1.0798,-0.5834,-2.4392,1.1926,-0.5284,-2.4392,-5.2021,-0.4747,-0.7901,-3.8456,-0.2775,-0.3193,-3.1351,0.0082,-0.2986,-3.2548,-0.197,-0.3233,-4.3207,-0.9564,0,-5.2021,-0.5801,-0.7901,-5.4352,-0.2778,0,-5.4352,-0.7859,0
,1.4309,-0.5223,-4.4953,1.4309,-0.5772,-4.4953,0.5974,-0.5223,-4.4953,1.3649,-0.1334,-1.1771,2.5532,1.0726,-0.5238,1.0265,-0.1749,-1.2329,-0.8256,-0.1749,-1.2329,2.8916,1.1141,-0.4679,1.5637,1.0726,-0.5238,1.2252,1.1141,-0.4679,0.683,-0.8314,-1.6669,-1.5428,-1.9438,-2.3577,0.896,-0.8585,-1.6409,-3.2309,-1.9167,-2.3837,-3.4438,-1.9438,-2.3577,-1.7557,-1.9167,-2.3837,-3.1137,0.0031,-0.3564
,-2.9448,0.0465,-0.3233,-2.9448,0.2387,0,-3.2548,-0.0048,0,-3.4237,-0.2404,-0.3564,-3.7863,0.1208,0,-4.0963,-0.1228,0,-3.5356,-0.034,-0.3193,-1.7095,-0.7324,-1.6975,2.4708,-1,0.3458,-2.5599,-0.0548,1,-2.8543,0.2966,0,-2.1431,-0.3225,1.3821,-2.6553,-0.7523,1,-3.2548,-0.4747,0.7901,2.3439,-0.3225,1.3543,-1.6869,-0.5284,1.603,2.3439,-0.7324,1.0728
,2.8815,-0.0548,1,-2.1431,-0.7324,1.5161,-1.9135,-0.8585,1.6409,-1.164,-0.1334,1.1771,-1.0798,-0.5284,2.4392,-1.6869,-0.5834,1.603,1.8877,-0.5834,1.603,-1.7577,-0.6945,1.5499,0.5974,-0.5772,4.4953,1.1926,-0.5834,2.4392,-1.0798,-0.5834,2.4392,1.1926,-0.5284,2.4392,1.8877,-0.5284,1.603,-3.8456,-0.2775,0.3193,-3.4237,-0.2404,0.3564,-3.1351,0.0082,0.2986,-3.1465,0.0881,0
,-3.2548,-0.5801,0.7901,-5.2021,-0.5801,0.7901,-5.2021,-0.4747,0.7901,1.4309,-0.5223,4.4953,1.4309,-0.5772,4.4953,0.5974,-0.5223,4.4953,2.5532,1.0726,0.5238,1.3649,-0.1334,1.1771,1.0265,-0.1749,1.2329,2.8916,1.1141,0.4679,1.5637,1.0726,0.5238,1.2252,1.1141,0.4679,-0.8256,-0.1749,1.2329,-1.5428,-1.9438,2.3577,0.683,-0.8314,1.6669,0.896,-0.8585,1.6409,-1.7006,-0.8314,1.6669
,-1.7095,-0.7324,1.6975,-3.2309,-1.9167,2.3837,-3.4438,-1.9438,2.3577,-1.7557,-1.9167,2.3837,-3.1137,0.0031,0.3564,-3.5356,-0.034,0.3193,-2.9448,0.0465,0.3233,-3.2548,-0.197,0.3233]
,"normals":[0.62,-0.784,-0.015,-0.052,-0.999,0,0.859,-0.512,0,0.472,0.881,0,-0.332,0.667,-0.668,0.857,0.388,-0.339,-0.406,-0.7,-0.588,-0.337,0.525,-0.782,-0.294,0.415,-0.861,-0.181,-0.585,-0.79,0.439,0.218,-0.872,-0.301,0.534,-0.79,0.383,0.505,-0.774,0.491,-0.72,-0.491,-0.556,-0.056,-0.829,-0.51,-0.435,-0.742,-0.172,0.354,-0.919
,-0.015,0.847,-0.531,-0.399,-0.015,-0.917,-0.566,0.701,-0.435,0.433,-0.668,-0.606,-0.427,0.129,-0.895,0.565,-0.807,-0.169,-0.336,-0.621,-0.708,-0.565,-0.701,-0.435,0.566,0.807,-0.167,-0.503,0.473,-0.723,-0.16,0.802,-0.576,-0.551,0.737,-0.392,-0.142,0.116,-0.983,-0.017,-1,0,-0.506,-0.461,-0.729,-0.749,0.663,0,-0.758,-0.653,0
,0.613,0.572,-0.545,0.613,-0.571,-0.547,-0.336,0.623,-0.706,0.055,0.807,-0.588,0.043,0.618,-0.785,0.013,0.582,-0.813,-0.025,0.65,-0.76,0.95,0.256,0.178,-0.007,0.662,-0.749,-0.412,0.761,0.502,0.098,0.751,-0.653,0.392,-0.845,-0.363,0.682,-0.024,-0.731,-0.096,0.013,-0.995,-0.967,-0.24,-0.088,0.017,-0.089,-0.996,0.067,0.334,-0.94
,0.863,0.079,-0.498,0.8,0.6,0,0.618,-0.786,0,-0.096,0.551,-0.829,-0.445,0.896,0,-0.234,0.972,0,-0.205,0.542,-0.815,-0.485,0.095,-0.869,0.62,-0.784,0.015,-0.332,0.667,0.668,-0.288,0.958,0,-0.337,0.525,0.782,-0.406,-0.7,0.588,-0.294,0.415,0.861,0.439,0.218,0.872,-0.301,0.534,0.79,0.491,-0.72,0.491
,0.857,0.388,0.339,-0.556,-0.056,0.829,-0.51,-0.435,0.742,-0.015,0.847,0.531,-0.566,0.701,0.435,-0.399,-0.015,0.917,0.433,-0.668,0.606,-0.427,0.129,0.895,-0.336,-0.621,0.708,0.565,-0.807,0.169,-0.565,-0.701,0.435,0.566,0.807,0.167,0.383,0.505,0.774,-0.16,0.802,0.576,-0.096,0.551,0.829,-0.551,0.737,0.392,-0.581,0.814,0
,-0.181,-0.585,0.79,-0.506,-0.461,0.729,-0.503,0.473,0.723,0.613,0.572,0.545,0.613,-0.571,0.547,-0.336,0.623,0.706,0.043,0.618,0.785,0.055,0.807,0.588,0.013,0.582,0.813,0.95,0.256,-0.178,-0.007,0.662,0.749,-0.412,0.761,-0.502,-0.025,0.65,0.76,0.392,-0.845,0.363,0.098,0.751,0.653,0.682,-0.024,0.731,-0.172,0.354,0.919
,-0.485,0.095,0.869,-0.096,0.013,0.995,-0.967,-0.24,0.088,0.017,-0.089,0.996,0.067,0.334,0.94,-0.205,0.542,0.815,0.863,0.079,0.498,-0.142,0.116,0.983]
,"indices":[0,1,2,3,4,5,3,0,2,6,7,4,6,8,9,10,11,12,5,13,0,14,15,16,7,17,4,18,19,11,10,20,13,14,11,7,14,21,18,22,23,24,18,22,24,11,25,12,12,22
,20,26,8,27,28,29,8,1,9,30,31,32,33,8,31,9,30,31,33,34,23,35,25,36,34,25,35,22,19,23,36,37,38,39,7,39,40,10,37,39,4,37,5,41,42,38,39,42,40,40
,43,17,37,43,41,44,45,46,6,46,15,13,16,44,0,44,46,45,47,48,16,49,44,15,47,16,15,45,48,50,51,52,53,51,29,29,50,54,27,55,56,54,57,27,18,13,20,58,18,21
,16,21,14,1,59,2,3,60,61,59,3,2,62,63,60,63,64,60,65,66,62,67,68,59,69,70,63,71,62,60,72,73,66,74,65,67,66,69,62,69,73,75,76,77,78,73,77,74,79,66
,80,77,80,74,64,81,82,83,84,61,1,85,63,86,32,87,86,64,85,30,86,85,76,88,89,79,90,72,89,79,77,72,76,78,91,92,93,62,93,65,65,92,68,92,60,68,94,95,96,95
,93,97,96,97,71,92,96,71,98,99,100,63,100,59,67,101,102,59,99,67,103,98,104,105,101,99,103,70,101,70,98,100,52,106,107,108,53,109,106,109,82,55,81,56,107,82,81,73,67,102
,102,75,73,101,75,102,0,6,1,3,61,4,3,5,0,6,14,7,6,4,8,10,7,11,5,10,13,14,6,15,7,40,17,18,24,19,10,12,20,14,18,11,22,35,23,18,20,22,11,19
,25,12,25,22,8,29,54,27,56,26,56,32,26,8,54,27,8,4,28,4,61,28,61,84,28,1,6,9,31,26,32,8,26,31,30,9,31,34,36,23,25,19,36,25,34,35,19,24,23,37
,41,38,7,10,39,10,5,37,4,17,37,41,43,42,39,38,42,40,42,43,37,17,43,44,49,45,6,0,46,13,58,16,0,13,44,45,49,47,16,47,49,15,48,47,15,46,45,52,55,57
,57,50,52,53,52,51,29,51,50,27,57,55,54,50,57,18,58,13,16,58,21,1,63,59,3,68,60,59,68,3,62,69,63,63,85,64,65,80,66,67,65,68,69,101,70,71,97,62,72,78
,73,74,80,65,66,73,69,76,89,77,73,78,77,79,72,66,77,79,80,64,87,81,87,32,56,81,87,56,82,109,64,61,60,83,60,64,83,64,109,83,1,30,85,86,33,32,86,87,64,30
,33,86,76,90,88,79,88,90,89,88,79,72,90,76,91,94,92,62,97,93,65,93,92,92,71,60,94,91,95,95,91,93,96,95,97,92,94,96,98,105,99,63,70,100,67,99,101,59,100,99
,103,105,98,105,103,101,103,104,70,70,104,98,107,55,52,52,108,106,108,52,53,106,108,109,55,107,81,107,106,82,73,74,67,101,69,75]
,"subMeshes":[{"materialIndex":0,"verticesStart":0,"verticesCount":110,"indexStart":0,"indexCount":636}]
,"instances":[]}
],
"morphTargetManagers":[],
"cameras":[{"name":"Camera","id":"Camera","position":[7.4811,5.3437,-6.5076],"rotation":[0.4615,-0.8149,0.0108],"fov":0.8576,"minZ":0.1,"maxZ":100,"speed":1,"inertia":0.9,"checkCollisions":false,"applyGravity":false,"ellipsoid":[0.2,0.9,0.2],"cameraRigMode":0,"interaxial_distance":0.0637,"type":"UniversalCamera"}],"activeCamera":"Camera",
"lights":[{"name":"Lamp","id":"Lamp","type":0,"position":[4.0762,5.9039,1.0055],"intensity":1,"diffuse":[1,1,1],"specular":[1,1,1]}],
"shadowGenerators":[]

 

Is there something I need to do in Blender to make the armature belong to the mesh so that it gets imported properly? I tried the obvious (ie dragging the node onto the other node so that the cube object is the parent object.

 

 

2018-08-15-182659_1366x768_scrot.png

Share this post


Link to post
Share on other sites

Not sure dragging is obvious.  You need to parent the mesh to the armature.  right-click select mesh, shift right-clickselect armature, then cntrl P.  Pick 'with automatic weights'.  This is a general Blender question.  Not the best forum for that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.