neumicha / Blender2Helios

Blender addon to convert a blender scene to a Helios scene (LiDAR simulation, 3D point clouds)
GNU General Public License v3.0
17 stars 7 forks source link

Export function iterates over all objects in .blend file #3

Closed justus-hildebrand closed 1 year ago

justus-hildebrand commented 4 years ago

I'm trying to convert this file to benchmark HELIOS: blender classroom demo scene

While trying to run the blender2helios export, the script crashes when accessing objects in scenes that are not currently selected. This hints that the script does not access the current scene's object tree but instead the file's object collection.

Is this intended or should it only go over context.scene.objects or maybe context.view_layer.objects?

neumicha commented 4 years ago

Dear Justus, you are right that Blender2Helios uses collections (bpy.data.collections). This happens here: https://github.com/neumicha/Blender2Helios/blob/61d65fa9446a50ad0f52e5e948c1613e08b005e9/Blender2Helios.py#L153 A few lines later it loops through the objects of the current collection: https://github.com/neumicha/Blender2Helios/blob/61d65fa9446a50ad0f52e5e948c1613e08b005e9/Blender2Helios.py#L156

The reason why I used the collections is that most users may see them as the easiest way to "group" objects. By putting multiple objects into one collection, Blender2Helios is able (if enabled in the settings) to override the materials. Example: The exported obj file of a car gets the material "car" as it belonged to the collection "car". By exploiting this we can create semantically labeled point clouds with Helios.

Does this information help? Maybe you know a better and user-friendly way to "group" semantically similar objects?

Anyway, possible solutions for you: