Closed StjerneIdioten closed 4 years ago
A possible solution might be to store LayerCollection instead of Collection as the blender object. Since this seems to have a visible_get function
https://docs.blender.org/api/current/bpy.types.LayerCollection.html
Visibility also seems to default to being 'true' if the attribute is not present. So this could be implemented to same some text in the i3d file.
Determining object visibility in blender is sort of a mess at this point since there are four ways to toggle/inspect the visibility of an object and one of them isn't available to the python API (the viewport eye aka the 'h' shortcut) It is further compounded by the fact that object visibility depends on being disabled in all collections and so on. Current implementation is to just check for "hide_viewport", but should probably be enhanced to incorporate more, maybe even make it user selectable in the exporter.
Useful discussions: https://blenderartists.org/t/show-hide-collection-blender-beta-2-80/1141768/4 https://devtalk.blender.org/t/hide-in-viewport-for-collections-in-python-api/8210/3