Handy Blender add-on to export selected path (mesh) vertices

With the help of ChatGPT I made a small Blender add-on to export selected path (mesh) vertices to JSON format as a float array.

I’d looked around for something that does exactly this, and also tried just grabbing the vertex data from other ASCII export formats like OBJ, PLY and DAE, but those options were simply not convenient. Also, I don’t think the Babylon.js exporter for Blender works with the latest Blender versions and, if I recall, it only exports meshes that have faces (not path meshes which are only comprised of vertices).

For Blender paths/curves, you’ll need to ensure those are converted to mesh before they can be exported.

Install

  • Blender > Edit menu > Preferences > Add-ons > Install from Disk …

Usage

  • Create path meshes
  • Select paths/meshes to export
  • Blender > File menu > Export > Selected Mesh Vertices (.json)
  • Choose desired export options (+Y Up etc)
  • Save file
  • Paste vertex float array into your Babylon.js application
  • Write a small function to convert to Vector3 array (if necessary)

exportSelectedVerticesJson.zip (1.7 KB)

2 Likes

I like this one! :heart_eyes:

Now we have a Blender Curve to BabylonJS GreasedLine tool available :smiley:

How is this working?

1 Like

Nice @roland! :heart_eyes:

Nice because of you!

So I tried to import an SVG into Blender: (elevator icon)

Do you think you and your AI friend could add an option to somehow export this as vertices-islands (each group of vertices in a separate array)? It would be absolutely amazing .

Maybe … :slight_smile:

Or .. you could just split them into different meshes in Blender before selecting and exporting them all at once!

Nah, too much hassle :smiley:

Might be an interesting challenge for me and ChatGPT though!

Go go go! :see_no_evil_monkey:

Let me see if ChatGPT can give me a quick win … or an abject failure - there doesn’t seem to be any in-between :smiley:

Patiently waiting… :wink:

I’ll tell ChatGPT to hurry up :slight_smile:

@roland my first attempt to have ChatGPT modify the script, to separate path islands, failed :frowning:

I’ll try to revisit again when I have a bit more time.

What icon set is that elevator icon from? When I import Lucide icon SVGs they import as separate meshes rather than one joined mesh, so in the case of Lucide, there’s no need to separate.

Never mind buddy!

Thanks for sharing the add-on! It’ll come handy whenever I’ll need to export a curved path.

1 Like