1
$\begingroup$

I am new to Blender scripting and relatively new to Python (I do betterin Java). I am using this doc while I work, among others:

https://www.blender.org/api/blender_python_api_2_60_1/mathutils.html

And my question is, essentially, about the layout/convention of this doc. Where are the constructors explained (or __init__ functions, if you will)?

I mean, I can see the examples of, say, instantiating a Vector or Euler with a tuple of 3 floats. But are these the only arguments the constructor can take? Are there conversion constructors? What is the order of axes the Euler constructor takes as arguments?

It feels very odd to have to deduct this information from code examples. Am I missing something? It may be just me, because I haven't spent a lot of time with Python docs this seems to be modelled after (like I have with Oracle docs).

$\endgroup$
3
$\begingroup$

I see, in that api_doc there is info about class functions but not how you can construct that class.

Go into python console and type the class name, follow with ( and hit CtrlSpace. It will hint what it wants:

enter image description here

It's however not the only way to create (get) that object. Numerous other functions or classes can return Euler:

Quaternion.to_euler()
Matrix.to_euler()

And you can get those also in many ways.

Btw. always use the up-to-date docs version: https://www.blender.org/api/blender_python_api_2_77_0/mathutils.html

This new version has the constructor infos there.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.