Export of simple blender material failing

good day, on a simple cube I have a simple material that just uses a gradient applying it depending on the vertical coordinate of the object, and it fails like this, thank you for your help , I use latest blender version 2.91, and latest babylon versions as well:

I have the simple .blend file available (im not allowed to upload because im a new user :slight_smile: )

========= Conversion from Blender to Babylon.js =========
Scene settings used :
Inline textures : false
Material Type : PBR
Positions Precision : 4
Normals Precision : 3
UVs Precision : 3
Vert Color Precision: 3
Mat Weight Precision: 2
Keep Z-up r-handed : no
Texture directory : C:\MEDIA
Python World class constructor completed
processing begun of mesh: dbmassive2.0000
processing begun of material: Material
WARNING: unsupported node type(ShaderNodeSeparateXYZ) will trigger baking
WARNING: unsupported node type(ShaderNodeMath) will trigger baking
WARNING: unsupported node type(ShaderNodeValToRGB) will trigger baking
usePassDirectHold False
========= An error was encountered =========
========= end of processing =========
elapsed time: 0 min, 0.01 secs
Python: Traceback (most recent call last):
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js_init_.py”, line 65, in execute
exporter.execute(context, self.filepath)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\json_exporter.py”, line 115, in execute
mesh = Mesh(object, scene, self)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\mesh.py”, line 146, in init
recipe = BakingRecipe(bpyMesh, exporter)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\materials\baking_recipe.py”, line 105, in init
self.bakedMaterial.bake(bpyMesh, self)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\materials\material.py”, line 127, in bake
bpy.ops.object.mode_set(mode=‘EDIT’)
File “C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\modules\bpy\ops.py”, line 132, in call
ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.object.mode_set.poll() failed, context is incorrect

location: :-1

I found the reason, I had to make visible everything in the scene,
now it exported well,
thank you :slight_smile:

actually that worked, but when trying the same now with my final model, which is more complex, it fails with this error, thank you for your help:

========= Conversion from Blender to Babylon.js =========
Scene settings used :
Inline textures : false
Material Type : PBR
Positions Precision : 4
Normals Precision : 3
UVs Precision : 3
Vert Color Precision: 3
Mat Weight Precision: 2
Keep Z-up r-handed : no
Texture directory : C:\repos\webgl1\public\models\m2
Python World class constructor completed
processing begun of mesh: dbmassive2.0000
processing begun of material: Material
WARNING: unsupported node type(ShaderNodeSeparateXYZ) will trigger baking
WARNING: unsupported node type(ShaderNodeMath) will trigger baking
WARNING: unsupported node type(ShaderNodeValToRGB) will trigger baking
usePassDirectHold False
========= An error was encountered =========
========= end of processing =========
elapsed time: 0 min, 0.3453 secs
Python: Traceback (most recent call last):
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js_ init _.py”, line 65, in execute
exporter.execute(context, self.filepath)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\json_exporter.py”, line 115, in execute
mesh = Mesh(object, scene, self)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\mesh.py”, line 146, in init
recipe = BakingRecipe(bpyMesh, exporter)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\materials\baking_recipe.py”, line 105, in init
self.bakedMaterial.bake(bpyMesh, self)
File “C:\Users\Usuario\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\babylon_js\materials\material.py”, line 139, in bake
bpy.ops.uv.smart_project(angle_limit = 66.0, island_margin = 0.0, user_area_weight = 1.0, use_aspect = True, stretch_to_bounds = True)
File “C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\modules\bpy\ops.py”, line 132, in call
ret = _op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: : keyword “user_area_weight” unrecognized

location: :-1

seems to be related to this issue:

any suggestions to fix it?
thank you
(im also curious why it doesnt happen with a basic cube, but yes with a more complex model)

"The smart_project in Blender 2.83 has the parameter named as user_area_weight.

The parameter has been switched to area_weight in smart_project in Blender 2.91

I think the renaming is causing this issue. Reporting it here so that it can be looked into while porting the exporter for Blender 2.9x"

Maybe @JCPalmer will know as he is the creator of the Blender exporter.

thank you , I wait then for @JCPalmer opinion :slight_smile:

With this new 4 releases a year of Blender process, where the last is an LTS, I am considering the first 3 to be betas. I do not have the time to modify just to keep up with API changes 4 times a year. Also, if I did, I would either have to put in checks to do things multiple ways to support the LTS, or make a separate branch in the repo, so people would not have to be forced to use unstable versions of Blender.

Unlike, GLB which is released bundled inside Blender, and probably a paid gig by Khronos, they can get away with having multiple versions, AND appearing as if there is only one.

My plan is to look at this with the release of the 2.92 beta in its own repo branch. At that time, I am thinking of retroactively changing all the release numbers in the repo to match what version they go with. Incremental changes after release, would have minor-est version number changes, regardless of whether functionality changed or not, the prior scheme.

The next exporter version, for Blender 2.92, would be named 2.93.-1 A negative number would get the word beta added to the custom property section labels. When Blender 2.93 comes out:

  • The branch would get merged into main,
  • The initial release number of the exporter would be 2.93.0
  • The version for 2.83, would get moved to the deprecated directory.

Hope this clarifies.

1 Like

thank you very much @JCPalmer,
what i did in the end is to install Blender 2.82 and it works all well with blender 2.82,
so for now i will use an older blender version to export to babylon i guess
thank you