BabylonJS / BlenderExporter

Exports From Blender to Babylon.JS in JSON / .babylon format
Apache License 2.0
292 stars 48 forks source link

Add ability to only export selected objects #51

Closed ghempton closed 3 years ago

ghempton commented 3 years ago

This is useful for us to have a scene with multiple assets we'd like saved as individual files. Adds a simple option to the export dialog:

image

When selected, only the current selection is used in the export.

Palmer-JC commented 3 years ago

While the exporter currently uses collections to select which things to export, and that is more powerful if there are a bunch of things you wish to keep but not export, this does not seem to counter dict that.

All the custom properties the exporter uses are in the properties section though. This allows changing on a mesh / material / light / camera basis. For scene wide stuff, I was putting stuff in World. Here is World for 2.93: world

Putting this in World, right after Animation Section would be more consistent.

ghempton commented 3 years ago

Hmm I could move it there, I was trying to be consistent with other exporters (.fbx, .gltf, etc.) which have some restrictions in the export dialog.

The main use case for us is to use the babylon exporter as part of a script where we want to export each object in a scene as an individual .babylon file for loading as separate assets in our app. For this purpose, it feels more natural to have this as a property of the operation.

I also think that having this particular setting as a property of the world is less than ideal since it would make the export less deterministic (since its dependent on the current selection).

Palmer-JC commented 3 years ago

Ok, I was thinking about setting things up such that changes could both be fine grained & SAVABLE. Clearly, you would not want save the 'only selected objects' setting.

I merge this early this week, Tues at latest.

ghempton commented 3 years ago

👍