Blender V4.3
transform_mode.cc File Reference
#include <cstdlib>
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_gpencil_legacy_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_string.h"
#include "BKE_constraint.h"
#include "BKE_context.hh"
#include "BLT_translation.hh"
#include "ED_sequencer.hh"
#include "transform.hh"
#include "transform_convert.hh"
#include "transform_gizmo.hh"
#include "transform_orientations.hh"
#include "transform_snap.hh"
#include "transform_mode.hh"

Go to the source code of this file.

Functions

eTfmMode transform_mode_really_used (bContext *C, eTfmMode mode)
 
bool transdata_check_local_center (const TransInfo *t, short around)
 
bool transform_mode_is_changeable (const int mode)
 
Transform Locks
void protectedTransBits (short protectflag, float vec[3])
 
static void protectedQuaternionBits (short protectflag, float quat[4], const float oldquat[4])
 
static void protectedRotateBits (short protectflag, float eul[3], const float oldeul[3])
 
static void protectedAxisAngleBits (short protectflag, float axis[3], float *angle, const float oldAxis[3], float oldAngle)
 
void protectedSizeBits (short protectflag, float size[3])
 
Transform Limits
void constraintTransLim (const TransInfo *t, const TransDataContainer *tc, TransData *td)
 
static void constraintob_from_transdata (bConstraintOb *cob, TransData *td)
 
static void constraintRotLim (const TransInfo *, TransData *td)
 
void constraintSizeLim (const TransInfo *t, const TransDataContainer *tc, TransData *td)
 
Transform (Rotation Utils)
void headerRotation (TransInfo *t, char *str, const int str_size, float final)
 
void ElementRotation_ex (const TransInfo *t, const TransDataContainer *tc, TransData *td, const float mat[3][3], const float *center)
 
void ElementRotation (const TransInfo *t, const TransDataContainer *tc, TransData *td, const float mat[3][3], const short around)
 
Transform (Resize Utils)
void headerResize (TransInfo *t, const float vec[3], char *str, const int str_size)
 
static void TransMat3ToSize (const float mat[3][3], const float smat[3][3], float size[3])
 
void ElementResize (const TransInfo *t, const TransDataContainer *tc, TransData *td, const float mat[3][3])
 
Transform Mode Initialization
static TransModeInfomode_info_get (TransInfo *t, const int mode)
 
void transform_mode_init (TransInfo *t, wmOperator *op, const int mode)
 
void transform_mode_default_modal_orientation_set (TransInfo *t, int type)
 

Function Documentation

◆ constraintob_from_transdata()

◆ constraintRotLim()

◆ constraintSizeLim()

◆ constraintTransLim()

◆ ElementResize()

◆ ElementRotation()

void ElementRotation ( const TransInfo * t,
const TransDataContainer * tc,
TransData * td,
const float mat[3][3],
const short around )

◆ ElementRotation_ex()

void ElementRotation_ex ( const TransInfo * t,
const TransDataContainer * tc,
TransData * td,
const float mat[3][3],
const float * center )

Applies values of rotation to td->loc and td->ext->quat based on a rotation matrix (mat) and a pivot (center).

Protected axis and other transform settings are taken into account.

HACK WARNING

This is some VERY ugly special case to deal with pose mode.

The problem is that mtx and smtx include each bone orientation.

That is needed to rotate each bone properly, HOWEVER, to calculate the translation component, we only need the actual armature object's matrix (and inverse). That is not all though. Once the proper translation has been computed, it has to be converted back into the bone's space.

Definition at line 559 of file transform_mode.cc.

