Blender  V3.3
Macros | Functions
transform_orientations.c File Reference
#include <ctype.h>
#include <stddef.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_armature_types.h"
#include "DNA_curve_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_editmesh.h"
#include "BKE_layer.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BLT_translation.h"
#include "ED_armature.h"
#include "SEQ_select.h"
#include "transform.h"
#include "transform_orientations.h"

Go to the source code of this file.

Macros

#define SEL_F1   (1 << 0)
 
#define SEL_F2   (1 << 1)
 
#define SEL_F3   (1 << 2)
 

Functions

void BIF_clearTransformOrientation (bContext *C)
 
static TransformOrientationfindOrientationName (ListBase *lb, const char *name)
 
static bool uniqueOrientationNameCheck (void *arg, const char *name)
 
static void uniqueOrientationName (ListBase *lb, char *name)
 
static TransformOrientationcreateViewSpace (bContext *C, ReportList *UNUSED(reports), const char *name, const bool overwrite)
 
static TransformOrientationcreateObjectSpace (bContext *C, ReportList *UNUSED(reports), const char *name, const bool overwrite)
 
static TransformOrientationcreateBoneSpace (bContext *C, ReportList *reports, const char *name, const bool overwrite)
 
static TransformOrientationcreateCurveSpace (bContext *C, ReportList *reports, const char *name, const bool overwrite)
 
static TransformOrientationcreateMeshSpace (bContext *C, ReportList *reports, const char *name, const bool overwrite)
 
bool transform_orientations_create_from_axis (float mat[3][3], const float x[3], const float y[3], const float z[3])
 
bool createSpaceNormal (float mat[3][3], const float normal[3])
 
bool createSpaceNormalTangent (float mat[3][3], const float normal[3], const float tangent[3])
 
bool BIF_createTransformOrientation (bContext *C, ReportList *reports, const char *name, const bool use_view, const bool activate, const bool overwrite)
 
TransformOrientationaddMatrixSpace (bContext *C, float mat[3][3], const char *name, const bool overwrite)
 
void BIF_removeTransformOrientation (bContext *C, TransformOrientation *target)
 
void BIF_removeTransformOrientationIndex (bContext *C, int index)
 
void BIF_selectTransformOrientation (bContext *C, TransformOrientation *target)
 
int BIF_countTransformOrientation (const bContext *C)
 
void applyTransformOrientation (const TransformOrientation *ts, float r_mat[3][3], char r_name[64])
 
static int armature_bone_transflags_update_recursive (bArmature *arm, ListBase *lb, const bool do_it)
 
void ED_transform_calc_orientation_from_type (const bContext *C, float r_mat[3][3])
 
short ED_transform_calc_orientation_from_type_ex (const Scene *scene, ViewLayer *view_layer, const View3D *v3d, const RegionView3D *rv3d, Object *ob, Object *obedit, const short orientation_index, const int pivot_point, float r_mat[3][3])
 
short transform_orientation_matrix_get (bContext *C, TransInfo *t, short orient_index, const float custom[3][3], float r_spacemtx[3][3])
 
const char * transform_orientations_spacename_get (TransInfo *t, const short orient_type)
 
void transform_orientations_current_set (TransInfo *t, const short orient_index)
 
static uint bm_mesh_elems_select_get_n__internal (BMesh *bm, BMElem **elems, const uint n, const BMIterType itype, const char htype)
 
static uint bm_mesh_verts_select_get_n (BMesh *bm, BMVert **elems, const uint n)
 
static uint bm_mesh_edges_select_get_n (BMesh *bm, BMEdge **elems, const uint n)
 
int getTransformOrientation_ex (ViewLayer *view_layer, const View3D *v3d, struct Object *ob, struct Object *obedit, float normal[3], float plane[3], const short around)
 
int getTransformOrientation (const bContext *C, float normal[3], float plane[3])
 
void ED_getTransformOrientationMatrix (ViewLayer *view_layer, const View3D *v3d, Object *ob, Object *obedit, const short around, float r_orientation_mat[3][3])
 

Macro Definition Documentation

◆ SEL_F1

#define SEL_F1   (1 << 0)

◆ SEL_F2

#define SEL_F2   (1 << 1)

◆ SEL_F3

#define SEL_F3   (1 << 2)

Function Documentation

◆ addMatrixSpace()

TransformOrientation* addMatrixSpace ( bContext C,
float  mat[3][3],
const char *  name,
const bool  overwrite 
)

◆ applyTransformOrientation()

void applyTransformOrientation ( const TransformOrientation ts,
float  r_mat[3][3],
char  r_name[64] 
)

◆ armature_bone_transflags_update_recursive()

static int armature_bone_transflags_update_recursive ( bArmature arm,
ListBase lb,
const bool  do_it 
)
static

◆ BIF_clearTransformOrientation()

