Jump to content

Blender exporting positions


Recommended Posts

This may not be a useful post but I wanted to record my progress with this.


I've been trying to get a system to be able to define positions in blender and load those positions with the JSONLoader.


I believe that Three.js merges the geometries when it loads them from a json file, so discerning the original position of the object is impossible.


Loading in the .js files with "JSONLoader.load" I thought the "geometryGroups" member of geometry would be useful as it had the same length as the number of objects in my blender scene. But still to my surprise, this member always would log out blank.


So I searched for a new method. And eventually I looked to the source code and made this modification.


change this line (line number 10796 of r61):

callback( result.geometry, result.materials );

to this:

callback( result.geometry, result.materials, json );

Now I have access to the loaded json that was exported from blender.

I'm working in blender 2.66 with the respective three.js json exporter and I'm not sure if it will work with other version/exporters. I'll post my exporter if requested.


In the version of blender/json exporter that I have, it exports the bones in the json file. So to export a position all I need to do is make an armature where I want the 3d position to be recorded and now that I have access to the json object all I need to do is look through the bones for the position. You can name specific bones loaded this way in blender by twisting open the armature until you get to the "Bone" object and the double clicking it.


There may be a better way to do this, and if there is I'd like to know. Also if you can separate the meshes and move/rotate/raycast them individually after loading a json file I'd REALLY like to hear about that.

Link to comment
Share on other sites

The exporter only reads one armature, so if you want to export multiple positions you have to make them all a parent of the first armature. Also you probably cant put any animations in this json file (I'm using this just for game levels so it's not necessary).


Also remember, if you scale or rotate the original meshes, this will not affect the armature vertices extracted from the json file. Using matrices might help that.


Anyway, this is an extremely hacky way to put level design in blender. If you find an easier way, please tell me.

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...