Blender  V3.3
Functions
transform.c File Reference
#include <stdlib.h>
#include "MEM_guardedalloc.h"
#include "DNA_gpencil_types.h"
#include "DNA_mask_types.h"
#include "DNA_mesh_types.h"
#include "DNA_screen_types.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_mask.h"
#include "BKE_scene.h"
#include "GPU_state.h"
#include "ED_clip.h"
#include "ED_gpencil.h"
#include "ED_image.h"
#include "ED_keyframing.h"
#include "ED_node.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "SEQ_transform.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_types.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "RNA_access.h"
#include "BLF_api.h"
#include "BLT_translation.h"
#include "transform.h"
#include "transform_constraints.h"
#include "transform_convert.h"
#include "transform_draw_cursors.h"
#include "transform_mode.h"
#include "transform_orientations.h"
#include "transform_snap.h"

Go to the source code of this file.

Functions

static void initSnapSpatial (TransInfo *t, float r_snap[2])
 
bool transdata_check_local_islands (TransInfo *t, short around)
 
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, const wmEvent *event)
 
bool calculateTransformCenter (bContext *C, int centerMode, float cent3d[3], float cent2d[2])
 
static bool transinfo_show_overlay (const struct bContext *C, TransInfo *t, ARegion *region)
 
static void drawTransformView (const struct bContext *C, ARegion *region, void *arg)
 
static void drawAutoKeyWarning (TransInfo *UNUSED(t), ARegion *region)
 
static void drawTransformPixel (const struct bContext *C, 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)
 

Function Documentation

◆ applyAspectRatio()

void applyAspectRatio ( TransInfo t,
float  vec[2] 
)

◆ calculateTransformCenter()

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

◆ checkUseAxisMatrix()

bool checkUseAxisMatrix ( TransInfo t)

Definition at line 2062 of file transform.c.

References ELEM, OB_ARMATURE, OB_CURVES_LEGACY, OB_MBALL, OB_MESH, t, T_EDIT, and V3D_AROUND_LOCAL_ORIGINS.

Referenced by setUserConstraint().

◆ convertViewVec()

void convertViewVec ( TransInfo t,
float  r_vec[3],
double  dx,
double  dy 
)

◆ 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()

static void drawAutoKeyWarning ( TransInfo UNUSEDt,
ARegion region 
)
static

◆ drawTransformPixel()

static void drawTransformPixel ( const struct bContext C,
ARegion region,
void arg 
)
static

◆ drawTransformView()

static void drawTransformView ( const struct bContext C,
ARegion region,
void arg 
)
static

◆ initSnapSpatial()

static void initSnapSpatial ( TransInfo t,
float  r_snap[2] 
)
static

◆ initTransform()

bool initTransform ( bContext C,
TransInfo t,
wmOperator op,
const wmEvent event,
int  mode 
)

Definition at line 1758 of file transform.c.

References applyMouseInput(), BKE_editmesh_lnorspace_update(), BMEditMesh::bm, BM_lnorspace_invalidate(), C, calculateCenter(), calculatePropRatio(), CON_APPLY, copy_v2_v2_int(), createTransData(), CTX_CURSOR, CTX_GPENCIL_STROKES, CTX_TEXTURE_SPACE, CTX_VIEW2D_EDGE_PAN, CTX_wm_manager(), drawTransformPixel(), drawTransformView(), ED_region_draw_cb_activate(), ELEM, EVT_LEFTALTKEY, EVT_LEFTCTRLKEY, EVT_LEFTSHIFTKEY, EVT_OSKEY, EVT_RIGHTALTKEY, EVT_RIGHTCTRLKEY, EVT_RIGHTSHIFTKEY, wmKeyMapItem::flag, FOREACH_TRANS_DATA_CONTAINER, initMouseInput(), initSnapping(), initSnapSpatial(), initTransInfo(), KM_ALT, KM_CLICK_DRAG, KM_CTRL, KM_OSKEY, KM_PRESS, KM_SHIFT, KMI_INACTIVE, ME_AUTOSMOOTH, MOD_SNAP_INVERT, wmOperatorType::modalkeymap, wmEvent::modifier, wmEvent::mval, wmKeyMapItem::next, NULL, OB_MESH, options, postTrans(), wmKeyMapItem::propvalue, wmOperator::ptr, 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, t, T_CLNOR_REBUILD, T_EDIT, T_EVENT_DRAG_START, T_MODAL, T_PROP_EDIT, TD_SELECTED, TFM_MODAL_SNAP_INV_ON, TFM_RESIZE, TFM_ROTATION, TFM_TRANSLATION, BMesh::totvert, BMesh::totvertsel, TRANS_CANCEL, TRANS_STARTING, transform_draw_cursor_draw(), transform_draw_cursor_poll(), transform_mode_init(), transform_mode_really_used(), wmKeyMapItem::type, wmOperator::type, wmEvent::type, unit_m3(), wmKeyMapItem::val, WM_event_drag_start_mval(), 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()

