I personally prefere working with nested collections simply because its faster for my eye to find stuff plus you can collapse them once there are too many that you dont need anyways.
Unfortunately the original script from the course files didnt affect them so I decided to try my hand at doing it myself.
Now this took way longer than I want to admit, but I got it working.
Script(fixed) - PasteBin
(You can change what suffix you would like to use via two variables at the top of the code)
--------------
Script(old) - PasteBin
It CAN crete Duplicate collections in this old version, if they have a bone in them with the SuffixR in their name.
Hi Pascal,
The get function will return the object you are getting or "None" if it doesn't exist.
So you can do a little check to see if it already exists first.
I'm paraphrasing because I'm away from my normal machine at the moment, but....
if not get(collection):
#create the collection
#then move the bones to that collection
Hope that makes sense.
It won't create the collection with the 001 on the end of it already exists.
Hey Wayne,
unfortunately this doesnt work for me, as the .get function cannot be used standalone because its an inherited function of a structure, requiring an object to search its children. But at the same time doesnt search through the children's children.
Meaning that it has no effect on nested collections, only the top-level ones.
Meaning that if the following collection structure:
- Left L
- First L
- Middle L
- Last L
When running the script using 'if not armature.collections.get(collection)' then it will only check 'Left L' collection, not any of its children, or their children.
So I gave up on trying to find an elegant- built in solution to work with, and simply created a new function that goes over all collections manually, which might be a bit slow. But it works.
I will update the OP to include the fixed script. So no more dupe collections, yay!