void BIF_clearTransformOrientation ( bContext C)

◆ BIF_countTransformOrientation()

int BIF_countTransformOrientation ( const bContext C)

◆ BIF_createTransformOrientation()

bool BIF_createTransformOrientation ( bContext C,
ReportList reports,
const char *  name,
const bool  use_view,
const bool  activate,
const bool  overwrite 
)

◆ BIF_removeTransformOrientation()

void BIF_removeTransformOrientation ( bContext C,
TransformOrientation target 
)

◆ BIF_removeTransformOrientationIndex()

void BIF_removeTransformOrientationIndex ( bContext C,
int  index 
)

◆ BIF_selectTransformOrientation()

void BIF_selectTransformOrientation ( bContext C,
TransformOrientation target 
)

◆ bm_mesh_edges_select_get_n()

static uint bm_mesh_edges_select_get_n ( BMesh bm,
BMEdge **  elems,
const uint  n 
)
static

◆ bm_mesh_elems_select_get_n__internal()

static uint bm_mesh_elems_select_get_n__internal ( BMesh bm,
BMElem **  elems,
const uint  n,
const BMIterType  itype,
const char  htype 
)
static

◆ bm_mesh_verts_select_get_n()

static uint bm_mesh_verts_select_get_n ( BMesh bm,
BMVert **  elems,
const uint  n 
)
static

◆ createBoneSpace()

static TransformOrientation* createBoneSpace ( bContext C,
ReportList reports,
const char *  name,
const bool  overwrite 
)
static

◆ createCurveSpace()

static TransformOrientation* createCurveSpace ( bContext C,
ReportList reports,
const char *  name,
const bool  overwrite 
)
static

◆ createMeshSpace()

static TransformOrientation* createMeshSpace ( bContext C,
ReportList reports,
const char *  name,
const bool  overwrite 
)
static

◆ createObjectSpace()

static TransformOrientation* createObjectSpace ( bContext C,
ReportList UNUSEDreports,
const char *  name,
const bool  overwrite 
)
static

◆ createSpaceNormal()

bool createSpaceNormal ( float  mat[3][3],
const float  normal[3] 
)

◆ createSpaceNormalTangent()

bool createSpaceNormalTangent ( float  mat[3][3],
const float  normal[3],
const float  tangent[3] 
)
Note
To recreate an orientation from the matrix:
  • (plane == mat[1])
  • (normal == mat[2])

Definition at line 304 of file transform_orientations.c.

References cross_v3_v3v3(), is_zero_v3(), negate_v3_v3(), normal, normalize_v3(), and normalize_v3_v3().

Referenced by createBoneSpace(), createCurveSpace(), createMeshSpace(), createTransCurveVerts(), ED_getTransformOrientationMatrix(), and transform_convert_mesh_islands_calc().

◆ createViewSpace()

static TransformOrientation* createViewSpace ( bContext C,
ReportList UNUSEDreports,
const char *  name,
const bool  overwrite 
)
static

◆ ED_getTransformOrientationMatrix()

void ED_getTransformOrientationMatrix ( ViewLayer view_layer,
const View3D v3d,
Object ob,
Object obedit,
const short  around,
float  r_orientation_mat[3][3] 
)

◆ ED_transform_calc_orientation_from_type()

void ED_transform_calc_orientation_from_type ( const bContext C,
float  r_mat[3][3] 
)

◆ ED_transform_calc_orientation_from_type_ex()

short ED_transform_calc_orientation_from_type_ex ( const Scene scene,
ViewLayer view_layer,
const View3D v3d,
const RegionView3D rv3d,
Object ob,
Object obedit,
const short  orientation_index,
const int  pivot_point,
float  r_mat[3][3] 
)

◆ findOrientationName()

static TransformOrientation* findOrientationName ( ListBase lb,
const char *  name 
)
static

Definition at line 65 of file transform_orientations.c.

References BLI_findstring().

Referenced by addMatrixSpace(), and uniqueOrientationNameCheck().

◆ getTransformOrientation()

int getTransformOrientation ( const bContext C,
float  normal[3],
float  plane[3] 
)

◆ getTransformOrientation_ex()

int getTransformOrientation_ex ( ViewLayer view_layer,
const View3D v3d,
struct Object ob,
struct Object obedit,
float  normal[3],
float  plane[3],
const short  around 
)

Logic explained:

  • Edges and vert-pairs treated the same way.
  • Point the Y axis along the edge vector (towards the active vertex).
  • Point the Z axis outwards (the same direction as the normals).
Note
Z points outwards - along the normal. take care making changes here, see: T38592, T43708

Definition at line 747 of file transform_orientations.c.