References add_eul_euleul(), add_v3_v3(), add_v3_v3v3(), axis_angle_to_quat(), constraintRotLim(), constraintTransLim(), copy_v3_v3(), CTX_GPENCIL_STROKES, CTX_POSE_BONE, TransDataExtension::dquat, TransDataExtension::drot, eulO_to_mat3(), TransData::ext, TransInfo::flag, TransDataContainer::imat3, interp_m3_m3m3(), invert_qt_qt_normalized(), TransDataExtension::iquat, TransDataExtension::irot, TransDataExtension::irotAngle, TransDataExtension::irotAxis, is_zero_v3(), is_zero_v4(), TransDataExtension::l_smtx, TransDataContainer::mat3, mat3_to_compatible_eulO(), mat3_to_quat(), TransData::mtx, mul_m3_m3m3(), mul_m3_series, mul_m3_v3(), mul_qt_qtqt(), bGPDstroke_Runtime::multi_frame_falloff, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL, TransInfo::obedit_type, TransInfo::options, protectedAxisAngleBits(), protectedQuaternionBits(), protectedRotateBits(), protectedTransBits(), TransData::protectflag, TransDataExtension::quat, quat_to_axis_angle(), quat_to_mat3(), TransDataExtension::r_mtx, TransDataExtension::r_smtx, TransDataExtension::rot, ROT_MODE_AXISANGLE, ROT_MODE_QUAT, TransDataExtension::rotAngle, TransDataExtension::rotAxis, TransDataExtension::rotOrder, bGPDstroke::runtime, TransData::smtx, sub_eul_euleul(), sub_v3_v3(), sub_v3_v3v3(), T_POINTS, T_V3D_ALIGN, TD_NO_LOC, TD_PBONE_LOCAL_MTX_C, TD_PBONE_LOCAL_MTX_P, TD_USEQUAT, and unit_m3().

Referenced by ElementMirror(), ElementRotation(), and transdata_elem_translate().

◆ headerResize()

◆ headerRotation()

◆ mode_info_get()

◆ protectedAxisAngleBits()

static void protectedAxisAngleBits ( short protectflag,
float axis[3],
float * angle,
const float oldAxis[3],
float oldAngle )
static

This function only does the delta rotation. Axis-angle is usually internally stored as quaternions.

Definition at line 168 of file transform_mode.cc.

References axis_angle_to_eulO(), EULER_ORDER_DEFAULT, eulO_to_axis_angle(), IS_EQF, OB_LOCK_ROT4D, OB_LOCK_ROTW, OB_LOCK_ROTX, OB_LOCK_ROTY, and OB_LOCK_ROTZ.

Referenced by ElementRotation_ex().

◆ protectedQuaternionBits()

static void protectedQuaternionBits ( short protectflag,
float quat[4],
const float oldquat[4] )
static

◆ protectedRotateBits()

static void protectedRotateBits ( short protectflag,
float eul[3],
const float oldeul[3] )
static

Definition at line 151 of file transform_mode.cc.

References OB_LOCK_ROTX, OB_LOCK_ROTY, and OB_LOCK_ROTZ.

Referenced by ElementRotation_ex().

◆ protectedSizeBits()

void protectedSizeBits ( short protectflag,
float size[3] )

Definition at line 219 of file transform_mode.cc.

References OB_LOCK_SCALEX, OB_LOCK_SCALEY, and OB_LOCK_SCALEZ.

Referenced by ElementMirror(), and ElementResize().

◆ protectedTransBits()

void protectedTransBits ( short protectflag,
float vec[3] )

◆ transdata_check_local_center()

◆ transform_mode_default_modal_orientation_set()

◆ transform_mode_init()

◆ transform_mode_is_changeable()

bool transform_mode_is_changeable ( int mode)

Informs if the mode can be switched during modal.

Definition at line 66 of file transform_mode.cc.

References ELEM, TFM_EDGE_SLIDE, TFM_NORMAL_ROTATION, TFM_RESIZE, TFM_ROTATION, TFM_TRACKBALL, TFM_TRANSLATION, and TFM_VERT_SLIDE.

Referenced by transform_modal_item_poll(), and transformEvent().

◆ transform_mode_really_used()

◆ TransMat3ToSize()

static void TransMat3ToSize ( const float mat[3][3],
const float smat[3][3],
float size[3] )
static

smat is reference matrix only.

Note
this is a tricky area, before making changes see: #29633, #42444

Definition at line 916 of file transform_mode.cc.

References dot_v3v3(), and mat3_to_rot_size().

Referenced by ElementResize().