Blender  V3.3
Functions
transform_mode.c File Reference
#include <stdlib.h>
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_nla.h"
#include "RNA_access.h"
#include "UI_interface.h"
#include "BLT_translation.h"
#include "transform.h"
#include "transform_convert.h"
#include "transform_orientations.h"
#include "transform_snap.h"
#include "transform_mode.h"

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, TransData *td)
 
static void constraintob_from_transdata (bConstraintOb *cob, TransData *td)
 
static void constraintRotLim (const TransInfo *UNUSED(t), TransData *td)
 
void constraintSizeLim (const TransInfo *t, 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
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()

static void constraintob_from_transdata ( bConstraintOb cob,
TransData td 
)
static

◆ constraintRotLim()

static void constraintRotLim ( const TransInfo UNUSEDt,
TransData td 
)
static

◆ constraintSizeLim()

void constraintSizeLim ( const TransInfo t,
TransData td 
)

◆ constraintTransLim()

void constraintTransLim ( const TransInfo t,
TransData td 
)

◆ ElementResize()

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

◆ 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 542 of file transform_mode.c.

References add_eul_euleul(), add_v3_v3(), add_v3_v3v3(), axis_angle_to_quat(), center, constraintRotLim(), constraintTransLim(), copy_v3_v3(), CTX_GPENCIL_STROKES, CTX_POSE_BONE, TransDataExtension::dquat, TransDataExtension::drot, eulO_to_mat3(), TransData::ext, if(), 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, 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, 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()

void headerResize ( TransInfo t,
const float  vec[3],
char *  str,
const int  str_size 
)

◆ headerRotation()

void headerRotation ( TransInfo t,
char *  str,
int  str_size,
float  final 
)

◆ protectedAxisAngleBits()

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

◆ 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 149 of file transform_mode.c.

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 215 of file transform_mode.c.

References OB_LOCK_SCALEX, OB_LOCK_SCALEY, OB_LOCK_SCALEZ, and size().

Referenced by ElementMirror(), and ElementResize().

◆ protectedTransBits()

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

◆ transdata_check_local_center()

bool transdata_check_local_center ( const TransInfo t,
short  around 
)

◆ transform_mode_default_modal_orientation_set()

void transform_mode_default_modal_orientation_set ( TransInfo t,
int  type 
)

◆ transform_mode_init()

void transform_mode_init ( TransInfo t,
wmOperator op,
const int  mode 
)

◆ transform_mode_is_changeable()

bool transform_mode_is_changeable ( int  mode)

Informs if the mode can be switched during modal.

Definition at line 65 of file transform_mode.c.

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

Referenced by transform_modal_item_poll(), and transformEvent().

◆ transform_mode_really_used()

eTfmMode transform_mode_really_used ( bContext C,
eTfmMode  mode 
)

◆ 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: T29633, T42444

Definition at line 889 of file transform_mode.c.

References dot_v3v3(), mat3_to_rot_size(), and size().

Referenced by ElementResize().