void projectFloatViewEx ( TransInfo t,
const float  vec[3],
float  adr[2],
const eV3DProjTest  flag 
)

◆ projectIntView()

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

Definition at line 333 of file transform.c.

References projectIntViewEx(), t, and V3D_PROJ_TEST_NOP.

Referenced by projectFloatViewEx(), and transform_input_update().

◆ projectIntViewEx()

void projectIntViewEx ( TransInfo t,
const float  vec[3],
int  adr[2],
const eV3DProjTest  flag 
)

◆ removeAspectRatio()

void removeAspectRatio ( TransInfo t,
float  vec[2] 
)

◆ saveTransform()

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

Definition at line 1498 of file transform.c.

References C, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, constraintModeToIndex(), CTX_data_tool_settings(), CTX_MASK, CTX_NO_PET, ELEM, wmOperator::flag, MOD_SNAP, Object::mode, NULL, OB_MODE_OBJECT, OBACT, OP_IS_REPEAT, wmMsgParams_RNA::prop, PROP_EDIT_CONNECTED, PROP_EDIT_PROJECTED, PROP_EDIT_USE, ToolSettings::prop_mode, ToolSettings::proportional_action, ToolSettings::proportional_edit, ToolSettings::proportional_fcurve, ToolSettings::proportional_mask, ToolSettings::proportional_objects, ToolSettings::proportional_size, wmOperator::ptr, wmMsgParams_RNA::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_TARGET_NOT_ACTIVE, SCE_SNAP_TARGET_NOT_EDITED, SCE_SNAP_TARGET_NOT_NONEDITED, SCE_SNAP_TARGET_ONLY_SELECTABLE, ToolSettings::snap_flag, ToolSettings::snap_flag_node, ToolSettings::snap_flag_seq, ToolSettings::snap_uv_flag, SPACE_ACTION, SPACE_GRAPH, SPACE_IMAGE, SPACE_NODE, SPACE_SEQ, t, T_ALT_TRANSFORM, T_MODAL, T_NO_MIRROR, T_PROP_CONNECTED, T_PROP_EDIT, T_PROP_EDIT_ALL, T_PROP_PROJECTED, TFM_SHRINKFATTEN, transformModeUseSnap(), UVCALC_TRANSFORM_CORRECT_SLIDE, V3D_ORIENT_CUSTOM_MATRIX, and WM_msg_publish_rna_params().

Referenced by transformops_exit().

◆ setTransformViewAspect()

void setTransformViewAspect ( TransInfo t,
float  r_aspect[3] 
)

◆ setTransformViewMatrices()

void setTransformViewMatrices ( TransInfo t)

◆ transdata_check_local_islands()

bool transdata_check_local_islands ( TransInfo t,
short  around 
)

Definition at line 64 of file transform.c.

References CTX_CURSOR, CTX_TEXTURE_SPACE, ELEM, OB_GPENCIL, OB_MESH, t, and V3D_AROUND_LOCAL_ORIGINS.

Referenced by initTransInfo(), and set_prop_dist().

◆ 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 2076 of file transform.c.

References NULL, and t.

Referenced by gizmo_modal().

◆ transform_event_modal_constraint()

