6
$\begingroup$

Let's say I want to create a new bone constraint in a script. Blender then tells me that it wants to know which type of constraint I want to create.

Can I print a list of all possible types? I know I could reverse engineer the names by creating the constraints and reading the types, but I'd like to have a more general solution.

So, is there something like print(dir()) that does the job?

$\endgroup$

2 Answers 2

5
$\begingroup$

To answer your question, you can print a list like this:

print(bpy.types.Constraint.bl_rna.properties["type"].enum_items.keys())

But in this case I'd suggest to use Blenders documentation.

Note that this is Blender specific, Python doesn't provide a way to list possible valid values for an attribute.

$\endgroup$
4
$\begingroup$

If all you need is an enumeration of available constraints, it's listed in bpy.types.Constraint API documentation.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .