How to know all the possible funtion to call

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Lou
Posts: 0
Joined: Thu Jun 16, 2011 10:12 am
Location: France

How to know all the possible funtion to call

Post by Lou »

Hi !


I am trying to use script. I read the documentation. I try to use the API. But I would like to know if it is possible to know what function of data are accessible at a moment.

For example :
If I want to use this function :

Code: Select all

bpy.ops.object.scale_apply
because I see that in another script...
The interpreter says that scale_apply is not posible. But where I can find all the function that I can use ?


I try : http://www.blender.org/documentation/bl ... a_release/

I found "Operators (bpy.ops)" link, so I click.
Then... I am here http://www.blender.org/documentation/bl ... y.ops.html
With a lot of functionnalities... but not tree arborescence to go in object and see what I can do...

This is my little script for my test :

Code: Select all

def addMesh(p_name, x, y, i):
    bpy.ops.mesh.primitive_cube_add(location = (x, y, 0))
    ob = bpy.context.object
    ob.name = p_name
	#change origin to have only scale up
    bpy.context.scene.cursor_location = (x, y, -1)    
    bpy.ops.object.origin_set(type = 'ORIGIN_CURSOR')
    bpy.ops.transform.resize(value=(0.5, 0.5, 7.0))
    bpy.ops.object.scale_apply()

addMesh('Mesh',0,0, 0)

Just to show you that the context is ok with what I want.
I do not want to debug my script. I just want to know if there is a tree of others to know what you can do on a node in a function call.
Yes, there are women that use Blender ^^

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv »

Calling dir( some_thing ) will give you all the attributes and methods of whatever some_thing is.

Lou
Posts: 0
Joined: Thu Jun 16, 2011 10:12 am
Location: France

Post by Lou »

Thank you !

It is perfect !
Yes, there are women that use Blender ^^

Post Reply