static bool transform_event_modal_constraint ( TransInfo t,
short  modal_type 
)
static

◆ transform_final_value_get()

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

Definition at line 2085 of file transform.c.

References t.

Referenced by gizmo_modal().

◆ transform_modal_item_poll()

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

◆ transform_modal_keymap()

wmKeyMap* transform_modal_keymap ( struct wmKeyConfig keyconf)

◆ transformApply()

void transformApply ( bContext C,
TransInfo t 
)

◆ transformEnd()

int transformEnd ( bContext C,
TransInfo t 
)

◆ transformEvent()

int transformEvent ( TransInfo t,
const wmEvent event 
)

Definition at line 895 of file transform.c.

References addSnapPoint(), applyMouseInput(), BLI_assert, calculatePropRatio(), CON_APPLY, CON_AXIS2, copy_v2_v2_int(), CTX_CAMERA, CTX_MASK, CTX_MOVIECLIP, CTX_NO_PET, CTX_TEXTURE_SPACE, CTX_wm_window(), ELEM, EVT_CKEY, EVT_LEFTALTKEY, EVT_MODAL_MAP, EVT_NKEY, EVT_OKEY, EVT_PADMINUS, EVT_PADPLUSKEY, EVT_RIGHTALTKEY, wmEvent::flag, handleNumInput(), handleSnapping(), hasNumInput(), initSelectConstraint(), initSnapping(), SpaceNode::insert_ofs_dir, ISMOUSE_MOTION, KM_ALT, KM_PRESS, KM_RELEASE, KM_SHIFT, max_ff(), min_ff(), MOD_CONSTRAINT_SELECT_AXIS, MOD_CONSTRAINT_SELECT_PLANE, MOD_PRECISION, MOD_SNAP, MOD_SNAP_INVERT, wmEvent::modifier, MOUSEMOVE, wmEvent::mval, NULL, OB_MESH, OPERATOR_PASS_THROUGH, postSelectConstraint(), wmEvent::prev_type, wmEvent::prev_val, PROP_MODE_MAX, removeSnapPoint(), resetTransModal(), resetTransRestrictions(), restoreTransObjects(), RV3D_ORTHO, setLocalConstraint(), SNODE_INSERTOFS_DIR_LEFT, SNODE_INSERTOFS_DIR_RIGHT, sort_trans_data_dist(), SPACE_NODE, SPACE_SEQ, SPACE_VIEW3D, stopConstraint(), t, T_ALT_TRANSFORM, T_AUTOIK, T_EDIT, T_NO_CONSTRAINT, T_PROP_CONNECTED, T_PROP_EDIT, T_PROP_SIZE_MAX, T_PROP_SIZE_MIN, T_RELEASE_CONFIRM, 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_EDGESLIDE_DOWN, TFM_MODAL_EDGESLIDE_UP, TFM_MODAL_INSERTOFS_TOGGLE_DIR, 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_SNAP_INV_OFF, TFM_MODAL_SNAP_INV_ON, TFM_MODAL_SNAP_TOGGLE, TFM_MODAL_TRANSLATE, TFM_NORMAL_ROTATION, TFM_RESIZE, TFM_ROTATION, TFM_TRACKBALL, TFM_TRANSLATION, TFM_VERT_SLIDE, TIP_, TRANS_CANCEL, TRANS_CONFIRM, TRANS_RUNNING, TRANS_STARTING, transform_autoik_update(), transform_event_modal_constraint(), transform_mode_init(), transform_mode_is_changeable(), TREDRAW_HARD, TREDRAW_SOFT, wmEvent::type, V3D_ORIENT_NORMAL, wmEvent::val, WM_EVENT_IS_REPEAT, and WM_window_status_area_tag_redraw().

Referenced by transform_modal().

◆ transinfo_show_overlay()

static bool transinfo_show_overlay ( const struct bContext C,
TransInfo t,
ARegion region 
)
static

◆ viewRedrawForce()

static void viewRedrawForce ( const bContext C,
TransInfo t 
)
static

◆ viewRedrawPost()

static void viewRedrawPost ( bContext C,
TransInfo t 
)
static