Hello friends, I’m trying to clean up my job folders and I’m trying to be careful about what I delete. At the same time I’m trying to make asset libraries of actions. So I need to go through and make some spreadsheets of all actions.
It seems like it would be a simple script but I’m way too ignorant of python. Is there a script, or would it be easy to make a script that would print all action names in a file so I could copy/paste?
So far I’ve been able to find
bpy.data.actions.items()
which gives me a list, but I’m looking to refine that list because it gives me a lot that I don’t need; it’s comma separated but each entry contains text I’d like to clean out of the list, for instance
[(‘action_name’, bpy.data.actions[‘action_name’])
would be much more useful as simply
action_name
for the purpose of being able to paste into a spreadsheet.
import re
a = re.split(r',', str(bpy.data.actions.items()))
b = re.findall(r'\'.*?\'', str(a))
c = str(b).replace("'","")
c = c.replace("[","")
c = c.replace("]","")
c = c.replace("\"","")
d = re.split(r',', c)
del d[::2]
print(d)
So as it stands now I can get it to work in the python console which is grand. But I’m really curious about how I could make it into a script. If I try and run it in the text editor, it throws an error. I tried inserting an import bpy at the beginning and that didn’t help.
I can use it as a text file that I copy and paste into the console. Is there a way I can turn it into a text file/script that I could run in the text editor? This is pure curiosity, I already have a useful solution thanks to you.