Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blender exporter broken in Ubuntu #655

Closed
fariazz opened this issue Aug 13, 2015 · 4 comments
Closed

Blender exporter broken in Ubuntu #655

fariazz opened this issue Aug 13, 2015 · 4 comments

Comments

@fariazz
Copy link

fariazz commented Aug 13, 2015

Hi,

I tried the blender exporter script in Ubuntu, on Blender 2.72 and got this error. Same error in a blank project or existing blender files.

    Exporter version: 3.0.0, Blender version: 2.72 (sub 0)
========= Conversion from Blender to Babylon.js =========
    Python World class constructor completed
    processing begun of mesh:  Cube
        processing begun of baked material:  Cube
========= An error was encountered =========
  File "/home/fariazz/.config/blender/2.72/scripts/addons/io_export_babylon.py", line 287, in execute
    mesh = Mesh(object, scene, nextStartFace, forcedParent, nameID, self)
  File "/home/fariazz/.config/blender/2.72/scripts/addons/io_export_babylon.py", line 695, in __init__
    bakedMat = BakedMaterial(exporter, object, recipe)
  File "/home/fariazz/.config/blender/2.72/scripts/addons/io_export_babylon.py", line 1803, in __init__
    bpy.ops.uv.smart_project(angle_limit = 66.0, island_margin = 0.0, user_area_weight = 1.0, use_aspect = True)
  File "/home/fariazz/Temp/blender/blender-2.72b-linux-glibc211-x86_64/2.72/scripts/modules/bpy/ops.py", line 188, in __call__
    ret = op_call(self.idname_py(), None, kw)
ERROR:  Converting py args to operator properties: : keyword "use_aspect" unrecognized
========= end of processing =========
elapsed time:  0 min, 0.0011 secs

When using this version of the python script it works well: https://github.com/BabylonJS/Babylon.js/blob/c0b7e6100d8097ac9608fe48ab69e294c67799e9/Exporters/Blender/io_export_babylon.py on Blender 2.75a

@fariazz
Copy link
Author

fariazz commented Aug 13, 2015

With that older script I can export a blank new project, but when trying some existing Blender files I get an error regarding UV Editing:

    Exporter version: 3.0.0, Blender version: 2.75 (sub 0)
========= Conversion from Blender to Babylon.js =========
    Python World class constructor completed
    processing begun of mesh:  leaves.001
        processing begun of Standard material:  leaves
        num positions      :  16440
        num normals        :  16440
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  36990
    processing begun of mesh:  stems_1.001
        processing begun of Standard material:  stems_1
        num positions      :  2457
        num normals        :  2457
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  14175
    processing begun of mesh:  trunk.001
        processing begun of Standard material:  trunk
        num positions      :  481
        num normals        :  481
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  2868
    processing begun of mesh:  trunk
        registered as also a user of material:  trunk
        num positions      :  481
        num normals        :  481
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  2868
    processing begun of mesh:  stems_1
        registered as also a user of material:  stems_1
        num positions      :  2457
        num normals        :  2457
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  14175
    processing begun of mesh:  leaves
        registered as also a user of material:  leaves
        num positions      :  16440
        num normals        :  16440
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  36990
    processing begun of mesh:  Plane.019
        processing begun of Standard material:  Material.039
        num positions      :  0
        num normals        :  0
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  0
    processing begun of mesh:  Plane.018
        registered as also a user of material:  Material.039
        num positions      :  0
        num normals        :  0
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  0
    processing begun of mesh:  Cube.059
        processing begun of Standard material:  Material.018
            WARNING: Material has image texture with no UV map assigned:  "Tex.008" ignored
        num positions      :  16
        num normals        :  16
        num uvs            :  0
        num uvs2           :  0
        num colors         :  0
        num indices        :  72
    processing begun of mesh:  Cube.058
        processing begun of baked material:  Cube.058
            Internal baking texture, type: TEXTURE, mapped using: BakingUV
========= An error was encountered =========
  File "/home/fariazz/.config/blender/2.75/scripts/addons/io_export_babylon.py", line 287, in execute
    mesh = Mesh(object, scene, nextStartFace, forcedParent, nameID, self)
  File "/home/fariazz/.config/blender/2.75/scripts/addons/io_export_babylon.py", line 695, in __init__
    bakedMat = BakedMaterial(exporter, object, recipe)
  File "/home/fariazz/.config/blender/2.75/scripts/addons/io_export_babylon.py", line 1818, in __init__
    self.bake('diffuseTexture', 'DIFFUSE_COLOR', 'TEXTURE', image, mesh, exporter, recipe)
  File "/home/fariazz/.config/blender/2.75/scripts/addons/io_export_babylon.py", line 1852, in bake
    self.bakeInternal(internal_type, image)
  File "/home/fariazz/.config/blender/2.75/scripts/addons/io_export_babylon.py", line 1866, in bakeInternal
    bpy.data.screens['UV Editing'].areas[1].spaces[0].image = image
ERROR:  'bpy_prop_collection[key]: key "UV Editing" not found'
========= end of processing =========
elapsed time:  0 min, 0.3301 secs

This is the blender file: http://www.blendswap.com/blends/view/4764

@Palmer-JC
Copy link
Contributor

The use_aspect problem is related to your Blender version, will set the version to 2,75.0 next release.

Just saw the second one. Do not know how you cannot have 'UVEditing' screen, but will look at. I downloaded that. I see it was made with Blender 2.49. Wow that is old. Best I can probably do is perform a check for 'UVEditing' and skip baking in that case. That would be the equivalent of previous exporter (geometry with out materials). Not the highest priority, but having a test .blend might work in your favor.

@Palmer-JC
Copy link
Contributor

Ok,
I have put a check at the end of the BakingRecipe constructor, which ensures UVEditing exists when bakingRequired, otherwise a warning is put in log file & bakingRequired is turned off. Just a standard material is made.

I am looking at 3 other things. If they can be fixed quick, want to get them on the same version, 3.0.1. If you really need this & not just testing (which I appreciate), paste this at the end of BekingRecipe:

        # check for really old .blend file, eg. 2.49, to ensure that everything requires exists
        if self.needsBaking and bpy.data.screens.find('UV Editing') == -1:
            Main.warn('Contains material requiring baking, but resources not available.  Probably .blend very old', 2)
            self.needsBaking = False     

@fariazz
Copy link
Author

fariazz commented Aug 14, 2015

@Palmer-JC thank you so much! it works like a charm now.

@fariazz fariazz closed this as completed Aug 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants