Skip to content

Transformations

3DBubble edited this page Oct 24, 2020 · 8 revisions

Transformations

[ improvement needed ]

Multi-Purpose Functions

Multipurpose functions provides a range of features in one command, depending on what argument you provide them. This means the following functions can be used to both get and set transformation data on objects.

location(ref, loc)

This function is used to set or get the location of a provided object.

  • If only ref is provided, it will return the location of the object.
  • If both ref and loc are provided, then it will set the location of the object to the location provided (expects a list of 3 values for X, Y and Z).
  • If only loc is provided, then it will set the location of the actively selected object (found with active_object()) to the provided location.
  • If no arguments are provided, then it will get the location of the actively selected object (found with active_object()).

Parameters :

  • ref (String Name | Reference) : Object reference
  • loc (Vector) : Coordinates of point in global space represented by list of 3 values

Returns : None | Vector Location

rotation(ref, rot)

This function is used to set or get the rotation of a provided object.

  • If only ref is provided, it will return the rotation of the object.
  • If both ref and rot are provided, then it will set the euler rotation of the object to the rotation provided (expects a list of 3 values for X, Y and Z).
  • If only rot is provided, then it will set the euler rotation of the actively selected object (found with active_object()) to the provided rotation.
  • If no arguments are provided, then it will get the euler rotation of the actively selected object (found with active_object()).

Parameters :

  • ref (String Name | Reference) : Object reference
  • rot (Euler) : Euler rotation to be assigned to object

Returns : None | Euler Rotation

scale(ref, scale)

  • If only ref is provided, it will return the scale of the object.
  • If both ref and scale are provided, then it will set the scale of the object to the scale provided (expects a list of 3 values for X, Y and Z).
  • If only scale is provided, then it will set the scale of the actively selected object (found with active_object()) to the provided scale.
  • If no arguments are provided, then it will get the scale of the actively selected object (found with active_object()).

Parameters :

  • ref (String Name | Reference) : Object reference
  • scale (Vector) : Scaling Vector

Returns : None | Vector Scale


Applying Transformations

apply_location(ref)

Applies the location of the object. The equivalent of calling bpy.ops.object.transform_apply(location=True, rotation=False, scale=False).

Parameters :

  • ref (String Name | Reference) : Object reference

apply_rotation(ref)

Applies the rotation of the object. The equivalent of calling bpy.ops.object.transform_apply(location=False, rotation=True, scale=False).

Parameters :

  • ref (String Name | Reference) : Object reference

apply_scale(ref)

Applies the scale of the object. The equivalent of calling bpy.ops.object.transform_apply(location=False, rotation=False, scale=True).

Parameters :

  • ref (String Name | Reference) : Object reference

apply_all_transforms(ref)

Applies the location, rotation and scale of the object. The equivalent of calling bpy.ops.object.transform_apply(location=True, rotation=True, scale=True).

Parameters :

  • ref (String Name | Reference) : Object reference

apply_rotation_and_scale(ref)

Applies the rotation and scale of the object. The equivalent of calling bpy.ops.object.transform_apply(location=False, rotation=True, scale=True).

Parameters :

  • ref (String Name | Reference) : Object reference

Translations

translate_vector(vec, ref)

Translates objects by given vector in global coordinates

Parameters :

  • vec* (Vector) : List of 3 values or mathutils.Vector
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

translate_along_axis(val, axis, ref)

Translates ref objects by val along global axis specified with a list of 3 values.

Parameters :

  • val* (float) : Value
  • axis* (Vector) : List of 3 values or mathutils.Vector to represent direction
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

Convenience functions :

  • move_along_axis(val, axis, ref)

translate_along_x(val, ref)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

Convenience functions :

  • move_along_x(val, ref)
  • translate_along_global_x(val, ref)
  • move_along_global_x(val, ref)
  • translate_in_x(val, ref)
  • move_in_x(val, ref)

translate_along_y(val, ref)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

Convenience functions :

  • move_along_y(val, ref)
  • translate_along_global_y(val, ref)
  • move_along_global_y(val, ref)
  • translate_in_y(val, ref)
  • move_in_y(val, ref)

translate_along_z(val, ref)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

Convenience functions :

  • move_along_z(val, ref)
  • translate_along_global_z(val, ref)
  • move_along_global_z(val, ref)
  • translate_in_z(val, ref)
  • move_in_z(val, ref)

translate_along_local_axis(val, axis, ref)

Parameters :

  • val* (float) : Value
  • axis* (Vector) : List of 3 values or mathutils.Vector to represent direction
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

translate_along_local_x(val, ref)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

Convenience functions :

  • move_along_local_x(val, ref)

translate_along_local_y(val, ref)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

Convenience functions :

  • move_along_local_y(val, ref)

translate_along_local_z(val, ref)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

Convenience functions:

  • move_along_local_z(val, ref)

Rotations

rotate_vector(vec, ref)

Parameters :

  • vec* (Vector) : List of 3 values or mathutils.Vector
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

rotate_around_axis(deg, axis, ref, point)

Rotates ref objects by deg arounf global axis specified with a list of 3 values, about pivot point

Parameters :

  • deg* (float) : Angle
  • axis* (Vector) : List of 3 values or mathutils.Vector to represent direction
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

rotate_around_global_x(deg, ref, point)

Parameters :

  • deg* (float) : Angle
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

Convenience functions :

  • rotate_around_x(deg, ref, point)
  • rotate_in_x(deg, ref, point)

rotate_around_global_y(deg, ref, point)

Parameters :

  • deg* (float) : Angle
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

Convenience functions:

  • rotate_around_y(deg, ref, point)
  • rotate_in_y(deg, ref, point)

rotate_around_global_z(deg, ref, point)

Parameters :

  • deg* (float) : Angle
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

Convenience functions:

  • rotate_around_z(deg, ref, point)
  • rotate_in_z(deg, ref, point)

rotate_around_local_axis(deg, axis, ref, point)

Parameters :

  • deg* (float) : Angle
  • axis* (Vector) : List of 3 values or mathutils.Vector to represent direction
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

rotate_around_local_x(deg, ref, point)

Parameters :

  • deg* (float) : Angle
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

rotate_around_local_y(deg, ref, point)

Parameters :

  • deg* (float) : Angle
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

rotate_around_local_z(deg, ref, point)

Parameters :

  • deg* (float) : Angle
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

Scaling

Scaling functions work in local coordinates by default.

scale_vector(vec, ref)

Scale ref objects by vec vector (list of 3 vales) in respective local axis

Parameters :

  • vec* (Vector) : List of 3 values or mathutils.Vector
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

scale_uniform(val, ref)

Scale ref objects uniformly by val in local axes

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.

scale_along_axis(val, axis, ref, point)

Scale ref objects by vel local axis specified with a list of 3 values, about pivot point

Parameters :

  • val* (float) : Value
  • axis* (Vector) : List of 3 values or mathutils.Vector to represent direction of local axis
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

scale_along_x(val, ref, point)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

Convenience functions :

  • scale_along_local_x(val, ref, point)
  • scale_in_x(val, ref, point)

scale_along_y(val, ref, point)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

Convenience functions :

  • scale_along_local_x(val, ref, point)
  • scale_in_x(val, ref, point)

scale_along_z(val, ref, point)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

Convenience functions :

  • scale_along_local_x(val, ref, point)
  • scale_in_x(val, ref, point)

scale_along_global_axis(val, axis, ref, point)

Parameters :

  • val* (float) : Value
  • axis* (Vector) : List of 3 values or mathutils.Vector to represent direction of local axis
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

scale_along_global_x(val, ref, point)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

scale_along_global_y(val, ref, point)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

scale_along_global_z(val, ref, point)

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

scale_perpendicular_to_x(val, ref, point)

A behaviour similar to S > Shift + X

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

scale_perpendicular_to_y(val, ref, point)

A behaviour similar to S > Shift + Y

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point

scale_perpendicular_to_z(val, ref, point)

A behaviour similar to S > Shift + Z

Parameters :

  • val* (float) : Value
  • ref (String Name | Reference | List) : Accepts a string name or object reference. Can also accept lists of names or references.
  • point (Vector) : List of 3 values or mathutils.Vector to represent pivot point
Clone this wiki locally