References Freestyle::a, bArmature::act_edbone, add_v3_v3(), add_v3_v3v3(), armature_bone_transflags_update_recursive(), BASE_SELECTED, Nurb::bezt, BKE_curve_editNurbs_get(), BKE_curve_nurb_vert_active_get(), BKE_editmesh_from_object(), BKE_nurb_bezt_calc_normal(), BKE_nurb_bezt_calc_plane(), BKE_nurb_bpoint_calc_normal(), BKE_nurb_bpoint_calc_plane(), BKE_nurb_bpoint_get_next(), BKE_nurb_bpoint_get_prev(), BKE_pose_channel_active_if_layer_visible(), BKE_view_layer_base_find(), BLI_assert, BMEditMesh::bm, BM_EDGE, BM_edge_calc_length_squared(), BM_edge_exists(), BM_edge_is_boundary(), BM_edge_ordered_verts(), BM_edge_other_vert(), BM_editselection_normal(), BM_editselection_plane(), BM_elem_flag_test, BM_ELEM_SELECT, BM_FACE, BM_face_calc_tangent_auto(), BM_FACES_OF_MESH, BM_ITER_MESH, BM_mesh_active_vert_get(), bm_mesh_edges_select_get_n(), bm_mesh_verts_select_get_n(), BM_select_history_active_get(), BM_VERT, BM_vert_edge_pair(), BM_vert_tri_calc_tangent_edge(), BM_VERTS_OF_MESH, bPoseChannel::bone, BONE_CONNECTED, BONE_ROOTSEL, BONE_SELECTED, BONE_TIPSEL, BONE_TRANSFORM, bArmature::bonebase, Nurb::bp, bPose::chanbase, BMVert::co, copy_m3_m4(), copy_v3_v3(), CU_BEZIER, CURVE_HANDLE_NONE, Object::data, dot_v3v3(), e, ED_armature_ebone_to_mat3(), bArmature::edbo, MetaBall::editelems, ELEM, BezTriple::f1, BPoint::f1, BezTriple::f2, BezTriple::f3, ListBase::first, EditBone::flag, Bone::flag, MetaElem::flag, View3DOverlay::handle_display, BMEditSelection::htype, invert_m3_m3(), is_zero_v3(), BMEdge::l, l, MetaBall::lastelem, EditBone::layer, bArmature::layer, LIKELY, Object::mode, mul_m3_v3(), mul_mat3_m4_v3(), negate_v3(), EditBone::next, bPoseChannel::next, Nurb::next, MetaElem::next, BMVert::no, BMFace::no, normal, normal_tri_v3(), normalize_v3(), NULL, OB_ARMATURE, OB_CURVES_LEGACY, OB_MBALL, OB_MESH, OB_MODE_ALL_PAINT, OB_MODE_PARTICLE_EDIT, OB_MODE_POSE, OB_SURF, Object::obmat, ORIENTATION_EDGE, ORIENTATION_FACE, ORIENTATION_NONE, ORIENTATION_NORMAL, ORIENTATION_VERT, ortho_v3_v3(), View3D::overlay, EditBone::parent, Nurb::pntsu, Nurb::pntsv, Object::pose, bPoseChannel::pose_mat, project_plane_normalized_v3_v3v3(), project_v3_v3v3(), MetaElem::quat, quat_to_mat3(), result, SEL_F1, SEL_F2, SEL_F3, SELECT, sub_v3_v3(), sub_v3_v3v3(), SWAP, BMesh::totedgesel, BMesh::totfacesel, BMesh::totvertsel, transpose_m3(), Nurb::type, Object::type, UNLIKELY, BMLoop::v, v, BMEdge::v1, BMEdge::v2, V3D_AROUND_ACTIVE, V3D_AROUND_LOCAL_ORIGINS, BezTriple::vec, BPoint::vec, and zero_v3().

Referenced by ED_getTransformOrientationMatrix(), and getTransformOrientation().

◆ transform_orientation_matrix_get()

short transform_orientation_matrix_get ( struct bContext C,
struct TransInfo t,
short  orient_index,
const float  custom[3][3],
float  r_spacemtx[3][3] 
)

◆ transform_orientations_create_from_axis()

bool transform_orientations_create_from_axis ( float  mat[3][3],
const float  x[3],
const float  y[3],
const float  z[3] 
)

◆ transform_orientations_current_set()

void transform_orientations_current_set ( TransInfo t,
const short  orient_index 
)

◆ transform_orientations_spacename_get()

const char* transform_orientations_spacename_get ( TransInfo t,
const short  orient_type 
)

◆ uniqueOrientationName()

static void uniqueOrientationName ( ListBase lb,
char *  name 
)
static

◆ uniqueOrientationNameCheck()

static bool uniqueOrientationNameCheck ( void arg,
const char *  name 
)
static

Definition at line 70 of file transform_orientations.c.

References findOrientationName(), and NULL.

Referenced by uniqueOrientationName().