提供: wiki
< Doc:2.6‎ | Manual‎ | Extensions‎ | Python
移動先: 案内検索

Page status (reviewing guidelines)

Partial page
Proposed fixes: none


Since we are working with new and improving Python API, if you have something that needs to be answered, please add it here. We will find answers from dev's if we do not know them and provide an answer here.


How can I generate a mesh object using the API?

Download this code example and run it from the Text Window.

How do I apply a modifier using the API?

 bpy.ops.object.convert(target='MESH', keep_original=False)

All the modifiers in the stack will be applied.

In case you just want to apply only the subsurf modifier and leave others alone, and create a new mesh (Old mesh will retain all its modifiers), the following code shows one way of doing it.

 for modifier in bpy.context.object.modifiers:
     if modifier.type != 'SUBSURF':
 bpy.ops.object.convert(target='MESH', '''keep_original=True''')

How do I get the world coordinates of a control vertex of a BezierCurve?

wmtx = bpy.context.active_object.matrix_world

localCoord =[0].bezier_points[1].co

worldCoord = wmtx * localCoord


More info...

How do I select/deselect the control points of a Curve

Method 1


curve = bpy.context.selected_objects[0][0].bezier_points[0].select_control_point = True[0].bezier_points[2].select_control_point = True

Method 2

Manual-Part20-scripting-faq-select-curve-control-point-method-2.png[0].bezier_points[0].select_control_point = True

More info...


How to link a mesh/object to a material?



How do I automate custom hotkeys?