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

How to use Blender export script? #143

Closed
geoffreak opened this Issue Mar 27, 2011 · 24 comments

Comments

Projects
None yet
@geoffreak

geoffreak commented Mar 27, 2011

I have looked everywhere and tried to get the Blender export script working, but I seem to be completely unable to get the export to three.js functionality working. Everywhere I look refers to a certain blog post, but that website isn't functioning and hasn't for the past few days of me checking.

Has anyone successfully gotten the export scripts to work in Blender (under Mac OSX)?

@alteredq

This comment has been minimized.

Show comment
Hide comment
@alteredq

alteredq Mar 27, 2011

Contributor

This blog post is very old, meanwhile exporter, format and loading changed a lot.

Current Blender exporter works with the Blender beta 2.56.0 and can be found here (or under corresponding location in your local repo clone):

https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender

In order to get this working, you will need to copy Python scripts from Three.js repo to corresponding location in your Blender installation.

I don't know where Blender keeps its user data in OSX, but for example on Windows it is under c:/users/yourusername/Application Data/Blender Foundation/Blender.

Under this folder there should be directory structure as in Three.js repo 2.56\scripts\op (you should see other exporters there that came with Blender).

Now under this op folder you need to create io_mesh_threejs subfolder and copy there files from corresponding folder in Three.js repo.

When you reload Blender (or press F8), in File->Export menu you should have now Three.js (.js) option.

Don't use yet scene export option, it's not yet finished, but if you uncheck it, you can export single selected mesh.

This will generate model in ascii JSON format, which can be then loaded via THREE.JSONLoader.

Check Blender exporter or OBJ converter examples to see it in action (OBJ converter generates the same ascii JSON format as Blender exporter):

http://mrdoob.github.com/three.js/examples/webgl_geometry_blenderexport_colors.html

https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_blenderexport_colors.html#L76

http://mrdoob.github.com/three.js/examples/webgl_objconvert_test.html

https://github.com/mrdoob/three.js/blob/master/examples/webgl_objconvert_test.html#L196

Relevant piece of code is here:

var loader = new THREE.JSONLoader();
loader.load( { model: "myModel.js", callback: function(geo) { createModel( geo ) } } );
Contributor

alteredq commented Mar 27, 2011

This blog post is very old, meanwhile exporter, format and loading changed a lot.

Current Blender exporter works with the Blender beta 2.56.0 and can be found here (or under corresponding location in your local repo clone):

https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender

In order to get this working, you will need to copy Python scripts from Three.js repo to corresponding location in your Blender installation.

I don't know where Blender keeps its user data in OSX, but for example on Windows it is under c:/users/yourusername/Application Data/Blender Foundation/Blender.

Under this folder there should be directory structure as in Three.js repo 2.56\scripts\op (you should see other exporters there that came with Blender).

Now under this op folder you need to create io_mesh_threejs subfolder and copy there files from corresponding folder in Three.js repo.

When you reload Blender (or press F8), in File->Export menu you should have now Three.js (.js) option.

Don't use yet scene export option, it's not yet finished, but if you uncheck it, you can export single selected mesh.

This will generate model in ascii JSON format, which can be then loaded via THREE.JSONLoader.

Check Blender exporter or OBJ converter examples to see it in action (OBJ converter generates the same ascii JSON format as Blender exporter):

http://mrdoob.github.com/three.js/examples/webgl_geometry_blenderexport_colors.html

https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_blenderexport_colors.html#L76

http://mrdoob.github.com/three.js/examples/webgl_objconvert_test.html

https://github.com/mrdoob/three.js/blob/master/examples/webgl_objconvert_test.html#L196

Relevant piece of code is here:

var loader = new THREE.JSONLoader();
loader.load( { model: "myModel.js", callback: function(geo) { createModel( geo ) } } );
@geoffreak

This comment has been minimized.

Show comment
Hide comment
@geoffreak

geoffreak Mar 27, 2011

When checking my Blender system information, I see the following:

