|
Blender
V2.93
|
#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) |
|
static |
Definition at line 334 of file transform_mode.c.
References axis_angle_to_mat4(), eulO_to_mat4(), TransData::ext, bConstraintOb::matrix, normalize_qt_qt(), TransDataExtension::quat, quat_to_mat4(), TransDataExtension::rot, ROT_MODE_AXISANGLE, ROT_MODE_QUAT, TransDataExtension::rotAngle, TransDataExtension::rotAxis, and TransDataExtension::rotOrder.
Referenced by constraintRotLim().
Definition at line 362 of file transform_mode.c.
References BKE_constraint_typeinfo_from_type(), TransData::con, CONSTRAINT_DISABLE, CONSTRAINT_OFF, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_WORLD, CONSTRAINT_TYPE_ROTLIMIT, constraintob_from_transdata(), data, bConstraint::data, ELEM, bConstraint::enforce, bConstraintTypeInfo::evaluate_constraint, TransData::ext, bConstraint::flag, if(), LIMIT_TRANSFORM, mat4_to_axis_angle(), mat4_to_eulO(), mat4_to_quat(), bConstraintOb::matrix, TransData::mtx, mul_m4_m3m4(), bConstraint::next, NULL, bConstraint::ownspace, TransDataExtension::quat, TransDataExtension::rot, ROT_MODE_AXISANGLE, ROT_MODE_QUAT, TransDataExtension::rotAngle, TransDataExtension::rotAxis, TransDataExtension::rotOrder, TransData::smtx, and bConstraint::type.
Referenced by ElementRotation_ex().
Definition at line 435 of file transform_mode.c.
References BKE_constraint_typeinfo_from_type(), TransData::con, CON_APPLY, CONSTRAINT_DISABLE, CONSTRAINT_OFF, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_WORLD, CONSTRAINT_TYPE_SIZELIMIT, data, bConstraint::data, bConstraint::enforce, bConstraintTypeInfo::evaluate_constraint, TransData::ext, fabsf, bConstraint::flag, LIMIT_TRANSFORM, mat4_to_size(), bConstraintOb::matrix, TransData::mtx, mul_m4_m3m4(), mul_v3_v3(), bConstraint::next, NULL, bConstraint::ownspace, signf(), TransDataExtension::size, size_to_mat4(), TransData::smtx, t, TD_SINGLESIZE, and bConstraint::type.
Referenced by ElementMirror(), and ElementResize().
Definition at line 251 of file transform_mode.c.
References BKE_constraint_targets_for_solving_get(), BKE_constraint_typeinfo_from_type(), BLI_freelistN(), TransData::con, CONSTRAINT_DISABLE, CONSTRAINT_OFF, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_WORLD, CONSTRAINT_TYPE_DISTLIMIT, CONSTRAINT_TYPE_LOCLIMIT, copy_v3_v3(), data, bConstraint::data, bConstraint::enforce, bConstraintTypeInfo::evaluate_constraint, bConstraint::flag, float(), if(), LIMIT_TRANSFORM, LIMITDIST_TRANSFORM, bConstraintOb::matrix, TransData::mtx, mul_m4_m3m4(), bConstraint::next, NULL, bConstraint::ownspace, TransData::smtx, t, bConstraint::type, and unit_m4().
Referenced by applyProject(), applyTranslationValue(), ElementMirror(), ElementResize(), and ElementRotation_ex().
| void doAnimEdit_SnapFrame | ( | TransInfo * | t, |
| TransData * | td, | ||
| TransData2D * | td2d, | ||
| AnimData * | adt, | ||
| short | autosnap | ||
| ) |
Definition at line 1096 of file transform_mode.c.
References BKE_nla_tweakedit_remap(), TransData2D::h1, TransData2D::h2, TransData2D::ih1, TransData2D::ih2, TransData::ival, NLATIME_CONVERT_MAP, NLATIME_CONVERT_UNMAP, SACTSNAP_OFF, snapFrameTransform(), SPACE_SEQ, t, TD_MOVEHANDLE1, TD_MOVEHANDLE2, and TransData::val.
Referenced by applyTimeScaleValue(), and applyTimeTranslateValue().
| void ElementResize | ( | TransInfo * | t, |
| TransDataContainer * | tc, | ||
| TransData * | td, | ||
| float | mat[3][3] | ||
| ) |
Definition at line 909 of file transform_mode.c.
References add_v3_v3(), add_v3_v3v3(), applyNumInput(), TransData::axismtx, center, TransDataContainer::center_local, CLAMP_MIN, CON_APPLY, constraintSizeLim(), constraintTransLim(), copy_m3_m3(), copy_v3_v3(), CTX_GPENCIL_STROKES, CTX_MOVIECLIP, CTX_OBJECT, CTX_POSE_BONE, ELEM, TransData::ext, TransData::factor, TransDataExtension::isize, TransData::ival, mat3_to_size(), TransData::mtx, mul_m3_m3m3(), mul_m3_v3(), mul_mat3_m4_v3(), mul_v3_fl(), bGPDstroke_Runtime::multi_frame_falloff, Object::obmat, TransDataContainer::poseobj, protectedSizeBits(), protectedTransBits(), TransData::protectflag, bGPDstroke::runtime, TransDataExtension::size, TransData::smtx, sub_v3_v3(), sub_v3_v3v3(), t, T_EDIT, T_POINTS, T_V3D_ALIGN, TC_OBJECT, TC_OBJECT_TEXSPACE, TC_POSE, TC_SCULPT, TD_INDIVIDUAL_SCALE, TD_SINGLESIZE, transdata_check_local_center(), transform_snap_increment(), TransMat3ToSize(), and TransData::val.
Referenced by applyResize().
| void ElementRotation | ( | TransInfo * | t, |
| TransDataContainer * | tc, | ||
| TransData * | td, | ||
| float | mat[3][3], | ||
| const short | around | ||
| ) |
Definition at line 794 of file transform_mode.c.
References center, TransDataContainer::center_local, ElementRotation_ex(), t, and transdata_check_local_center().
Referenced by applyAlign(), applyRotationValue(), applyTrackballValue(), and Bend().
| 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().
| 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().
Definition at line 814 of file transform_mode.c.
References BLI_snprintf(), CON_APPLY, hasNumInput(), NUM_STR_REP_LEN, outputNumInput(), str, t, T_2D_EDIT, T_PROP_EDIT_ALL, TIP_, and UI_MAX_DRAW_STR.
Referenced by applyResize(), and applySkinResize().
Definition at line 527 of file transform_mode.c.
References BLI_snprintf(), Freestyle::c, hasNumInput(), NUM_STR_REP_LEN, outputNumInput(), RAD2DEGF, str, t, T_PROP_EDIT_ALL, TIP_, and UI_MAX_DRAW_STR.
Referenced by applyNormalRotation(), and applyRotation().
|
static |
Definition at line 181 of file transform_mode.c.
References angle(), 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().
|
static |
Definition at line 111 of file transform_mode.c.
References eul_to_quat(), mul_qt_fl(), normalize_qt_qt(), OB_LOCK_ROT4D, OB_LOCK_ROTW, OB_LOCK_ROTX, OB_LOCK_ROTY, OB_LOCK_ROTZ, and quat_to_eul().
Referenced by ElementRotation_ex().
Definition at line 166 of file transform_mode.c.
References OB_LOCK_ROTX, OB_LOCK_ROTY, and OB_LOCK_ROTZ.
Referenced by ElementRotation_ex().
| 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().
| void protectedTransBits | ( | short | protectflag, |
| float | vec[3] | ||
| ) |
Definition at line 97 of file transform_mode.c.
References OB_LOCK_LOCX, OB_LOCK_LOCY, and OB_LOCK_LOCZ.
Referenced by applyTranslationValue(), ElementMirror(), ElementResize(), and ElementRotation_ex().
| bool transdata_check_local_center | ( | TransInfo * | t, |
| short | around | ||
| ) |
Definition at line 71 of file transform_mode.c.
References CTX_MASK, CTX_MOVIECLIP, CTX_OBJECT, CTX_PAINT_CURVE, CTX_POSE_BONE, ELEM, OB_ARMATURE, OB_CURVE, OB_GPENCIL, OB_MBALL, OB_MESH, SPACE_GRAPH, t, and V3D_AROUND_LOCAL_ORIGINS.
Referenced by applyShear(), applyToSphere(), ElementMirror(), ElementResize(), ElementRotation(), and to_sphere_radius_update().
| void transform_mode_default_modal_orientation_set | ( | TransInfo * | t, |
| int | type | ||
| ) |
When in modal nad not set, initializes a default orientation for the mode.
Definition at line 1283 of file transform_mode.c.
References BLI_assert, ED_transform_calc_orientation_from_type_ex(), ELEM, NULL, RGN_TYPE_WINDOW, SPACE_VIEW3D, t, T_MODAL, transform_orientations_current_set(), type, V3D_ORIENT_GLOBAL, and V3D_ORIENT_VIEW.
Referenced by initNormalRotation(), initResize(), initRotation(), initShear(), and initTranslation().
| void transform_mode_init | ( | TransInfo * | t, |
| wmOperator * | op, | ||
| const int | mode | ||
| ) |
Definition at line 1139 of file transform_mode.c.
References ELEM, initAlign(), initBakeTime(), initBend(), initBevelWeight(), initBoneEnvelope(), initBoneRoll(), initBoneSize(), initCrease(), initCurveShrinkFatten(), initEdgeSlide_ex(), initGPOpacity(), initGPShrinkFatten(), initMaskShrinkFatten(), initMirror(), initNormalRotation(), initPushPull(), initResize(), initRotation(), initSeqSlide(), initShear(), initShrinkFatten(), initSkinResize(), initTilt(), initTimeScale(), initTimeSlide(), initTimeTranslate(), initToSphere(), initTrackball(), initTranslation(), initVertSlide_ex(), mesh_customdatacorrect_init(), wmOperator::ptr, RNA_boolean_get(), SPACE_GRAPH, SPACE_NLA, t, TC_MESH_VERTS, TFM_ALIGN, TFM_BAKE_TIME, TFM_BEND, TFM_BONE_ENVELOPE, TFM_BONE_ENVELOPE_DIST, TFM_BONE_ROLL, TFM_BONESIZE, TFM_BWEIGHT, TFM_CREASE, TFM_CURVE_SHRINKFATTEN, TFM_EDGE_SLIDE, TFM_GPENCIL_OPACITY, TFM_GPENCIL_SHRINKFATTEN, TFM_MASK_SHRINKFATTEN, TFM_MIRROR, TFM_NORMAL_ROTATION, TFM_PUSHPULL, TFM_RESIZE, TFM_ROTATION, TFM_SEQ_SLIDE, TFM_SHEAR, TFM_SHRINKFATTEN, TFM_SKIN_RESIZE, TFM_TILT, TFM_TIME_DUPLICATE, TFM_TIME_EXTEND, TFM_TIME_SCALE, TFM_TIME_SLIDE, TFM_TIME_TRANSLATE, TFM_TOSPHERE, TFM_TRACKBALL, TFM_TRANSLATION, and TFM_VERT_SLIDE.
Referenced by initTransform(), and transformEvent().
| bool transform_mode_is_changeable | ( | const int | mode | ) |
Definition at line 82 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().
| int transform_mode_really_used | ( | bContext * | C, |
| int | mode | ||
| ) |
Definition at line 54 of file transform_mode.c.
References ARM_ENVELOPE, BLI_assert, C, CTX_data_active_object(), Object::data, bArmature::drawtype, OB_ARMATURE, TFM_BONE_ENVELOPE_DIST, TFM_BONESIZE, TFM_RESIZE, and Object::type.
Referenced by initTransform().
smat is reference matrix only.
Definition at line 891 of file transform_mode.c.
References dot_v3v3(), mat3_to_rot_size(), and size().
Referenced by ElementResize().