Blender  V2.93
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

int transform_mode_really_used (bContext *C, int mode)
 
bool transdata_check_local_center (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 (TransInfo *t, TransData *td)
 
static void constraintob_from_transdata (bConstraintOb *cob, TransData *td)
 
static void constraintRotLim (TransInfo *UNUSED(t), TransData *td)
 
void constraintSizeLim (TransInfo *t, TransData *td)
 
Transform (Rotation Utils)
void headerRotation (TransInfo *t, char str[UI_MAX_DRAW_STR], float final)
 
void ElementRotation_ex (TransInfo *t, TransDataContainer *tc, TransData *td, const float mat[3][3], const float *center)
 
void ElementRotation (TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const short around)
 
Transform (Resize Utils)
void headerResize (TransInfo *t, const float vec[3], char str[UI_MAX_DRAW_STR])
 
static void TransMat3ToSize (const float mat[3][3], const float smat[3][3], float size[3])
 
void ElementResize (TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3])
 
Transform (Frame Utils)
short getAnimEdit_SnapMode (TransInfo *t)
 
void doAnimEdit_SnapFrame (TransInfo *t, TransData *td, TransData2D *td2d, AnimData *adt, short autosnap)
 
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 ( TransInfo UNUSEDt,
TransData td 
)
static

◆ constraintSizeLim()

void constraintSizeLim ( TransInfo t,
TransData td 
)

◆ constraintTransLim()

void constraintTransLim ( TransInfo t,
TransData td 
)

◆ doAnimEdit_SnapFrame()

void doAnimEdit_SnapFrame ( TransInfo t,
TransData td,
TransData2D td2d,
AnimData adt,
short  autosnap 
)

◆ ElementResize()

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

◆ ElementRotation()

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

◆ ElementRotation_ex()

void ElementRotation_ex ( TransInfo t,
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 564 of file transform_mode.c.

References add_v3_v3(), add_v3_v3v3(), axis_angle_to_quat(), center, constraintRotLim(), constraintTransLim(), copy_v3_v3(), CTX_GPENCIL_STROKES, CTX_POSE_BONE, TransDataExtension::drot, eulO_to_mat3(), TransData::ext, TransDataContainer::imat3, TransDataExtension::iquat, TransDataExtension::irot, TransDataExtension::irotAngle, TransDataExtension::irotAxis, TransDataExtension::l_smtx, TransDataContainer::mat3, mat3_to_compatible_eulO(), mat3_to_quat(), TransData::mtx, mul_m3_fl(), 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(), 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_v3_v3(), sub_v3_v3v3(), t, T_POINTS, T_V3D_ALIGN, TD_NO_LOC, TD_PBONE_LOCAL_MTX_C, TD_PBONE_LOCAL_MTX_P, and TD_USEQUAT.

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

◆ getAnimEdit_SnapMode()

short getAnimEdit_SnapMode ( TransInfo t)

This function returns the snapping 'mode' for Animation Editors only. We cannot use the standard snapping due to NLA-strip scaling complexities.

TODO: these modifier checks should be key-mappable.

Definition at line 1049 of file transform_mode.c.

References SpaceAction::autosnap, SpaceGraph::autosnap, SpaceNla::autosnap, if(), MOD_SNAP_INVERT, SACTSNAP_FRAME, SACTSNAP_OFF, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA, and t.

Referenced by applyTimeScaleValue(), applyTimeTranslateValue(), and headerTimeTranslate().

◆ headerResize()

void headerResize ( TransInfo t,
const float  vec[3],
char  str[UI_MAX_DRAW_STR] 
)

◆ headerRotation()

void headerRotation ( TransInfo t,
char  str[UI_MAX_DRAW_STR],
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 166 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 232 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 ( 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 ( const int  mode)

◆ transform_mode_really_used()

int transform_mode_really_used ( bContext C,
int  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 891 of file transform_mode.c.

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

Referenced by ElementResize().