Blender home dir:
  /Applications/blender/blender.app/Contents/MacOS/.blender

 Default dir for scripts:
  /Applications/blender/blender.app/Contents/MacOS/.blender/scripts

 Default "bpydata/" data dir for scripts:
  /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpydata

 User defined dir for scripts:
   -- not found

 Data dir "bpydata/" inside user defined dir:
   -- not found

 Default config data "bpydata/config/" dir:
  /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpydata/config

So I put the scripts import_threejs.py, export_threejs.py, and init.py into /Applications/blender/blender.app/Contents/MacOS/.blender/scripts
Despite this, nothing appears on the export menu regardless if I quit out of Blender and relaunch it, or if I hit F8

geoffreak commented Mar 27, 2011

When checking my Blender system information, I see the following:

Blender home dir:
  /Applications/blender/blender.app/Contents/MacOS/.blender

 Default dir for scripts:
  /Applications/blender/blender.app/Contents/MacOS/.blender/scripts

 Default "bpydata/" data dir for scripts:
  /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpydata

 User defined dir for scripts:
   -- not found

 Data dir "bpydata/" inside user defined dir:
   -- not found

 Default config data "bpydata/config/" dir:
  /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpydata/config

So I put the scripts import_threejs.py, export_threejs.py, and init.py into /Applications/blender/blender.app/Contents/MacOS/.blender/scripts
Despite this, nothing appears on the export menu regardless if I quit out of Blender and relaunch it, or if I hit F8

@alteredq

This comment has been minimized.

Show comment
Hide comment
@alteredq

alteredq Mar 27, 2011

Contributor

You need to find where in your OS Blender keeps its own native importers / exporters and copy Three.js files there to keep the same pattern.

Somewhere you should have folder structure like this:

autosave
config
plugins
scripts
    addons
    io
    keyingsets 
    modules
    op
        io_anim_bvh 
        io_mesh_ply
        io_mesh_threejs  <= create this folder
        io_scene_3ds 
        io_scene_fbx 
        io_scene_obj 
        io_scene_x3d 
        io_shape_mdd 
    presets
    templates
    ui

Also check Blender console for eventual error messages or loading modules reports.

Make sure you copy files to folder from the right version of Blender (must be 2.56a).

At least on Windows, each beta keeps its files in a different folder, all start with version number (so above the folder structure I posted, there are 2.54, 2.55, 2.56 folders, if you tried multiple betas).

Contributor

alteredq commented Mar 27, 2011

You need to find where in your OS Blender keeps its own native importers / exporters and copy Three.js files there to keep the same pattern.

Somewhere you should have folder structure like this:

autosave
config
plugins
scripts
    addons
    io
    keyingsets 
    modules
    op
        io_anim_bvh 
        io_mesh_ply
        io_mesh_threejs  <= create this folder
        io_scene_3ds 
        io_scene_fbx 
        io_scene_obj 
        io_scene_x3d 
        io_shape_mdd 
    presets
    templates
    ui

Also check Blender console for eventual error messages or loading modules reports.

Make sure you copy files to folder from the right version of Blender (must be 2.56a).

At least on Windows, each beta keeps its files in a different folder, all start with version number (so above the folder structure I posted, there are 2.54, 2.55, 2.56 folders, if you tried multiple betas).

@geoffreak

This comment has been minimized.

Show comment
Hide comment
@geoffreak

geoffreak Mar 29, 2011

Sorry for wasting your time alteredq. My issue was that my version of Blender wasn't the latest version. I thought I had downloaded the latest version just a couple of days ago, but I must have either not been launching the right version or I downloaded an old version.

For future reference to those who have this problem too, the scripts folder is inside the blender.app in the Contents/MacOS/ folder, then the folder structure is as listed in alteredq's post above.

geoffreak commented Mar 29, 2011

Sorry for wasting your time alteredq. My issue was that my version of Blender wasn't the latest version. I thought I had downloaded the latest version just a couple of days ago, but I must have either not been launching the right version or I downloaded an old version.

For future reference to those who have this problem too, the scripts folder is inside the blender.app in the Contents/MacOS/ folder, then the folder structure is as listed in alteredq's post above.

@geoffreak geoffreak closed this Mar 29, 2011

@julls

This comment has been minimized.

Show comment
Hide comment
@julls

julls Apr 29, 2011

Hi there guys,

