Blender V4.3
transform.cc File Reference
#include "DNA_gpencil_legacy_types.h"
#include "BLI_math_matrix.h"
#include "BKE_context.hh"
#include "BKE_editmesh.hh"
#include "BKE_layer.hh"
#include "BKE_mask.h"
#include "BKE_workspace.hh"
#include "GPU_state.hh"
#include "ED_clip.hh"
#include "ED_gpencil_legacy.hh"
#include "ED_image.hh"
#include "ED_screen.hh"
#include "ED_space_api.hh"
#include "ED_uvedit.hh"
#include "ANIM_keyframing.hh"
#include "SEQ_transform.hh"
#include "WM_api.hh"
#include "WM_message.hh"
#include "UI_interface_icons.hh"
#include "UI_resources.hh"
#include "UI_view2d.hh"
#include "RNA_access.hh"
#include "BLF_api.hh"
#include "BLT_translation.hh"
#include "transform.hh"
#include "transform_constraints.hh"
#include "transform_convert.hh"
#include "transform_draw_cursors.hh"
#include "transform_gizmo.hh"
#include "transform_mode.hh"
#include "transform_orientations.hh"
#include "transform_snap.hh"

Go to the source code of this file.

Functions

void setTransformViewMatrices (TransInfo *t)
 
void setTransformViewAspect (TransInfo *t, float r_aspect[3])
 
static void convertViewVec2D (View2D *v2d, float r_vec[3], int dx, int dy)
 
static void convertViewVec2D_mask (View2D *v2d, float r_vec[3], int dx, int dy)
 
void convertViewVec (TransInfo *t, float r_vec[3], double dx, double dy)
 
void projectIntViewEx (TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag)
 
void projectIntView (TransInfo *t, const float vec[3], int adr[2])
 
void projectFloatViewEx (TransInfo *t, const float vec[3], float adr[2], const eV3DProjTest flag)
 
void projectFloatView (TransInfo *t, const float vec[3], float adr[2])
 
void applyAspectRatio (TransInfo *t, float vec[2])
 
void removeAspectRatio (TransInfo *t, float vec[2])
 
static void viewRedrawForce (const bContext *C, TransInfo *t)
 
static void viewRedrawPost (bContext *C, TransInfo *t)
 
static bool transform_modal_item_poll (const wmOperator *op, int value)
 
wmKeyMaptransform_modal_keymap (wmKeyConfig *keyconf)
 
static bool transform_event_modal_constraint (TransInfo *t, short modal_type)
 
int transformEvent (TransInfo *t, wmOperator *op, const wmEvent *event)
 
bool calculateTransformCenter (bContext *C, int centerMode, float cent3d[3], float cent2d[2])
 
static bool transinfo_show_overlay (TransInfo *t, ARegion *region)
 
static void drawTransformView (const bContext *, ARegion *region, void *arg)
 
static void drawAutoKeyWarning (TransInfo *t, ARegion *region)
 
static void drawTransformPixel (const bContext *, ARegion *region, void *arg)
 
void saveTransform (bContext *C, TransInfo *t, wmOperator *op)
 
bool initTransform (bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode)
 
void transformApply (bContext *C, TransInfo *t)
 
int transformEnd (bContext *C, TransInfo *t)
 
bool checkUseAxisMatrix (TransInfo *t)
 
bool transform_apply_matrix (TransInfo *t, float mat[4][4])
 
void transform_final_value_get (const TransInfo *t, float *value, const int value_num)
 
General Utils
void transform_view_vector_calc (const TransInfo *t, const float focus[3], float r_vec[3])
 
bool transdata_check_local_islands (TransInfo *t, short around)
 

Function Documentation

◆ applyAspectRatio()

◆ calculateTransformCenter()

bool calculateTransformCenter ( bContext * C,
int centerMode,
float cent3d[3],
float cent2d[2] )

