bpy_extras submodule (bpy_extras.object_utils)

bpy_extras.object_utils.add_object_align_init(context, operator)

Return a matrix using the operator settings and view context.

Parameters:
Returns:

the matrix from the context and settings.

Return type:

mathutils.Matrix

bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)

Add an object using the view context and preference to to initialize the location, rotation and layer.

Parameters:
  • context (bpy.types.Context) – The context to use.
  • obdata (valid object data type or None.) – the data used for the new object.
  • operator (bpy.types.Operator) – The operator, checked for location and rotation properties.
  • name (string) – Optional name
Returns:

the newly created object in the scene.

Return type:

bpy.types.ObjectBase

bpy_extras.object_utils.object_add_grid_scale(context)

Return scale which should be applied on object data to align it to grid scale

bpy_extras.object_utils.object_add_grid_scale_apply_operator(operator, context)

Scale an operators distance values by the grid size.

bpy_extras.object_utils.object_image_guess(obj, bm=None)

Return a single image used by the object, first checking the texture-faces, then the material.

bpy_extras.object_utils.world_to_camera_view(scene, obj, coord)

Returns the camera space coords for a 3d point. (also known as: normalized device coordinates - NDC).

Where (0, 0) is the bottom left and (1, 1) is the top right of the camera frame. values outside 0-1 are also supported. A negative ‘z’ value means the point is behind the camera.

Takes shift-x/y, lens angle and sensor size into account as well as perspective/ortho projections.

Parameters:
Returns:

a vector where X and Y map to the view plane and Z is the depth on the view axis.

Return type:

mathutils.Vector

class bpy_extras.object_utils.AddObjectHelper
view_align_update_callback(context)