|
Blender V4.3
|
#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 TransModeInfo * | mode_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) |
|
static |
Definition at line 328 of file transform_mode.cc.
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 356 of file transform_mode.cc.
References BKE_constraint_typeinfo_from_type(), TransData::con, CONSTRAINT_DISABLE, CONSTRAINT_OFF, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_WORLD, CONSTRAINT_TYPE_ROTLIMIT, constraintob_from_transdata(), bConstraint::data, ELEM, bConstraint::enforce, bConstraintTypeInfo::evaluate_constraint, TransData::ext, bConstraint::flag, LIMIT_TRANSFORM, mat4_to_axis_angle(), mat4_to_eulO(), mat4_to_quat(), bConstraintOb::matrix, TransData::mtx, mul_m4_m3m4(), bConstraint::next, 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().
| void constraintSizeLim | ( | const TransInfo * | t, |
| const TransDataContainer * | tc, | ||
| TransData * | td ) |
Definition at line 429 of file transform_mode.cc.
References BKE_constraint_typeinfo_from_type(), TransData::con, TransInfo::con, CON_APPLY, CONSTRAINT_DISABLE, CONSTRAINT_OFF, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_WORLD, CONSTRAINT_TYPE_SIZELIMIT, bConstraint::data, bConstraint::enforce, bConstraintTypeInfo::evaluate_constraint, TransData::ext, fabsf, bConstraint::flag, TransDataContainer::imat3, LIMIT_TRANSFORM, TransDataContainer::mat3, mat4_to_size(), bConstraintOb::matrix, TransCon::mode, TransData::mtx, mul_m4_m3m4(), mul_v3_v3(), bConstraint::next, bConstraint::ownspace, signf(), TransDataExtension::size, size_to_mat4(), TransData::smtx, TD_SINGLESIZE, and bConstraint::type.
Referenced by ElementMirror(), and ElementResize().
| void constraintTransLim | ( | const TransInfo * | t, |
| const TransDataContainer * | tc, | ||
| TransData * | td ) |
Definition at line 238 of file transform_mode.cc.
References add_v3_v3(), BKE_constraint_custom_object_space_init(), BKE_constraint_targets_for_solving_get(), BKE_constraint_typeinfo_from_type(), BLI_freelistN(), RenderData::cfra, TransData::con, CONSTRAINT_DISABLE, CONSTRAINT_OFF, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_WORLD, CONSTRAINT_TYPE_DISTLIMIT, CONSTRAINT_TYPE_LOCLIMIT, copy_v3_v3(), bConstraint::data, TransInfo::depsgraph, bConstraint::enforce, bConstraintTypeInfo::evaluate_constraint, bConstraint::flag, float, LIMIT_TRANSFORM, LIMITDIST_TRANSFORM, TransDataContainer::mat, bConstraintOb::matrix, TransData::mtx, mul_m3_v3(), bConstraint::next, bConstraint::ownspace, Scene::r, TransInfo::scene, TransData::smtx, sub_v3_v3(), bConstraint::type, unit_m4(), and TransDataContainer::use_local_mat.
Referenced by ElementMirror(), ElementResize(), ElementRotation_ex(), transdata_elem_translate(), and transform_snap_project_individual_apply().
| void ElementResize | ( | const TransInfo * | t, |
| const TransDataContainer * | tc, | ||
| TransData * | td, | ||
| const float | mat[3][3] ) |
Definition at line 934 of file transform_mode.cc.
References add_v3_v3(), add_v3_v3v3(), applyNumInput(), TransCon::applySize, TransInfo::around, TransData::axismtx, TransDataContainer::center_local, TransInfo::con, CON_APPLY, constraintSizeLim(), constraintTransLim(), copy_m3_m3(), copy_v3_v3(), copy_v4_v4(), CTX_GPENCIL_STROKES, CTX_MOVIECLIP, CTX_OBJECT, CTX_POSE_BONE, TransInfo::data_type, ELEM, TransData::ext, fabs(), TransData::factor, TransInfo::flag, interpf(), TransDataExtension::isize, mat3_to_size(), max_ff(), TransCon::mode, TransData::mtx, mul_m3_m3m3(), mul_m3_v3(), mul_mat3_m4_v3(), mul_v3_fl(), bGPDstroke_Runtime::multi_frame_falloff, TransInfo::num, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL, TransInfo::obedit_type, TransInfo::options, TransDataContainer::poseobj, protectedSizeBits(), protectedTransBits(), TransData::protectflag, bGPDstroke::runtime, TransDataExtension::size, TransData::smtx, sub_v3_v3(), sub_v3_v3v3(), T_EDIT, T_POINTS, T_V3D_ALIGN, TD_INDIVIDUAL_SCALE, TD_SINGLESIZE, TransConvertType_Object, TransConvertType_ObjectTexSpace, TransConvertType_Pose, TransConvertType_Sculpt, transdata_check_local_center(), transform_snap_increment(), TransMat3ToSize(), and TransInfo::values_final.
Referenced by applyResize(), and element_resize_fn().
| void ElementRotation | ( | const TransInfo * | t, |
| const TransDataContainer * | tc, | ||
| TransData * | td, | ||
| const float | mat[3][3], | ||
| const short | around ) |
Definition at line 814 of file transform_mode.cc.
References TransDataContainer::center_local, ElementRotation_ex(), and transdata_check_local_center().
Referenced by applyAlign(), transdata_elem_bend(), transdata_elem_rotate(), and transdata_elem_trackball().
| 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().
Definition at line 839 of file transform_mode.cc.
References BLI_snprintf(), BLI_snprintf_rlen(), TransInfo::con, CON_APPLY, TransInfo::flag, hasNumInput(), NumInput::idx_max, IFACE_, TransCon::mode, TransInfo::num, NUM_STR_REP_LEN, outputNumInput(), TransInfo::prop_size, TransInfo::proptext, TransInfo::scene, str, T_2D_EDIT, T_PROP_EDIT_ALL, TransCon::text, and Scene::unit.
Referenced by applyResize(), and applySkinResize().
Used by Transform Rotation and Transform Normal Rotation.
Definition at line 532 of file transform_mode.cc.
References BLI_snprintf_rlen(), TransInfo::con, TransInfo::flag, hasNumInput(), IFACE_, TransInfo::num, NUM_STR_REP_LEN, outputNumInput(), TransInfo::prop_size, TransInfo::proptext, RAD2DEGF, TransInfo::scene, str, T_PROP_EDIT_ALL, TransCon::text, and Scene::unit.
Referenced by applyNormalRotation(), and applyRotation().
|
static |
Definition at line 1110 of file transform_mode.cc.
References ELEM, SPACE_GRAPH, SPACE_NLA, TransInfo::spacetype, TFM_ALIGN, TFM_BAKE_TIME, TFM_BEND, TFM_BONE_ENVELOPE, TFM_BONE_ENVELOPE_DIST, TFM_BONE_ROLL, TFM_BONESIZE, TFM_BWEIGHT, TFM_CURVE_SHRINKFATTEN, TFM_EDGE_CREASE, 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_EXTEND, TFM_TIME_SCALE, TFM_TIME_SLIDE, TFM_TIME_TRANSLATE, TFM_TOSPHERE, TFM_TRACKBALL, TFM_TRANSLATION, TFM_VERT_CREASE, TFM_VERT_SLIDE, TransMode_align, TransMode_baketime, TransMode_bboneresize, TransMode_bend, TransMode_bevelweight, TransMode_boneenvelope, TransMode_boneroll, TransMode_curveshrinkfatten, TransMode_edgecrease, TransMode_edgeslide, TransMode_gpopacity, TransMode_gpshrinkfatten, TransMode_maskshrinkfatten, TransMode_mirror, TransMode_pushpull, TransMode_resize, TransMode_rotate, TransMode_rotatenormal, TransMode_seqslide, TransMode_shear, TransMode_shrinkfatten, TransMode_skinresize, TransMode_tilt, TransMode_timescale, TransMode_timeslide, TransMode_timetranslate, TransMode_tosphere, TransMode_trackball, TransMode_translate, TransMode_vertcrease, and TransMode_vertslide.
Referenced by transform_mode_init().
|
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().
|
static |
Definition at line 96 of file transform_mode.cc.
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 151 of file transform_mode.cc.
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 219 of file transform_mode.cc.
References OB_LOCK_SCALEX, OB_LOCK_SCALEY, and OB_LOCK_SCALEZ.
Referenced by ElementMirror(), and ElementResize().
| void protectedTransBits | ( | short | protectflag, |
| float | vec[3] ) |
Definition at line 82 of file transform_mode.cc.
References OB_LOCK_LOCX, OB_LOCK_LOCY, and OB_LOCK_LOCZ.
Referenced by ElementMirror(), ElementResize(), ElementRotation_ex(), and transdata_elem_translate().
| bool transdata_check_local_center | ( | const TransInfo * | t, |
| short | around ) |
Definition at line 55 of file transform_mode.cc.
References CTX_MASK, CTX_MOVIECLIP, CTX_OBJECT, CTX_PAINT_CURVE, CTX_POSE_BONE, CTX_SEQUENCER_IMAGE, ELEM, OB_ARMATURE, OB_CURVES_LEGACY, OB_GPENCIL_LEGACY, OB_MBALL, OB_MESH, TransInfo::obedit_type, TransInfo::options, SPACE_GRAPH, TransInfo::spacetype, and V3D_AROUND_LOCAL_ORIGINS.
Referenced by apply_shear_value(), applyToSphere(), clip_uv_transform_resize(), ElementMirror(), ElementResize(), ElementRotation(), and to_sphere_radius_update().
When in modal and not set, initializes a default orientation for the mode.
Definition at line 1215 of file transform_mode.cc.
References BLI_assert, ED_transform_calc_orientation_from_type_ex(), ELEM, TransInfo::flag, TransInfo::is_orient_default_overwrite, TransInfo::matrix, O_DEFAULT, TransInfo::orient, TransInfo::orient_curr, TransInfo::region, ARegion::regiondata, ARegion::regiontype, RGN_TYPE_WINDOW, TransInfo::scene, SPACE_VIEW3D, TransInfo::spacetype, T_MODAL, transform_orientations_current_set(), TransInfo::type, V3D_AROUND_CENTER_BOUNDS, V3D_ORIENT_GLOBAL, V3D_ORIENT_VIEW, TransInfo::view, and TransInfo::view_layer.
Referenced by initNormalRotation(), initResize(), initRotation(), initShear(), and initTranslation().
| void transform_mode_init | ( | TransInfo * | t, |
| wmOperator * | op, | ||
| const int | mode ) |
Definition at line 1188 of file transform_mode.cc.
References TransInfo::context, TransInfo::data_type, TransInfo::flag, TransModeInfo::flags, TransModeInfo::init_fn, TransInfo::mode, TransInfo::mode_info, mode_info_get(), sequencer_retiming_mode_is_active(), SPACE_SEQ, TransInfo::spacetype, TransConvertType_Mesh, transform_convert_mesh_customdatacorrect_init(), transform_gizmo_3d_model_from_constraint_and_mode_set(), and TransMode_translate.
Referenced by initTransform(), transform_mode_snap_source_init(), and transformEvent().
| 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().
Definition at line 38 of file transform_mode.cc.
References ARM_ENVELOPE, BLI_assert, 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 916 of file transform_mode.cc.
References dot_v3v3(), and mat3_to_rot_size().
Referenced by ElementResize().