Standalone call to get the transformation center corresponding to the current situation returns 1 if successful, 0 otherwise (usually means there's no selection) (if false is returns, cent3d is unmodified).

Definition at line 1446 of file editors/transform/transform.cc.

References TransInfo::around, C, calculateCenter(), TransInfo::center2d, TransInfo::center_global, TransInfo::context, copy_v2_v2(), copy_v3_v3(), create_trans_data(), CTX_NO_PET, TransInfo::data_len_all, initTransInfo(), MEM_callocN, MEM_freeN(), TransInfo::mode, TransInfo::options, postTrans(), special_aftertrans_update(), TransInfo::state, TFM_DUMMY, TRANS_RUNNING, and V3D_AROUND_CENTER_BOUNDS.

Referenced by edbm_bevel_invoke(), and edbm_inset_invoke().

◆ checkUseAxisMatrix()

◆ convertViewVec()

◆ convertViewVec2D()

static void convertViewVec2D ( View2D * v2d,
float r_vec[3],
int dx,
int dy )
static

◆ convertViewVec2D_mask()

static void convertViewVec2D_mask ( View2D * v2d,
float r_vec[3],
int dx,
int dy )
static

◆ drawAutoKeyWarning()

◆ drawTransformPixel()

◆ drawTransformView()

◆ initTransform()

bool initTransform ( bContext * C,
TransInfo * t,
wmOperator * op,
const wmEvent * event,
int mode )
Note
Caller needs to free t on a 0 return.
Warning
event might be NULL (when tweaking from redo panel)
See also
saveTransform which writes these values back.

Definition at line 1873 of file editors/transform/transform.cc.

References applyMouseInput(), BKE_editmesh_lnorspace_update(), BMEditMesh::bm, BM_lnorspace_invalidate(), C, calculateCenter(), calculatePropRatio(), TransInfo::center2d, TransInfo::con, CON_APPLY, TransInfo::context, create_trans_data(), CTX_CURSOR, CTX_GPENCIL_STROKES, CTX_TEXTURE_SPACE, CTX_VIEW2D_EDGE_PAN, CTX_wm_manager(), TransInfo::data_len_all, TransInfo::data_type, TransInfo::draw_handle_cursor, TransInfo::draw_handle_pixel, TransInfo::draw_handle_view, drawTransformPixel(), drawTransformView(), ED_region_draw_cb_activate(), ELEM, EVT_LEFTALTKEY, EVT_LEFTCTRLKEY, EVT_LEFTSHIFTKEY, EVT_OSKEY, EVT_RIGHTALTKEY, EVT_RIGHTCTRLKEY, EVT_RIGHTSHIFTKEY, TransInfo::flag, FOREACH_TRANS_DATA_CONTAINER, MouseInput::imval, initMouseInput(), initSnapping(), initTransInfo(), TransInfo::is_launch_event_drag, wmKeyMap::items, TransInfo::keymap, KM_ALT, KM_CLICK_DRAG, KM_CTRL, KM_OSKEY, KM_PRESS, KM_SHIFT, KMI_INACTIVE, TransInfo::launch_event, LISTBASE_FOREACH, MOD_NODE_ATTACH, MOD_SNAP_INVERT, wmOperatorType::modalkeymap, TransCon::mode, TransInfo::mode, wmEvent::modifier, TransInfo::modifiers, TransInfo::mouse, TransInfo::mval, OB_MESH, TransInfo::obedit_type, options, TransInfo::options, TransInfo::orient_axis, TransInfo::orient_axis_ortho, postTrans(), wmOperator::ptr, TransInfo::region, REGION_DRAW_POST_PIXEL, REGION_DRAW_POST_VIEW, RGN_TYPE_ANY, RNA_property_boolean_get(), RNA_property_boolean_set(), RNA_property_enum_get(), RNA_property_is_set(), RNA_struct_find_property(), setUserConstraint(), SPACE_ACTION, SPACE_CLIP, SPACE_GRAPH, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, SPACE_TYPE_ANY, SPACE_VIEW3D, TransInfo::spacemtx, TransInfo::spacetype, TransInfo::state, T_CLNOR_REBUILD, T_EDIT, T_MODAL, T_PROP_EDIT, TD_SELECTED, TFM_MODAL_NODE_ATTACH_OFF, TFM_MODAL_SNAP_INV_ON, TFM_RESIZE, TFM_ROTATION, TFM_TRANSLATION, BMesh::totvert, BMesh::totvertsel, TRANS_CANCEL, TRANS_STARTING, TransConvertType_Node, transform_draw_cursor_draw(), transform_draw_cursor_poll(), transform_mode_init(), transform_mode_really_used(), ARegion::type, wmEvent::type, wmOperator::type, unit_m3(), TransInfo::values, WM_keymap_active(), WM_paint_cursor_activate(), and WM_userdef_event_type_from_keymap_type().

Referenced by transformops_data().

◆ projectFloatView()

void projectFloatView ( TransInfo * t,
const float vec[3],
float adr[2] )

◆ projectFloatViewEx()

◆ projectIntView()

void projectIntView ( TransInfo * t,
const float vec[3],
int adr[2] )

Definition at line 344 of file editors/transform/transform.cc.

References projectIntViewEx(), and V3D_PROJ_TEST_NOP.

Referenced by projectFloatViewEx().

◆ projectIntViewEx()

◆ removeAspectRatio()

◆ saveTransform()

void saveTransform ( bContext * C,
TransInfo * t,
wmOperator * op )
See also
initTransform which reads values from the operator.

Definition at line 1655 of file editors/transform/transform.cc.

References BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, constraintModeToIndex(), CTX_data_tool_settings(), CTX_MASK, CTX_NO_PET, ELEM, TransInfo::flag, wmOperator::flag, Scene::id, TransInfo::mbus, MOD_SNAP, MOD_SNAP_FORCED, Object::mode, TransCon::mode, TransInfo::mode, TransSnap::mode, TransInfo::modifiers, OB_MODE_OBJECT, OP_IS_REPEAT, TransInfo::options, TransInfo::orient, TransInfo::orient_axis, TransInfo::orient_axis_ortho, TransInfo::orient_curr, wmMsgParams_RNA::prop, PROP_EDIT_CONNECTED, PROP_EDIT_PROJECTED, PROP_EDIT_USE, ToolSettings::prop_mode, TransInfo::prop_mode, TransInfo::prop_size, ToolSettings::proportional_action, ToolSettings::proportional_edit, ToolSettings::proportional_fcurve, ToolSettings::proportional_mask, ToolSettings::proportional_objects, ToolSettings::proportional_size, wmMsgParams_RNA::ptr, wmOperator::ptr, RNA_boolean_set(), RNA_enum_set(), RNA_float_set(), RNA_float_set_array(), RNA_pointer_create(), RNA_property_array_check(), RNA_property_boolean_set(), RNA_property_boolean_set_array(), RNA_property_enum_get(), RNA_property_enum_set(), RNA_property_float_get(), RNA_property_float_set(), RNA_property_float_set_array(), RNA_property_is_set(), RNA_property_unset(), RNA_struct_find_property(), SCE_SNAP, SCE_SNAP_INDIVIDUAL_PROJECT, SCE_SNAP_TARGET_NOT_ACTIVE, SCE_SNAP_TARGET_NOT_EDITED, SCE_SNAP_TARGET_NOT_NONEDITED, SCE_SNAP_TARGET_ONLY_SELECTABLE, TransInfo::scene, SET_FLAG_FROM_TEST, TransInfo::settings, TransSnap::source_operation, SPACE_ACTION, SPACE_GRAPH, TransInfo::spacemtx, TransInfo::spacetype, TransInfo::state, T_ALT_TRANSFORM, T_MODAL, T_NO_MIRROR, T_PROP_CONNECTED, T_PROP_EDIT, T_PROP_EDIT_ALL, T_PROP_PROJECTED, TransSnap::target_operation, TFM_SHRINKFATTEN, TRANS_CANCEL, transform_snap_flag_from_spacetype_ptr(), transformModeUseSnap(), TransInfo::tsnap, TransInfo::type, ToolSettings::uvcalc_flag, UVCALC_TRANSFORM_CORRECT_SLIDE, V3D_ORIENT_CUSTOM_MATRIX, TransInfo::values_final, TransInfo::view_layer, and WM_msg_publish_rna_params().

Referenced by transformops_exit().

◆ setTransformViewAspect()

◆ setTransformViewMatrices()

◆ transdata_check_local_islands()

bool transdata_check_local_islands ( TransInfo * t,
short around )

◆ transform_apply_matrix()

bool transform_apply_matrix ( TransInfo * t,
float mat[4][4] )

Transform a single matrix using the current t->final_values.

Definition at line 2213 of file editors/transform/transform.cc.

References TransInfo::mode_info, and TransModeInfo::transform_matrix_fn.

Referenced by gizmo_modal(), and nla_transform_apply().

◆ transform_event_modal_constraint()

◆ transform_final_value_get()

void transform_final_value_get ( const TransInfo * t,
float * value,
const int value_num )

Definition at line 2222 of file editors/transform/transform.cc.

References TransInfo::values_final.

Referenced by gizmo_modal().

◆ transform_modal_item_poll()

static bool transform_modal_item_poll ( const wmOperator * op,
int value )
static

◆ transform_modal_keymap()

◆ transform_view_vector_calc()

void transform_view_vector_calc ( const TransInfo * t,
const float focus[3],
float r_vec[3] )

Calculates projection vector based on a location.

Definition at line 63 of file editors/transform/transform.cc.

References copy_v3_v3(), normalize_v3(), TransInfo::persp, RV3D_ORTHO, sub_v3_v3v3(), and TransInfo::viewinv.

◆ transformApply()

◆ transformEnd()

◆ transformEvent()

int transformEvent ( TransInfo * t,
wmOperator * op,
const wmEvent * event )

Definition at line 984 of file editors/transform/transform.cc.

References addSnapPoint(), applyMouseInput(), TransInfo::area, BKE_workspace_status_clear(), BLI_assert, calculatePropRatio(), TransInfo::con, CON_APPLY, CON_AXIS2, TransInfo::context, CTX_CAMERA, CTX_NO_PET, CTX_wm_window(), CTX_wm_workspace(), wmEvent::customdata, TransInfo::data_type, ED_uvedit_live_unwrap_timer_check(), ELEM, EVT_CKEY, EVT_LEFTALTKEY, EVT_MODAL_MAP, EVT_OKEY, EVT_PADMINUS, EVT_PADPLUSKEY, EVT_RIGHTALTKEY, ListBase::first, TransInfo::flag, wmEvent::flag, TransModeInfo::handle_event_fn, handleNumInput(), handleSnapping(), hasNumInput(), IFACE_, initSelectConstraint(), initSnapping(), SpaceNode::insert_ofs_dir, ISMOUSE_MOTION, KM_ALT, KM_PRESS, KM_RELEASE, KM_SHIFT, TransInfo::launch_event, max_ff(), min_ff(), MOD_CONSTRAINT_SELECT_AXIS, MOD_CONSTRAINT_SELECT_PLANE, MOD_EDIT_SNAP_SOURCE, MOD_NODE_ATTACH, MOD_PRECISION, MOD_SNAP, MOD_SNAP_INVERT, TransCon::mode, TransInfo::mode, TransInfo::mode_info, wmEvent::modifier, TransInfo::modifiers, TransInfo::mouse, MOUSEMOVE, TransInfo::mval, wmEvent::mval, TransInfo::num, OPERATOR_PASS_THROUGH, TransInfo::options, TransInfo::orient, TransInfo::orient_curr, TransInfo::persp, postSelectConstraint(), MouseInput::precision, wmEvent::prev_type, wmEvent::prev_val, TransInfo::prop_mode, PROP_MODE_MAX, TransInfo::prop_size, TransInfo::redraw, TransInfo::region, ARegion::regiondata, removeSnapPoint(), resetTransModal(), resetTransRestrictions(), restoreTransObjects(), RV3D_NAVIGATING, RV3D_ORTHO, SCE_SNAP_TO_GRID, setLocalConstraint(), SNODE_INSERTOFS_DIR_LEFT, SNODE_INSERTOFS_DIR_RIGHT, sort_trans_data_dist(), SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, SPACE_VIEW3D, ScrArea::spacedata, ScrArea::spacetype, TransInfo::spacetype, TransInfo::state, stopConstraint(), T_ALT_TRANSFORM, T_AUTOIK, T_NO_CONSTRAINT, T_PROP_CONNECTED, T_PROP_EDIT, T_PROP_SIZE_MAX, T_PROP_SIZE_MIN, T_RELEASE_CONFIRM, TransSnap::target_type, TFM_EDGE_SLIDE, TFM_MODAL_ADD_SNAP, TFM_MODAL_AUTOCONSTRAINT, TFM_MODAL_AUTOCONSTRAINTPLANE, TFM_MODAL_AUTOIK_LEN_DEC, TFM_MODAL_AUTOIK_LEN_INC, TFM_MODAL_AXIS_X, TFM_MODAL_AXIS_Y, TFM_MODAL_AXIS_Z, TFM_MODAL_CANCEL, TFM_MODAL_CONFIRM, TFM_MODAL_CONS_OFF, TFM_MODAL_EDIT_SNAP_SOURCE_ON, TFM_MODAL_INSERTOFS_TOGGLE_DIR, TFM_MODAL_NODE_ATTACH_OFF, TFM_MODAL_NODE_ATTACH_ON, TFM_MODAL_PLANE_X, TFM_MODAL_PLANE_Y, TFM_MODAL_PLANE_Z, TFM_MODAL_PRECISION, TFM_MODAL_PROPSIZE, TFM_MODAL_PROPSIZE_DOWN, TFM_MODAL_PROPSIZE_UP, TFM_MODAL_REMOVE_SNAP, TFM_MODAL_RESIZE, TFM_MODAL_ROTATE, TFM_MODAL_ROTATE_NORMALS, TFM_MODAL_SNAP_INV_OFF, TFM_MODAL_SNAP_INV_ON, TFM_MODAL_SNAP_TOGGLE, TFM_MODAL_TRACKBALL, TFM_MODAL_TRANSLATE, TFM_MODAL_VERT_EDGE_SLIDE, TFM_NORMAL_ROTATION, TFM_RESIZE, TFM_ROTATION, TFM_TRACKBALL, TFM_TRANSLATION, TFM_VERT_SLIDE, TIMER, TRANS_CANCEL, TRANS_CONFIRM, TRANS_RUNNING, TRANS_STARTING, TransConvertType_Mesh, TransConvertType_Tracking, transform_autoik_update(), transform_event_modal_constraint(), transform_mode_init(), transform_mode_is_changeable(), transform_mode_snap_source_init(), transform_snap_flag_from_modifiers_set(), TREDRAW_HARD, TREDRAW_SOFT, TransInfo::tsnap, TransInfo::type, wmEvent::type, V3D_ORIENT_NORMAL, wmEvent::val, validSnap(), TransInfo::values, TransInfo::view, TransInfo::vod, WM_EVENT_IS_REPEAT, and WM_window_status_area_tag_redraw().

Referenced by transform_modal().

◆ transinfo_show_overlay()

static bool transinfo_show_overlay ( TransInfo * t,
ARegion * region )
static

◆ viewRedrawForce()

◆ viewRedrawPost()