I tried to do what you explained, but with versions (2.56-beta, 2.56a-beta and 2.57b), all that I could find was: .../blender/2.56 (or2.57)/python/lib/ ... and there is a bunch of folders and python scripts but no folder named "op" or "scripts".

I made a new folder inside this lib folder named io_mesh_threejs and then copied the .py files -- import_threejs.py, export_threejs.py and init.py inside -- It did not work :(

Do I need to copy something else or did I just do the whole thing wrong? When I re-open blender and went to file-->export I didn't see the option -- Three.js (.js) -- with any of the versions. BTW, I'm using windows.

Thanks for the help xD
Julio

julls commented Apr 29, 2011

Hi there guys,

I tried to do what you explained, but with versions (2.56-beta, 2.56a-beta and 2.57b), all that I could find was: .../blender/2.56 (or2.57)/python/lib/ ... and there is a bunch of folders and python scripts but no folder named "op" or "scripts".

I made a new folder inside this lib folder named io_mesh_threejs and then copied the .py files -- import_threejs.py, export_threejs.py and init.py inside -- It did not work :(

Do I need to copy something else or did I just do the whole thing wrong? When I re-open blender and went to file-->export I didn't see the option -- Three.js (.js) -- with any of the versions. BTW, I'm using windows.

Thanks for the help xD
Julio

@TJKoury

This comment has been minimized.

Show comment
Hide comment
@TJKoury

TJKoury Apr 29, 2011

Deprecated file format error...?

-TJ

TJKoury commented Apr 29, 2011

Deprecated file format error...?

-TJ

@mikaelgramont

This comment has been minimized.

Show comment
Hide comment
@mikaelgramont

mikaelgramont May 1, 2011

Contributor

I haven't tried 2.57 yet but you can still download 2.56b from the blender site, and I got it to work on Ubuntu.
I placed the files inside the blender application directory, not the .blender user pref directory:
~/Apps/blender-2.56-beta-linux-glibc27-x86_64/2.56/scripts/op/io_mesh_threejs

where ~/Apps/blender-2.56-beta-linux-glibc27-x86_64 is the folder I uncompressed Blender to.

Contributor

mikaelgramont commented May 1, 2011

I haven't tried 2.57 yet but you can still download 2.56b from the blender site, and I got it to work on Ubuntu.
I placed the files inside the blender application directory, not the .blender user pref directory:
~/Apps/blender-2.56-beta-linux-glibc27-x86_64/2.56/scripts/op/io_mesh_threejs

where ~/Apps/blender-2.56-beta-linux-glibc27-x86_64 is the folder I uncompressed Blender to.

@TJKoury

This comment has been minimized.

Show comment
Hide comment
@TJKoury

TJKoury May 1, 2011

Thanks. I got it to work, my problem now is that the file it outputs is in
the 'old' (pre-version 2) format, so I get the 'depricated file format'
error. It's missing the vertices array, I think.

TJKoury commented May 1, 2011

Thanks. I got it to work, my problem now is that the file it outputs is in
the 'old' (pre-version 2) format, so I get the 'depricated file format'
error. It's missing the vertices array, I think.

@wezzy

This comment has been minimized.

Show comment
Hide comment
@wezzy

wezzy May 29, 2011

Hi,
i'm able to run the exporter on Mac. I've copied the folder https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/2.57/scripts/addons/io_mesh_threejs to /Applications/Blender/blender.app/Contents/MacOS/2.57/scripts/addons/io_mesh_threejs then opened Blender and under File -> User Preferences -> Add-Ons searched for three.js format and then checked the checkbok on the right of the line to activate the exporter.

wezzy commented May 29, 2011

Hi,
i'm able to run the exporter on Mac. I've copied the folder https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/2.57/scripts/addons/io_mesh_threejs to /Applications/Blender/blender.app/Contents/MacOS/2.57/scripts/addons/io_mesh_threejs then opened Blender and under File -> User Preferences -> Add-Ons searched for three.js format and then checked the checkbok on the right of the line to activate the exporter.

@georgik

This comment has been minimized.

Show comment
Hide comment
@georgik

georgik Jun 20, 2011

Contributor

Windows 7 and Blender 2.57: copy folder https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/2.57/scripts/addons/io_mesh_threejs

  • to: C:\Users\USERNAME\AppData\Roaming\Blender Foundation\Blender\2.57\scripts\addons

Start Blender, File -> User Preferences -> Add-Ons, search for Three.js, activate plugin.

Contributor

georgik commented Jun 20, 2011

Windows 7 and Blender 2.57: copy folder https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/2.57/scripts/addons/io_mesh_threejs

  • to: C:\Users\USERNAME\AppData\Roaming\Blender Foundation\Blender\2.57\scripts\addons

Start Blender, File -> User Preferences -> Add-Ons, search for Three.js, activate plugin.

@tha1bu1

This comment has been minimized.

Show comment
Hide comment
@tha1bu1

tha1bu1 Jul 14, 2011

@ JCAZ Just copy the folder labeled "scripts" and paste it under the subfolder called "2.57". The structure should look like this: C:\Program Files\Blender Foundation\Blender\2.57\scripts\addons\io_mesh_threejs

tha1bu1 commented Jul 14, 2011

@ JCAZ Just copy the folder labeled "scripts" and paste it under the subfolder called "2.57". The structure should look like this: C:\Program Files\Blender Foundation\Blender\2.57\scripts\addons\io_mesh_threejs

@fernandoc1

This comment has been minimized.

Show comment
Hide comment

fernandoc1 commented Jul 15, 2011

@julls

This comment has been minimized.

Show comment
Hide comment
@julls

julls Jul 18, 2011

oh hi there tha1bu1,

I hadn't seen your post sry and thanks for the help :) but I already had it working xD

julls commented Jul 18, 2011

oh hi there tha1bu1,

I hadn't seen your post sry and thanks for the help :) but I already had it working xD

@mariakay

This comment has been minimized.

Show comment
Hide comment
@mariakay

mariakay Feb 27, 2013

Hi! I was able to import now using three js but cant export. three.js option is listed but is inactive. What could have been the problem?

mariakay commented Feb 27, 2013

Hi! I was able to import now using three js but cant export. three.js option is listed but is inactive. What could have been the problem?

@PaLy90

This comment has been minimized.

Show comment
Hide comment
@PaLy90

PaLy90 Mar 7, 2013

excuse my English, I have version 2.66 of blender, is that the problem?.
I copy the files in the directory and do not see the option to export

http://k43.kn3.net/178096C1E.jpg
178096C1E 1

PaLy90 commented Mar 7, 2013

excuse my English, I have version 2.66 of blender, is that the problem?.
I copy the files in the directory and do not see the option to export

http://k43.kn3.net/178096C1E.jpg
178096C1E 1

@denisw

This comment has been minimized.

Show comment
Hide comment
@denisw

denisw Mar 13, 2013

excuse my English, I have version 2.66 of blender, is that the problem?.
I copy the files in the directory and do not see the option to export

Seems as if the exporter doesn't work with 2.66 yet. I have tried the same thing (on Ubuntu) and also couldn't see the exporter in the add-ons list, while the same thing worked with 2.63 (the version that in the repos of my Ubuntu 12.10 installation) without problems.

denisw commented Mar 13, 2013

excuse my English, I have version 2.66 of blender, is that the problem?.
I copy the files in the directory and do not see the option to export

Seems as if the exporter doesn't work with 2.66 yet. I have tried the same thing (on Ubuntu) and also couldn't see the exporter in the add-ons list, while the same thing worked with 2.63 (the version that in the repos of my Ubuntu 12.10 installation) without problems.

@PaLy90

This comment has been minimized.

Show comment
Hide comment
@PaLy90

PaLy90 Mar 14, 2013

whether it was the version.

PaLy90 commented Mar 14, 2013

whether it was the version.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 14, 2013

Try to search the list of plugins. Scroll down to the bottom of plugins list - in my case it was at the end. I have Ubunut 12.04 with Blender 2.66 and the latest exporter and everything works correctly.

ghost commented Mar 14, 2013

Try to search the list of plugins. Scroll down to the bottom of plugins list - in my case it was at the end. I have Ubunut 12.04 with Blender 2.66 and the latest exporter and everything works correctly.

@PaLy90

This comment has been minimized.

Show comment
Hide comment
@PaLy90

PaLy90 Mar 15, 2013

should make a tutorial, but video

PaLy90 commented Mar 15, 2013

should make a tutorial, but video

@sohailiiui

This comment has been minimized.

Show comment
Hide comment
@sohailiiui

sohailiiui Apr 16, 2013

i have 3d model created in blender now my task is to import and play that 3d human model in webgl using three.js
any help plzzz

sohailiiui commented Apr 16, 2013

i have 3d model created in blender now my task is to import and play that 3d human model in webgl using three.js
any help plzzz

@anothercoder2

This comment has been minimized.

Show comment
Hide comment
@anothercoder2

anothercoder2 Jun 13, 2013

Has anyone been able to get the three.js import export addon for Blender (2.66 or 2.65) to work on Windows 7 or Windows Vista

I tried on two different computers.

On windows 7 I placed the files in (I have blender 2.65 on this machine)
E:\blender-2.65-release-windows32\blender-2.65-release-windows32\2.65\scripts\addons\io_mesh_threejs

On Windows Vista where I have blender 2.66 I placed the files in C:\Users\USERNAME\AppData\Roaming\Blender Foundation\Blender\2.66\scripts\addons

I looked in the User Preferences and can not see the addon there. I also tried the filter etc.

Please help!

anothercoder2 commented Jun 13, 2013

Has anyone been able to get the three.js import export addon for Blender (2.66 or 2.65) to work on Windows 7 or Windows Vista

I tried on two different computers.

On windows 7 I placed the files in (I have blender 2.65 on this machine)
E:\blender-2.65-release-windows32\blender-2.65-release-windows32\2.65\scripts\addons\io_mesh_threejs

On Windows Vista where I have blender 2.66 I placed the files in C:\Users\USERNAME\AppData\Roaming\Blender Foundation\Blender\2.66\scripts\addons

I looked in the User Preferences and can not see the addon there. I also tried the filter etc.

Please help!

@anothercoder2

This comment has been minimized.

Show comment
Hide comment
@anothercoder2

anothercoder2 Jun 13, 2013

See the following error if I start blender from command line

fake_module: addon missing 'bl_info' gives bad performance!: 'C:\BlenderInstall
\Blender2.66\2.66\scripts\addons\io_mesh_threejs*init*.py'

anothercoder2 commented Jun 13, 2013

See the following error if I start blender from command line

fake_module: addon missing 'bl_info' gives bad performance!: 'C:\BlenderInstall
\Blender2.66\2.66\scripts\addons\io_mesh_threejs*init*.py'

@anothercoder2

This comment has been minimized.

Show comment
Hide comment
@anothercoder2

anothercoder2 Jun 13, 2013

I figured out my problem. I had downloaded the files from github incorrectly and the python was enclosed in html tags. Have fixed that by making sure that the files only have python inside them. Now I can see the plugin and when I try to import a model I get the following error

File "C:\BlenderInstall\Blender2.66\2.66\scripts\addons\io_mesh_threejs__init__.py", line 149, in execute

return io_mesh_threejs.import_threejs.load(self, context, **self.properties)

AttributeError: 'module' object has no attribute 'load'

location: :-1

location: :-1

anothercoder2 commented Jun 13, 2013

I figured out my problem. I had downloaded the files from github incorrectly and the python was enclosed in html tags. Have fixed that by making sure that the files only have python inside them. Now I can see the plugin and when I try to import a model I get the following error

File "C:\BlenderInstall\Blender2.66\2.66\scripts\addons\io_mesh_threejs__init__.py", line 149, in execute

return io_mesh_threejs.import_threejs.load(self, context, **self.properties)

AttributeError: 'module' object has no attribute 'load'

location: :-1

location: :-1

@WestLangley

This comment has been minimized.

Show comment
Hide comment
@WestLangley

WestLangley Jun 13, 2013

Collaborator

As stated in the guidelines, help requests should be directed to stackoverflow. This board is for bugs and feature requests.

Collaborator

WestLangley commented Jun 13, 2013

As stated in the guidelines, help requests should be directed to stackoverflow. This board is for bugs and feature requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment