babylonjs / blenderexporter Goto Github PK
View Code? Open in Web Editor NEWExports From Blender to Babylon.JS in JSON / .babylon format
License: Apache License 2.0
Exports From Blender to Babylon.JS in JSON / .babylon format
License: Apache License 2.0
I'm trying to download the deprecated/Blender2Babylon-5.6.zip
I have tried downloading directly from github and also tried cloning the repository and unzipping manually. I am on OSX and get an error that the unzip fails. The file size is listed as 38.5 KB which seems suspiciously small when compared to the current plugin and the older io_export_babylon.py
Blender Custom Properties allow for adding arbitrary properties to meshes other nodes, including things like cameras and lights.
When you export a model from Blender to GLTF, it puts any added custom properties into the GLTF "extras", which when imported into babylon gets added to the node's metadata under the gltf.extras
key. It would be nice to have a similar option with this exporter.
The custom properties could be added under a blender
tag in a node's metadata similar to how the gltf pipeline handles this.
Hi,
I've found that when defining a camera ellipsoid in Blender (2.9.1) it's coordinates are not converted in the .babylon exported file (with exporter plugin v6.4.5) as the rest of the coordinates are. Z and Y coordinates should be exchanged, they currently are not.
I know it simple to enter them in the right (wrong ?) order or to translate them after load in BJS, but it should be a simple fix, if you can find time to include it in the next release :-)
Anyway, thanks a lot for the great job !
hii, today I found this amazing exporter for babylon (blender 2.93) but ran in a small issue that can help me a lot in my work when resolved!
When I tick the 'Check Collisions' box under camera settings, the camera still does not check for collisions in the babylon sandbox viewer.. I have to manually enable it.. Am I missing something? I'd love to learn more
(Enabling 'Check Collisions' for my meshes does seem to work, when exporting with/without the setting enabled)
now i taken new default scene from blender added plane assigned checkmarks and exported.
plane is receving light not box and no shadows.
https://forum.babylonjs.com/t/no-shadows-visible-blender-babylon-exporter/5867/4?u=vijayxd
I export a blender model with a shader that gets baked to a texture,
and I load it successfully in babylon.js
issue is the lighting.
if I use
var environment = scene.createDefaultEnvironment({
createGround: false,
enableGroundShadow: false,
groundYBias: 1,
groundOpacity: 0.5,
});
then I can see the texture applied to the model, great. But I want to light it better. So I add lights like:
var light = new PointLight("pointLight", new Vector3(50, 333, 1), scene);
light.diffuse = new Color3(1, 1, 1);
light.specular = new Color3(0, 0, 0);
light.intensity = 10000000;
but the light behaves very strangely and only if I put a super high intensity I can see something.
Also If I give it a neutral color, it colors the entire object so I don't see its texture properly anymore.
If instead I don't use the createdefaultenvironment line, then similar thing happens.
the question is, how can I bring more neutral light/brightness to different parts of my model without changing
the colors that the applied texture is giving it?
If I choose a light with neutral color it just gets rid of the color in the texture
thank you
(issues lighting a blender exported model with baked texture)
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 also attach here the simple blend file, thank you again
========= 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
Good day, I have a mesh in blender that looks good with backface culling off, because then the normals are pointing in both directions and all looks great,
renders and previews all looking great in blender.
I export it sucessfully to babylon format, but then in babylon it appears invisible from below. Which is exactly what happens in blender when backface culling option is on. And yet i had it off in blender. What can I do in babylon to have two sided faces so that it doesnt appear invisible from below the model?
this is very important for my project, please let me know if there are workarounds so that I can disable this backface culling in the mesh in babylon
thank you very much
Hi
exporter V 6.2.3, Blender 2.81
While exporting mesh to .babylon file and checking option:
World Properties > Babylon.js ver 6.2.3 > Use PBR Materials
I got when Loading the scene with SceneLoader.Append a situation that I would like to modify ambientColor for all materials in mesh.materials array.
for (let index = 0; index < scene.materials.length; index++) {
const material = scene.materials[index];
material.ambientColor = new Color3(1, 1, 1);
}
And linter for typescript is throwing an error:
Property 'ambientColor' does not exist on type
Ok, so I cast the material to PBRMaterial:
const material = scene.materials[index] as PBRMaterial;
And this error is gone but then I got a new one:
error Do not use any type assertions @typescript-eslint/consistent-type-assertions
The solution to this is for me now:
const material = scene.materials[index] as PBRMaterial; // eslint-disable-line @typescript-eslint/consistent-type-assertions
But I think if I'm selecting Use PBR Materials my materials in the scene will all be PBRMaterials and they should have a proper meshes type so Materials[] | PBRMaterials[].
Regards
Hi there,
I followed the installation instructions up to the point
" - Check the box to enable it. "
But when I try to activate the plugin it results in the error below:
Traceback (most recent call last):
File "/Applications/Blender/blender.app/Contents/Resources/2.79/scripts/modules/addon_utils.py", line 331, in enable
mod = import(module_name)
File "/Users/username/Library/Application Support/Blender/2.79/scripts/addons/babylon_js/init.py", line 86, in
from . import light_shadow
File "/Users/username/Library/Application Support/Blender/2.79/scripts/addons/babylon_js/light_shadow.py", line 168, in
default = False
AttributeError: 'RNA_Types' object has no attribute 'Light'
I use the blender version 2.79b (2.79b 2018-03-22, Blender Foundation) on mac os 10.14.2 and it's the first time that I'am trying to use this plugin so I had no old version to uninstall.
Thanks for helping 😊
good day,
I have a 3d model loaded in babylon.js
I just want to put a simple text label somewhere in the 3d space, say coordinates x,y,z
I find examples to put buttons, panels, etc, but I just want the text by itself, how can I do that?
Also using an example of a panel+text, the panel appeared but the text didn’t, do I need to do anything else to make text appear?
thank you
I used a manual bone setup to this model, still having issue, the animation lost and still got a error messages.
I attached the 2 files both blender file and the converted .babylon
you can explore the file
monsterA.zip
Hello,
I'm trying to export using the plugin, but it fails with this issue:
Traceback (most recent call last):
File "C:\Users\kevin\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\babylon_js\json_exporter.py", line 47, in execute
if self.settings.writeCsvFile:
AttributeError: 'NoneType' object has no attribute 'writeCsvFile'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\kevin\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\babylon_js\__init__.py", line 65, in execute
exporter.execute(context, self.filepath)
File "C:\Users\kevin\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\babylon_js\json_exporter.py", line 170, in execute
if self.settings.writeCsvFile: stats_handler.close()
AttributeError: 'NoneType' object has no attribute 'writeCsvFile'
location: <unknown location>:-1
My setup:
There is an error in code in the texture.py file for logging which throws an error on export for a warning:
logging.Logger.warn('Texture is not mapped as UV or UV2, assigned 1', 5)
'logging' does not exist. Should be:
Logger.warn('Texture is not mapped as UV or UV2, assigned 1', 5)
Is this repo open to having more contributors/pulls or shall we always just go through issues? Seems more productive to have forward progressing dialog through relevant pull requests and enhancements (through issues) than forking.
I am having issue on exporting the animated character from max to babylon, still getting issues
using 6.4.6 was fine. Using the latest 2.93.1 exporter with blender 2.93.1 gives me this.
========= An error was encountered =========
File "C:\Users\Jason\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\json_exporter.py", line 163, in execute
self.to_json_file()
File "C:\Users\Jason\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\json_exporter.py", line 250, in to_json_file
grouper.write_animation_groups(file_handler, first)
File "C:\Users\Jason\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\mesh.py", line 730, in write_animation_groups
groupNames = self.getAminGroupNames()
File "C:\Users\Jason\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\mesh.py", line 763, in getAminGroupNames
for animation in key.animations:
ERROR: 'RawShapeKey' object has no attribute 'animations'
Mesh in question can be downloaded at feypurple.zip
I'm currently trying to install Blender2Babylon-6.2.zip into Blender v2.80, and it does not appear to be registering with Blender. I don't see the add-on in the list after attempting installation.
I am trying to install the Exporter for Blender 2.8.2 but it seems like the Addon can't be installed. There's no way to find out why. The Addon didn't show up in the list either. Hope s.o can help.
Traceback (most recent call last):
File "C:\Users\jason\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js_init_.py", line 60, in execute
if not verify_min_blender_version():
File "C:\Users\jason\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\babylon_js\package_level.py", line 48, in verify_min_blender_version
minor = int(split2[0])
ValueError: invalid literal for int() with base 10: '83.0'
location: :-1
Getting this error:
Traceback (most recent call last):
File "/Users/-----/Library/Application Support/Blender/2.90/scripts/addons/babylon_js/__init__.py", line 65, in execute
exporter.execute(context, self.filepath)
File "/Users/****/Library/Application Support/Blender/2.90/scripts/addons/babylon_js/json_exporter.py", line 148, in execute
bulb = Light(object, self, self.settings.usePBRMaterials)
File "/Users/----/Library/Application Support/Blender/2.90/scripts/addons/babylon_js/light_shadow.py", line 36, in __init__
self.define_animations(bpyLight, False, True, False)
File "/Users/-----/Library/Application Support/Blender/2.90/scripts/addons/babylon_js/f_curve_animatable.py", line 53, in define_animations
hasData |= posAnimation.append_range(object, animationRange)
UnboundLocalError: local variable 'hasData' referenced before assignment
location: <unknown location>:-1
Traceback (most recent call last):
File "C:\Users\clrar\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js_init_.py", line 65, in execute
exporter.execute(context, self.filepath)
File "C:\Users\clrar\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js\json_exporter.py", line 155, in execute
self.to_json_file()
File "C:\Users\clrar\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js\json_exporter.py", line 217, in to_json_file
mesh.to_json_file(file_handler)
File "C:\Users\clrar\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\babylon_js\mesh.py", line 659, in to_json_file
write_indice_array(file_handler, 'indices', self.indices)
NameError: name 'write_indice_array' is not defined
location: :-1
I just downloaded blender. Which gave me version v2.80.75.
There is no "File -> User Settings" to start with.
There is however a "Edit -> Preferences..."
Then on the left there is an "Add-ons" which you can select.
So I click: "Install..." Then I select a zip I downloaded of this Blender Exporter. Because you don't have any release, I'm assuming it will work with just downloading a zip of the master-branch.
"BlenderExporter-master.zip"
Then I click the "Install Add-on from File...".
Then in the bottom of the program it says:
Modules installed from
But then I cannot see the "addon" anywhere in Official, Community or Testing. So I can't activate it.
Is this exporter not compatible with Blender 2.80.75? Or am I doing something wrong?
Hi guys, I got this trying to export my scene in blender 2.81 (first time I tried the tool). It exported a bunch of images, but for some reason the mesh part fails it seems.
Traceback (most recent call last):
File "/home/james/.config/blender/2.81/scripts/addons/babylon_js/__init__.py", line 65, in execute
exporter.execute(context, self.filepath)
File "/home/james/.config/blender/2.81/scripts/addons/babylon_js/json_exporter.py", line 111, in execute
mesh = Mesh(object, scene, self)
File "/home/james/.config/blender/2.81/scripts/addons/babylon_js/mesh.py", line 146, in __init__
recipe = BakingRecipe(bpyMesh, exporter)
File "/home/james/.config/blender/2.81/scripts/addons/babylon_js/materials/baking_recipe.py", line 105, in __init__
self.bakedMaterial.bake(bpyMesh, self)
File "/home/james/.config/blender/2.81/scripts/addons/babylon_js/materials/material.py", line 138, 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 "/home/james/Downloads/blender-2.81-linux-glibc217-x86_64/2.81/scripts/modules/bpy/ops.py", line 201, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Traceback (most recent call last):
File "/home/james/Downloads/blender-2.81-linux-glibc217-x86_64/2.81/scripts/startup/bl_operators/uvcalc_smart_project.py", line 1032, in execute
self.stretch_to_bounds,
File "/home/james/Downloads/blender-2.81-linux-glibc217-x86_64/2.81/scripts/startup/bl_operators/uvcalc_smart_project.py", line 744, in main
raise Exception("error, no selected mesh objects")
Exception: error, no selected mesh objects
location: /home/james/Downloads/blender-2.81-linux-glibc217-x86_64/2.81/scripts/modules/bpy/ops.py:201
location: <unknown location>:-1
I noticed there were no export settings. It said something about finding the settings in the properties panel
Does latest version of exporter support Diffuse PBR shader?
I'm getting the following msg:
Traceback (most recent call last):
File "/home/pietrko/.config/blender/2.90/scripts/addons/babylon_js/__init__.py", line 65, in execute
exporter.execute(context, self.filepath)
File "/home/pietrko/.config/blender/2.90/scripts/addons/babylon_js/json_exporter.py", line 115, in execute
mesh = Mesh(object, scene, self)
File "/home/pietrko/.config/blender/2.90/scripts/addons/babylon_js/mesh.py", line 146, in __init__
recipe = BakingRecipe(bpyMesh, exporter)
File "/home/pietrko/.config/blender/2.90/scripts/addons/babylon_js/materials/baking_recipe.py", line 100, in __init__
self.bakedMaterial = BJSMaterial(firstMatUsingNodes, exporter)
File "/home/pietrko/.config/blender/2.90/scripts/addons/babylon_js/materials/material.py", line 63, in __init__
self.bjsNodeTree = AbstractBJSNode.readMaterialNodeTree(bpyMaterial.node_tree)
AttributeError: 'BJSMaterial' object has no attribute 'node_tree'
location: <unknown location>:-1
I am exporting this bat out from blender 2.93, but when I view it in sandbox.babylonjs.com it says that there is not any materials assigned, which though the log file claims it is true, acknowledges that the materials exist.
I am attaching the texture, babylon file, and blender file: Stuff.zip
This is the log output:
========= Writing of JSON file started ========= writing mesh: Quad Sphere writing mesh: Sphere ========= Writing of JSON file completed ========= ========= end of processing ========= elapsed time: 0 min, 1.6083 secs ========= 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 : /home/user/Downloads/ Python World class constructor completed processing begun of camera (UniversalCamera): Camera processing begun of mesh: Quad Sphere processing begun of material: Bat processing texture bat texture type: diffuseTexture, mapped using: "UVMap" num positions : 1893 num normals : 1893 num tangents : 0 num uvs : 3786 num uvs2 : 0 num colors : 7572 num triangles : 3224 processing begun of mesh: Sphere WARNING: No materials have been assigned: num positions : 2462 num normals : 2462 num tangents : 0 num uvs : 4924 num uvs2 : 0 num colors : 0 num triangles : 4224 processing begun of light (DIRECTIONAL): Sun processing begun of light (DIRECTIONAL): Sun.001 processing begun of light (DIRECTIONAL): Sun.002 ========= Writing of JSON file started ========= writing mesh: Quad Sphere writing mesh: Sphere ========= Writing of JSON file completed ========= ========= end of processing ========= elapsed time: 0 min, 1.7002 secs Info: Saved "Oneeyed-evilbat.blend"
Don't know if i should post it here, but maybe someone will find it here and it will save his day.
I'm trying to add animated character from mixamo.com to my babylon project. I followed tutorial https://doc.babylonjs.com/resources/mixamo_to_babylon. I've used exporter 6.3.1. and 2.82a blender.
Tutorial works well, except one thing. If you name your animation so that it will go after TPose alphabetically you will get complete mess in sandbox.
My case was I named t-posed animation TPose. And I had a walking animation which I called Walking.
So in list I had Running, IdleToAction, StopWalking, TPose, Walking. After export things go complete mess. When I renamed my Walking to SWalk to be before TPose everything works like a charm.
Can you mention it somehow in tutor?
super().__init__(bpyNode, socketName, overloadChannels) File "C:\Users\sheng\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\materials\nodes\abstract.py", line 84, in __init__ bjsWrapperNode = AbstractBJSNode.GetBJSWrapperNode(nodeSocket.links[0].from_node, nodeSocket.name, overloadChannels) File "C:\Users\sheng\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\materials\nodes\abstract.py", line 356, in GetBJSWrapperNode return UnsupportedNode(bpyNode, socketName, overloadChannels) File "C:\Users\sheng\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\materials\nodes\unsupported.py", line 12, in __init__ super().__init__(bpyNode, socketName, overloadChannels) File "C:\Users\sheng\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\materials\nodes\abstract.py", line 84, in __init__ bjsWrapperNode = AbstractBJSNode.GetBJSWrapperNode(nodeSocket.links[0].from_node, nodeSocket.name, overloadChannels) File "C:\Users\sheng\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\materials\nodes\abstract.py", line 347, in GetBJSWrapperNode return TextureImageBJSNode(bpyNode, socketName, overloadChannels) File "C:\Users\sheng\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\babylon_js\materials\nodes\tex_image.py", line 13, in __init__ self.alpha = bpyNode.image.file_format not in NON_ALPHA_FORMATS
========= Writing of JSON file started =========
========= An error was encountered =========
File "/Users/dzsb-001971/Library/Application Support/Blender/2.83/scripts/addons/babylon_js/json_exporter.py", line 160, in execute
self.to_json_file()
File "/Users/dzsb-001971/Library/Application Support/Blender/2.83/scripts/addons/babylon_js/json_exporter.py", line 190, in to_json_file
material.to_json_file(file_handler)
File "/Users/dzsb-001971/Library/Application Support/Blender/2.83/scripts/addons/babylon_js/materials/material.py", line 286, in to_json_file
write_float(file_handler, 'emissiveIntensity', self.bjsNodeTree.emissiveIntensity)
File "/Users/dzsb-001971/Library/Application Support/Blender/2.83/scripts/addons/babylon_js/package_level.py", line 336, in write_float
file_handler.write(',"' + name + '":' + format_f(float, precision = precision))
File "/Users/dzsb-001971/Library/Application Support/Blender/2.83/scripts/addons/babylon_js/package_level.py", line 95, in format_f
return format_float(num, '%.' + str(precision) + 'f', stripLeadingZero)
File "/Users/dzsb-001971/Library/Application Support/Blender/2.83/scripts/addons/babylon_js/package_level.py", line 98, in format_float
s = fmt % num # rounds to N decimal places
ERROR: must be real number, not UnsupportedNode
========= end of processing =========
elapsed time: 4 min, 58.4957 secs
hello, today I returned to my blender (blender 2.93) to babylon project but ran in a small issue that can help me a lot in my work when resolved!
When creating a material for an object, it seems the adjusted specular I did in Blender does not come through when importing into the babylon sandbox.
Could I be missing a setting? Thanks in advance.
Below I attached my current settings, material and comparison
Hey, any chance of getting NLA support in this exporter?
See https://forum.babylonjs.com/t/help-needed-with-blender-export-to-babylon/16593/2 for context.
I am willing to help.
The Babylon Blender Exporter causes errors in the stable version of BabylonJS on NPM (v4.0.3) due to a bug/typo in the code of BabylonJS itself relative to the way it parses sheen
values.
The problem comes from the fact that the pbrMaterial.ts
, pbrSpecularGlossinessMaterial.ts
and pbrMetallicRoughnessMaterial.ts
are parsing the sheen
value incorrectly by using the brdf
value which can be null
at that point.
To be clear, this bug has been corrected in later versions of Babylon (4.1.0+) but those versions are not yet available on NPM as stable which puts us in a catch-22 scenario. Meaning that the latest stable version of the Exporter is not compatible with the latest stable version of BabylonJS.
A workaround would be to hack the Babylon Exporter to no longer write the sheen
value to the exported files (thus avoiding the runtime error in-engine).
I believe commenting out these lines should do the trick for now. Very hacky, but it should work hopefully:
https://github.com/BabylonJS/BlenderExporter/blob/master/src/babylon_js/materials/material.py#L307:L318
Another option would be to hack the engine itself to fix the bug in my local version of Babylon 4.0.3 just like it was done in later versions. Not ideal since I'm using Babylon directly from NPM and not compiling from source.
Problem Commits (and lines) here:
https://github.com/BabylonJS/Babylon.js/blob/v4.0.0/src/Materials/PBR/pbrMaterial.ts#L764
https://github.com/BabylonJS/Babylon.js/blob/v4.0.0/src/Materials/PBR/pbrSpecularGlossinessMaterial.ts#L120
https://github.com/BabylonJS/Babylon.js/blob/v4.0.0/src/Materials/PBR/pbrMetallicRoughnessMaterial.ts#L130
Seems to have been fixed in this commit here:
BabylonJS/Babylon.js@d9a349a
Hello,
When I try to export my file I get this error:
ERROR: 'BJSMaterial' object has no attribute 'materialNameSpace'
Here the complete log:
Exporter version: 6.1.1, Blender version: 2.80 (sub 74)
========= 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
texture directory : D:\Creation\Gamedev\BabylonJS\Maze-Project\Maze-Demo\misc\3D\NewWorld1\
Python World class constructor completed
WARNING: No active camera has been assigned, or is not in a currently selected Blender layer
processing begun of node: 5_0
processing begun of mesh: 5_0_00_MSH
processing begun of material: tileset.Bark
WARNING: unsupported node type(ShaderNodeAddShader) will trigger baking
========= An error was encountered =========
File "C:\Users\geoff\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\json_exporter.py", line 111, in execute
mesh = Mesh(object, scene, self)
File "C:\Users\geoff\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\mesh.py", line 145, in __init__
recipe = BakingRecipe(bpyMesh, exporter)
File "C:\Users\geoff\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\materials\baking_recipe.py", line 100, in __init__
self.bakedMaterial = BJSMaterial(firstMatUsingNodes, exporter)
File "C:\Users\geoff\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\materials\material.py", line 49, in __init__
self.environmentIntensity = mat.environmentIntensity if mat.intensityOverride else exporter.settings.environmentIntensity
ERROR: 'BJSMaterial' object has no attribute 'materialNameSpace'
========= end of processing =========
elapsed time: 0 min, 0.024 secs
What do you think?
I am using the last version of Blender 2.80 with the last version of the exporter.
When you export a collection and an instance of that collection, only the mesh data of the original collection seem to get exported. For any instances of the collection, only the position seems to remain.
My question is: is this a problem with my set-up / the way I'm exporting, or is it that this is not implemented yet?
Not sure if you guys are supporting Blender 3.0.0, but having installed from the Windows Store, Blender auto-updated on me and now I have 3.0.0 installed.
In any event, a scene that I was previously able to export is suddenly throwing an error:
The relevant bits are:
AttributeError: 'RenderSettings" object has no attribute 'tile_x'
This really feels like a change between 2.9.x and 3.0.0 in Blender, but please let me know if there's something that I'm likely to need to change in my scene to fix this.
i followed the installation instructions (https://doc.babylonjs.com/extensions/Exporters/Blender), and had no success with it.
i had to manually copy the folder babylon_js to "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\addons" to make Blender recognize the addon.
OS: Windows 11, Version 22H2 (Windows-10-10.0.22621-SP0 x64)
Blender: 3.4.1
Python: 3.10.8
I am on blender 2.81, I have downloaded the repo zip file as per https://doc.babylonjs.com/resources/blender
Instruction there don't seem to apply anymore. Add-ons in this version are under Edit=>Preferences=>Add-ons, but that is quick to find and no problem.
After installing the zip file Babylon add on is nowhere to be found.
This is the log
Blender 2.91 seems to have a few changes in the API.
There's a minor error in the smart_project function.
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
Hi, I was trying to make import a scene with (collider + rigid body) generated in blender.
The scene loads and the objects fall as expected, but there is no way to access the imposter...i wanted to create a joint.
Is there some extra step to assign those properties or is not implemented?
I will attach both files: blender + export
So you can test it on https://sandbox.babylonjs.com/
I used the blender plugin to export some obj files to the Babylon format. After switching to 2.8 I realize that the resulting Babylon files getting bigger than before. A 70MB obj file resulted in a 100MB Babylon file, before with blender 2.7 and exporter version v5 it resulted in a 33MB file size.
I switched back to blender 2.7 and its maybe also possible that it was settings related but some further investigation would be nice.
I exported successfully a model with a material from blender
and I get 4 files:
then with javascript I perform a
SceneLoader.Append(
"./models/m1/model.babylon",
"",
scene,
function (scene) { etc etc
and the model loads well, I can see it, but black, without material,
and in javascript console I can see
index.js:1 BJS - [00:33:59]: Unable to load from ./models/m1/model.babylon: Error in onSuccess callback
what could be the reason?
thank you
Hello,
when i export, i have this error message :
Traceback (most recent call last):
File "/home/felix/.config/blender/2.80/scripts/addons/babylon_js/__init__.py", line 65, in execute
exporter.execute(context, self.filepath)
File "/home/felix/.config/blender/2.80/scripts/addons/babylon_js/json_exporter.py", line 112, in execute
mesh = Mesh(object, scene, self)
File "/home/felix/.config/blender/2.80/scripts/addons/babylon_js/mesh.py", line 146, in __init__
recipe = BakingRecipe(bpyMesh, exporter)
File "/home/felix/.config/blender/2.80/scripts/addons/babylon_js/materials/baking_recipe.py", line 42, in __init__
bjsMaterial = BJSMaterial(bpyMaterial, exporter)
File "/home/felix/.config/blender/2.80/scripts/addons/babylon_js/materials/material.py", line 47, in __init__
self.checkReadyOnlyOnce = mat.checkReadyOnlyOnce
AttributeError: 'NoneType' object has no attribute 'checkReadyOnlyOnce'
location: <unknown location>:-1
i tried to remove all materials of my objects, but the problem stays
thank you
Hi. This really is not an "issue", but
I have started refactoring the addon.
My immediate goal is to remove all the code in the to_json functions where the file gets written 'by hand'. I have experienced slow exports and my thinking is that all this writing to the file_handler could be one slow point.
Instead i started adding dictionaries to all the object classes. The idea is to collect all the dicts in the end and write the file in one last step. For the moment the original code is mostly untouched apart from some splitting into more files and a replacemnt of the registering in the init file.
Ideally the collecting of the data i am doing now in the collect_data functions should be moved into the classes init functions or the classes could directly subclass from OrderedDict. But i wanted to first see if it works/makes a difference.
Anyways before i continue i just wanted to ask if this is something you would be interested in or if i am just monkeycoding for nothing :)
You can look at the code at:
https://github.com/florianfelix/BlenderExporter/tree/dictwrite
Here:
https://github.com/florianfelix/BlenderExporter/blob/dictwrite/src/babylon_js/mesh_submesh.py
and here:
https://github.com/florianfelix/BlenderExporter/blob/dictwrite/src/babylon_js/mesh_meshinstance.py
you can see what the endgoal should be me thinks.
If we have such classes we can just deliver everything to json.dump and get our final file.
I took a simple box, added key frames on location for frame 1, moved the box a simple distance up, added key frames for location at frame 20. When I try to export it, I get the following error:
Exporter version: 3.3-beta 1, Blender version: 3.3.1
========= 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:\Data\Blender\box\
Python World class constructor completed
processing begun of mesh: Cube
animation processing begun
========= An error was encountered =========
File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\json_exporter.py", line 116, in execute
mesh = Mesh(object, scene, self)
File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\mesh.py", line 49, in __init__
self.define_animations(bpyMesh, True, True, True)
File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\f_curve_animatable.py", line 51, in define_animations
hasData = rotAnimation.append_range(object, animationRange)
File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\animation.py", line 111, in append_range
bpy.context.scene.frame_set(animationRange.frames_in[idx])
ERROR: Scene.frame_set(): error with argument 1, "frame" - Function.frame expected an int type, not float
========= end of processing =========
elapsed time: 0 min, 0.3594 secs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.