firetools / blenderfds

The open user interface for the NIST Fire Dynamics Simulator (FDS)
https://blenderfds.org
GNU General Public License v3.0
41 stars 10 forks source link

[beta1] Blender Collection instances are not exported #32

Open emanuelegissi opened 2 years ago

emanuelegissi commented 2 years ago

Currently Blender Collection instances are not exported to the FDS case. This is rather easy to fix.

Here is a basic demo on how to append all object names in selection as well as the object names of the selected collection instances to one list and and count the items:

import bpy
C = bpy.context
objs = []
for ob in C.selected_objects:    
    if ob.instance_type == 'COLLECTION':
        for ob_col in ob.instance_collection.objects:
            objs.append(ob_col.name)
    else:
        objs.append(ob.name)
print ("{} objects in selection".format(len(objs)))

I am also wondering if collection.children_recursive gets Collection instances.