I'm not sure if this type of question belongs here, but I'm trying to write a simple add-on that exports game assets to FBX files based on collections. Each collection becomes a separate file. But an issue is that I don't want to process the root collection.
Now I am very new to python (started yesterday), and have not yet figured out how to iterate Blender's collections, so this may not be necessary. But I have a feeling the iteration will be linear (not hierarchy based). So I'm wondering if there is a way to identify the primary scene root collection of a scene? Would I just compare its name to "Scene Collection"? This seems like a bad way of handling it, but that's the best I have at the moment. On the other hand, if the very first collection of Blender's collection list is always the root, that might make it easier.
In case I find any Blender python developers willing to help, I had a couple other questions regarding Blender and python in general. FYI, I come from a decently strong C++ background with absolutely no python experience..
Does python use spacing, tabs, and end of lines as part of its syntax? Really strange how this works. So for example, how does the python interpreter know where a for loop body starts and ends? Just based on spacing and indentation?
Several add-ons appear to be assigning their own made-up variables to blender object types. Such as
bpy.types.Scene.myVariable = make_pointer(MyObject)or
bpy.types.Object.myBool = BoolProperty(..).. Does a simple line such as this create a new variable in the class type that the addon can use as custom data? If so, how do they not conflict with each other?
scene = bpy.context.scene- I'm assuming this type of code does not copy the entire scene to a new instance, but rather copies the variable that represents a reference to the scene? Something like that?
if obj.name in scene.objects:- Really curious as to what this is doing exactly. It almost looks like it is using the name property of the object to search in the scene list of objects for that specific name string. Is that the case? If so, wow.
Thanks for any assistance. I know I should be learning to use python correctly before I start diving into building a Blender add-on. Hoping I can get away with knowing just enough to pull this off.