v0.1
Note
This is an alpha version.
Fuel is a Blender library for rapid developing. All methods are designed as idiomatic minimum components to understand a Blender API system quickly. Any suggestons to make this library more pragmatic and useful are always welcomed.
TODO
override_context
(area_name)¶Make a specific context and return it.
Parameters: | area_name – str (VIEW_3D , TIMELINE , GRAPH_EDITOR , DOPESHEET_EDITOR , NLA_EDITOR , IMAGE_EDITOR , SEQUENCE_EDITOR , CLIP_EDITOR , TEXT_EDITOR , NODE_EDITOR , LOGIC_EDITOR , PROPERTIES , OUTLINER , USER_PREFERENCES , INFO , FILE_BROWSER , CONSOLE ) |
---|---|
Return type: | bpy_types.Context |
print_to_console
(txt)¶Print a text to the console window.
Parameters: | txt – str |
---|
get_region_window_size_context
()¶Get width and height of window in the context.
Return type: | int , int |
---|
get_viewport_loc_context
()¶Get a location of viewport camera in the context.
Return type: | Vector or NoneType |
---|
get_viewports_loc
(screen_name)¶Get locations of all viewport cameras in a screen.
Parameters: | screen_name – str (ex. 3D View Full, Animation, Compositing, Default, Game Logic, Motion Tracking, Scripting, UV Editing, Video Editing) |
---|---|
Return type: | List of Vector or NoneType |
get_area_context
()¶Get an area in the context.
Return type: | bpy.types.Area |
---|
get_areas_context
()¶Get all areas of screen in the context.
Return type: | bpy_prop_collection of bpy.types.Area |
---|
get_screen_name_context
()¶Get a screen name in the context.
Return type: | str |
---|
get_screen
(screen_name)¶Get a screen.
Parameters: | screen_name – str |
---|---|
Return type: | bpy.types.Screen |
get_areas
(screen_name)¶Get all areas in a screen.
Parameters: | screen_name – str (ex. 3D View Full, Animation, Compositing, Default, Game Logic, Motion Tracking, Scripting, UV Editing, Video Editing) |
---|---|
Return type: | bpy_prop_collection of bpy.types.Area |
get_area
(screen_name, area_name)¶Get an area in a screen.
Parameters: |
|
---|---|
Return type: |
|
get_view3d_space_context
()¶Get space of VIEW_3D
in the context.
Return type: | bpy_prop_collection of bpy.types.SpaceView3D or NoneType |
---|
get_space
(area_name, screen_name)¶Get a specific area’s space in a screen.
Parameters: |
|
---|
get_space_context
(area_name)¶Get a specific area’s space in the current screen.
Parameters: | area_name – str (VIEW_3D , TIMELINE , GRAPH_EDITOR , DOPESHEET_EDITOR , NLA_EDITOR , IMAGE_EDITOR , SEQUENCE_EDITOR , CLIP_EDITOR , TEXT_EDITOR , NODE_EDITOR , LOGIC_EDITOR , PROPERTIES , OUTLINER , USER_PREFERENCES , INFO , FILE_BROWSER , CONSOLE ) |
---|
get_view3d_space
(screen_name)¶Get space of VIEW_3D
in a screen.
Parameters: | screen_name – str (ex. 3D View Full, Animation, Compositing, Default, Game Logic, Motion Tracking, Scripting, UV Editing, Video Editing) |
---|---|
Note: | if spaces have VIEW_3D , bpy_prop_collection contains CONSOLE at last. |
Return type: | bpy_prop_collection of bpy.types.SpaceView3D or NoneType |
get_regions
(area_name, screen_name)¶Get regions in a specific area and screen.
Parameters: |
|
---|
get_regions_context
(area_name)¶Get regions in a specific area of the current screen.
Parameters: | area_name – str (VIEW_3D , TIMELINE , GRAPH_EDITOR , DOPESHEET_EDITOR , NLA_EDITOR , IMAGE_EDITOR , SEQUENCE_EDITOR , CLIP_EDITOR , TEXT_EDITOR , NODE_EDITOR , LOGIC_EDITOR , PROPERTIES , OUTLINER , USER_PREFERENCES , INFO , FILE_BROWSER , CONSOLE ) |
---|
get_view3d_regions_context
()¶Get regions of VIEW_3D
in the context. Types of regions are HEADER
, TOOLS
, TOOL_PROPS
, UI
, WINDOW
.
Return type: | bpy_prop_collection of bpy.types.Region or NoneType |
---|
get_view3d_regions
(screen_name)¶Get regions of VIEW_3D
in a screen. Types of regions are HEADER
, TOOLS
, TOOL_PROPS
, UI
, WINDOW
.
Parameters: | screen_name – str (ex. 3D View Full, Animation, Compositing, Default, Game Logic, Motion Tracking, Scripting, UV Editing, Video Editing) |
---|---|
Return type: | bpy_prop_collection of bpy.types.Region or NoneType |
get_rv3d_context
()¶Get region_3d(rv3d) of VIEW_3D
in the context.
Return type: | RegionView3D or NoneType |
---|
get_rv3d
(screen_name)¶Get region_3d(rv3d) of VIEW_3D
in the context.
Parameters: | screen_name – str (ex. 3D View Full, Animation, Compositing, Default, Game Logic, Motion Tracking, Scripting, UV Editing, Video Editing) |
---|---|
Return type: | RegionView3D or NoneType |
get_addon_prefs
()¶Get an object of Addon Preferences.
Returns: | An object which contains values in AddonPreferences if it has values. |
---|
get_keymap_item
(km, kmi_idname)¶Get a keymap item.
Parameters: |
|
---|---|
Return type: |
|
get_active_object
()¶Get an active object.
Return type: | bpy_types.Object or NoneType |
---|
get_visible_objects
()¶Get visible objects.
Return type: | list of bpy_types.Object or NoneType |
---|
get_objects
()¶Get all objects.
Return type: | list of bpy_types.Object or NoneType |
---|
get_selected_objects
()¶Get selected objects.
Return type: | list of bpy_types.Object or NoneType |
---|
move_origin
(ob, new_origin)¶Move a location of origin.
Parameters: |
|
---|
pivot_ob_around_vec
(ob, v_origin, v_target, degrees)¶Move an object around a vector.
Parameters: |
|
---|
at
¶Pivot object at a specific center.
Method: | __init__(self, ob, center_pos) Initialization.
|
||||||
---|---|---|---|---|---|---|---|
Method: | rotate(self, euler) Rotation.
|
||||||
Method: | move(self. dst_pos) Move to dst_pos from center_pos.
|
apply_all_modifiers
()¶Apply all modifiers to selected objects.
force_edit_mode
()¶Change to Edit Mode.
force_object_mode
()¶Change to Object Mode.
force_sculpt_mode
()¶Change to Sculpt Mode.
force_vertex_paint_mode
()¶Change to Vertex Paint Mode.
force_weight_paint_mode
()¶Change to Weight Paint Mode.
force_texture_paint_mode
()¶Change to Texture Paint Mode.
toggle_object
()¶Toggle a current mode.
get_modifier_items
(ob)¶Get all modifier items of an object.
Parameters: | ob – bpy_types.Object |
---|
setup_bvh
(bmesh)¶Set up a bvh tree.
Parameters: | bmesh – BMesh |
---|---|
Return type: | BVHTree |
make_bmesh
(ob)¶Make bmesh.
Parameters: | ob – bpy_types.Object |
---|---|
Return type: | BMesh |
make_bmesh_from_objects
(obs_list)¶Make bmeshs from objects with matrixes.
Parameters: | obs_list – list of bpy_types.Object |
---|---|
Return type: | BMesh , (Matrix , (int(num of verts) , int(num of edges) int(num of faces) , int(num of loops) )) |
apply_bmesh
(bm, ob)¶Apply a bmesh to an object. Then delete the bmesh.
Parameters: |
|
---|
make_edit_bmesh
()¶Make a bmesh from an object in Edit Mode.
Return type: | BMesh |
---|
update_edit_bmesh
()¶Apply a bmesh to an object in Edit Mode.
get_selected_verts
(ob)¶Get selected vertices.
Note: | If you need to get selected vertices in Edit Mode which means realtime selection, use bmesh. |
---|---|
Parameters: | ob – bpy_types.Object |
Return type: | bpy_prop_collection of bpy.types.MeshVertex or NoneType |
get_verts_from_object
(ob)¶Get all vertices from an object.
Parameters: | ob – bpy_types.Object |
---|---|
Return type: | list of bpy_types.MeshVertex or NoneType |
get_edges_from_object
(ob)¶Get all edges from an object.
Parameters: | ob – bpy_types.Object |
---|---|
Return type: | list of bpy_types.MeshEdge or NoneType |
get_faces_from_object
(ob)¶Get all faces from an object.
Parameters: | ob – bpy_types.Object |
---|---|
Return type: | list of bpy_types.MeshPolygon or NoneType |
get_all_edges_lco_from_object
(ob)¶Get all edges local coordinates from object.
Parameters: | ob – bpy_types.Object |
---|---|
Return type: | list of 2 length tuple of Vector or NoneType |
get_edge_keys_from_face
(face)¶Get all edge keys from a face.
Parameters: | face – bpy_types.MeshPolygon |
---|---|
Return type: | 2 length tuple of int |
get_edge_from_edge_key
(ob, edge_key)¶Get an edge from an edge key.
Parameters: |
|
---|---|
Return type: |
|
get_verts_from_edge_key
(ob, edge_key)¶Get vertices from an edge key.
Parameters: |
|
---|---|
Return type: |
|
get_verts_from_face
(ob, face)¶Get all vertices from a face.
Parameters: |
|
---|---|
Return type: |
|
get_verts_from_edge
(ob, edge)¶Get all vertices from an edge.
Parameters: |
|
---|---|
Return type: |
|
get_normal_from_face
(face)¶Get a normal from a face.
Parameters: | face – bpy_types.MeshPolygon |
---|---|
Return type: | Vector |
get_bound_edge_keys_from_faces
(faces)¶Get bound edges.
Parameters: | faces – list of bpy_types.MeshPolygon |
---|---|
Return type: | list of bpy_types.MeshEdge or NoneType |
get_bedges_from_bvert
(bvert)¶Get edges link to a vertex in a bmesh.
Parameters: | bvert – BMVert |
---|---|
Return type: | BMElemSeq of BMEdge |
get_bfaces_from_bvert
(bvert)¶Get faces link to a vertex in a bmesh.
Parameters: | bvert – BMVert |
---|---|
Return type: | BMElemSeq of BMFace |
get_bfaces_from_bedge
(bedge)¶Get faces link to an edge in a bmesh.
Parameters: | bedge – BMEdge |
---|---|
Return type: | BMElemSeq of BMFace |
edge_intersect
(ob, edge_ob, edge)¶Check an edge intersects a face of an object.
Parameters: |
|
---|---|
Return type: |
|
get_center_wco
(ob)¶Get a center location of an object in the world space.
Parameters: | ob – bpy_types.Object |
---|---|
Return type: | Vector |
Note
If you want to use radian based trigonometric function, use defalut math
module.
vec_distance
(org, dst)¶Get a distance of two points.
Parameters: |
|
---|---|
Return type: |
|
make_quat
(axis_vec, degrees)¶Make a quaternion to rotate around an axis vector.
Parameters: |
|
---|---|
Return type: |
|
dot
(vec1, vec2)¶Dot function.
Parameters: |
|
---|---|
Return type: |
|
cross
(vec1, vec2)¶Cross function. The order is vec1 X vec2.
Parameters: |
|
---|---|
Return type: |
|
sin
(degrees)¶sine function.
Parameters: | degrees – int or float |
---|---|
Return type: | float |
cos
(degrees)¶cosine function.
Parameters: | degrees – int or float |
---|---|
Return type: | float |
tan
(degrees)¶tangent function.
Parameters: | degrees – int or float |
---|---|
Return type: | float |
asin
(ratio)¶arc sine function.
Parameters: | ratio – int or float |
---|---|
Return type: | float |
acos
(ratio)¶arc cosine function.
Parameters: | ratio – int or float |
---|---|
Return type: | float |
atan
(ratio)¶arc tangent function.
Parameters: | ratio – int or float |
---|---|
Return type: | float |
pivotx
(vec, degrees)¶pivot a vector around x axis.
Parameters: |
|
---|---|
Return type: |
|
pivoty
(vec, degrees)¶pivot a vector around y axis.
Parameters: |
|
---|---|
Return type: |
|
pivotz
(vec, degrees)¶pivot a vector around z axis.
Parameters: |
|
---|---|
Return type: |
|
pivot_around_vec
(vec, axis_vec_origin, axis_vec_target, degrees)¶pivot around a given axis vector.
Parameters: |
|
---|---|
Return type: |
|
get_lookat_matrix
(direction_vec, origin_vec, up_vec = (0, 0, 1))¶Get a lookat matrix.
Parameters: |
|
---|---|
Return type: |
|
draw_line
(start, end, cl = (0, 0, 0, 1) width = 1.0)¶Draw a line.
Parameters: |
|
---|
draw_line_strip
(verts, cl = (0, 0, 0, 1), width = 1.0)¶Draw a line strip.
Parameters: |
|
---|
draw_line_loop
(verts, cl = (0, 0, 0, 1), width = 1.0)¶Draw a line loop.
Parameters: |
|
---|
draw_triangle
(triangle, cl = (0, 0, 0, 1), width = 1.0)¶Draw a triangle.
Parameters: |
|
---|
draw_triangles
(triangle, cl = (0, 0, 0, 1), width = 1.0)¶Draw a triangle.
Parameters: |
|
---|
draw_triangle_strip
(triangle_strip, cl = (0, 0, 0, 1), width = 1.0)¶Draw a triangle strip.
Parameters: |
|
---|
draw_triangle_fan
(start_vert, other_verts, cl = (0, 0, 0, 1), width = 1.0)¶Draw a triangle fan.
Parameters: |
|
---|
draw_quad
(quad, cl = (0, 0, 0, 1), width = 1.0)¶Draw a quad.
Parameters: |
|
---|
draw_quads
(quads, cl = (0, 0, 0, 1), width = 1.0)¶Draw quads.
Parameters: |
|
---|
draw_quad_strip
(vertical_edges, cl = (0, 0, 0, 1), width = 1.0)¶Draw a quad strip.
Parameters: |
|
---|
draw_polygon
(polygon, cl = (0, 0, 0, 1), width = 1.0)¶Draw a polygon.
Parameters: |
|
---|
draw_circle_2d
(origin, radius, points, cl = (0, 9, 0, 1))¶Draw a 2D circle.
Parameters: |
|
---|
draw_quad_2d
(quad2d, cl = (0, 0, 0, 1), width = 1.0)¶Draw a 2D quad.
Parameters: |
|
---|
draw_rect_2d_1
(top_left, bottom_right, cl = (0, 0, 0, 1), width = 1.0)¶Draw a rectangle.
Parameters: |
|
---|
draw_rect_2d_2
(center, rect_width, rect_height, cl = (0, 0, 0, 1), width = 1.0)¶Draw a rectangle.
Parameters: |
|
---|
kozmof