Blender V2.61 - r43446
|
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <stdio.h>
#include "PIL_time.h"
#include "DNA_armature_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
#include "RNA_access.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BIF_gl.h"
#include "BKE_DerivedMesh.h"
#include "BKE_object.h"
#include "BKE_anim.h"
#include "BKE_context.h"
#include "ED_armature.h"
#include "ED_image.h"
#include "ED_mesh.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
#include "WM_types.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "MEM_guardedalloc.h"
#include "transform.h"
Go to the source code of this file.
Defines | |
#define | USE_BVH_FACE_SNAP |
Functions | |
static void | setSnappingCallback (TransInfo *t) |
static void | ApplySnapTranslation (TransInfo *t, float vec[3]) |
static void | ApplySnapRotation (TransInfo *t, float *vec) |
static void | ApplySnapResize (TransInfo *t, float vec[2]) |
static void | CalcSnapGeometry (TransInfo *t, float *vec) |
static void | TargetSnapMedian (TransInfo *t) |
static void | TargetSnapCenter (TransInfo *t) |
static void | TargetSnapClosest (TransInfo *t) |
static void | TargetSnapActive (TransInfo *t) |
static float | RotationBetween (TransInfo *t, float p1[3], float p2[3]) |
static float | TranslationBetween (TransInfo *t, float p1[3], float p2[3]) |
static float | ResizeBetween (TransInfo *t, float p1[3], float p2[3]) |
int | validSnap (TransInfo *t) |
int | activeSnap (TransInfo *t) |
void | drawSnapping (const struct bContext *C, TransInfo *t) |
int | handleSnapping (TransInfo *t, wmEvent *event) |
void | applyProject (TransInfo *t) |
void | applySnapping (TransInfo *t, float *vec) |
void | resetSnapping (TransInfo *t) |
int | usingSnappingNormal (TransInfo *t) |
int | validSnappingNormal (TransInfo *t) |
static void | initSnappingMode (TransInfo *t) |
void | initSnapping (TransInfo *t, wmOperator *op) |
void | addSnapPoint (TransInfo *t) |
int | updateSelectedSnapPoint (TransInfo *t) |
void | removeSnapPoint (TransInfo *t) |
void | getSnapPoint (TransInfo *t, float vec[3]) |
static void | ApplySnapResize (TransInfo *t, float vec[3]) |
static float | TranslationBetween (TransInfo *UNUSED(t), float p1[3], float p2[3]) |
static void UNUSED_FUNCTION() | CalcSnapGrid (TransInfo *t, float *UNUSED(vec)) |
static void | CalcSnapGeometry (TransInfo *t, float *UNUSED(vec)) |
static int | snapEdge (ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float obmat[][4], float timat[][3], const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2], float r_loc[3], float r_no[3], int *r_dist, float *r_depth) |
static int | snapVertex (ARegion *ar, float vco[3], short vno[3], float obmat[][4], float timat[][3], const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2], float r_loc[3], float r_no[3], int *r_dist, float *r_depth) |
static int | snapArmature (short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], const float ray_start[3], const float ray_normal[3], const float mval[2], float r_loc[3], float *UNUSED(r_no), int *r_dist, float *r_depth) |
static int | snapDerivedMesh (short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, EditMesh *em, float obmat[][4], const float ray_start[3], const float ray_normal[3], const float mval[2], float r_loc[3], float r_no[3], int *r_dist, float *r_depth) |
static int | snapObject (Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], const float ray_start[3], const float ray_normal[3], const float mval[2], float r_loc[3], float r_no[3], int *r_dist, float *r_depth) |
static int | snapObjects (Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode) |
int | snapObjectsTransform (TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode) |
int | snapObjectsContext (bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode) |
static int | cmpPeel (void *arg1, void *arg2) |
static void | removeDoublesPeel (ListBase *depth_peels) |
static void | addDepthPeel (ListBase *depth_peels, float depth, float p[3], float no[3], Object *ob) |
static int | peelDerivedMesh (Object *ob, DerivedMesh *dm, float obmat[][4], const float ray_start[3], const float ray_normal[3], const float UNUSED(mval[2]), ListBase *depth_peels) |
static int | peelObjects (Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2]) |
int | peelObjectsTransForm (TransInfo *t, ListBase *depth_peels, const float mval[2]) |
int | peelObjectsContext (bContext *C, ListBase *depth_peels, const float mval[2]) |
static void | applyGrid (TransInfo *t, float *val, int max_index, float fac[3], GearsType action) |
void | snapGridAction (TransInfo *t, float *val, GearsType action) |
void | snapGrid (TransInfo *t, float *val) |
Definition in file transform_snap.c.
#define USE_BVH_FACE_SNAP |
Definition at line 89 of file transform_snap.c.
int activeSnap | ( | TransInfo * | t | ) |
Definition at line 134 of file transform_snap.c.
References MOD_SNAP, MOD_SNAP_INVERT, and TransInfo::modifiers.
Referenced by applyAxisConstraintVec(), applyProject(), applySnapping(), drawSnapping(), and snapGrid().
static void addDepthPeel | ( | ListBase * | depth_peels, |
float | depth, | ||
float | p[3], | ||
float | no[3], | ||
Object * | ob | ||
) | [static] |
Definition at line 1776 of file transform_snap.c.
References BLI_addtail(), copy_v3_v3(), DepthPeel::depth, DepthPeel::flag, MEM_callocN(), DepthPeel::no, DepthPeel::ob, and DepthPeel::p.
Referenced by peelDerivedMesh().
void addSnapPoint | ( | TransInfo * | t | ) |
Definition at line 558 of file transform_snap.c.
References BLI_addtail(), TransSnapPoint::co, copy_v3_v3(), MEM_callocN(), MULTI_POINTS, p, POINT_INIT, TransSnap::points, TransSnap::selectedPoint, TransSnap::snapPoint, TransSnap::status, and TransInfo::tsnap.
Referenced by transformEvent().
static void applyGrid | ( | TransInfo * | t, |
float * | val, | ||
int | max_index, | ||
float | fac[3], | ||
GearsType | action | ||
) | [static] |
Definition at line 2029 of file transform_snap.c.
References ED_space_image_uv_aspect(), ListBase::first, i, TransInfo::mode, TransInfo::sa, SPACE_IMAGE, ScrArea::spacedata, TransInfo::spacetype, and TFM_TRANSLATION.
Referenced by snapGridAction().
void applyProject | ( | TransInfo * | t | ) |
Definition at line 258 of file transform_snap.c.
References activeSnap(), add_v3_v3(), TransInfo::ar, copy_v3_v3(), TransInfo::data, TransData::flag, TransInfo::flag, i, invert_m4_m4(), TransData::loc, TransSnap::modeSelect, mul_m3_v3(), mul_m4_v3(), TransData::ob, OB_RECALC_DATA, OB_RECALC_OB, OB_RECALC_TIME, TransInfo::obedit, object_handle_update(), Object::obmat, TransInfo::poseobj, TransSnap::project, project_float(), Object::recalc, TransInfo::scene, TransData::smtx, snapObjectsTransform(), sub_v3_v3v3(), T_EDIT, T_NO_PROJECT, T_OBJECT, T_POSE, TD_NOACTION, TD_SKIP, TransInfo::total, and TransInfo::tsnap.
Referenced by recalcData_view3d().
void applySnapping | ( | TransInfo * | t, |
float * | vec | ||
) |
Definition at line 317 of file transform_snap.c.
References activeSnap(), TransSnap::applySnap, TransSnap::calcSnap, TransSnap::last, TransSnap::mode, PIL_check_seconds_timer(), TransSnap::project, SCE_SNAP_MODE_INCREMENT, SNAP_FORCED, TransSnap::status, TransSnap::targetSnap, TransInfo::tsnap, and validSnap().
Referenced by Resize(), Rotation(), and Translation().
static void ApplySnapResize | ( | TransInfo * | t, |
float | vec[2] | ||
) | [static] |
Referenced by setSnappingCallback().
static void ApplySnapResize | ( | TransInfo * | t, |
float | vec[3] | ||
) | [static] |
Definition at line 669 of file transform_snap.c.
References TransSnap::dist, getSnapPoint(), ResizeBetween(), SCE_SNAP_TARGET_CLOSEST, TransSnap::snapTarget, TransSnap::target, and TransInfo::tsnap.
static void ApplySnapRotation | ( | TransInfo * | t, |
float * | vec | ||
) | [static] |
Definition at line 657 of file transform_snap.c.
References TransSnap::dist, getSnapPoint(), RotationBetween(), SCE_SNAP_TARGET_CLOSEST, TransSnap::snapTarget, TransSnap::target, and TransInfo::tsnap.
Referenced by setSnappingCallback().
static void ApplySnapTranslation | ( | TransInfo * | t, |
float | vec[3] | ||
) | [static] |
Definition at line 650 of file transform_snap.c.
References getSnapPoint(), TransSnap::snapTarget, sub_v3_v3v3(), and TransInfo::tsnap.
Referenced by setSnappingCallback().
static void CalcSnapGeometry | ( | TransInfo * | t, |
float * | vec | ||
) | [static] |
Referenced by setSnappingCallback().
static void CalcSnapGeometry | ( | TransInfo * | t, |
float * | UNUSEDvec | ||
) | [static] |
Definition at line 774 of file transform_snap.c.
References add_v3_v3v3(), TransInfo::ar, BLI_freelistN(), co, copy_v3_v3(), dot_v3v3(), ED_space_image(), ED_space_image_uv_aspect(), ED_uvedit_nearest_uv(), ListBase::first, DepthPeel::flag, FLT_MAX, ListBase::last, len_v3v3(), TransSnap::mode, TransSnap::modeSelect, mul_v3_fl(), TransInfo::mval, DepthPeel::next, NULL, DepthPeel::ob, OB_MESH, TransInfo::obedit, DepthPeel::p, p, peelObjectsTransForm(), POINT_INIT, TransInfo::sa, SCE_SNAP_MODE_VOLUME, SCE_SNAP_PEEL_OBJECT, TransInfo::scene, TransInfo::settings, ToolSettings::snap_flag, SNAP_MIN_DISTANCE, TransSnap::snapNormal, snapObjectsTransform(), TransSnap::snapPoint, TransSnap::snapTangent, SPACE_IMAGE, SPACE_VIEW3D, ScrArea::spacedata, TransInfo::spacetype, TransSnap::status, sub_v3_v3v3(), TransInfo::tsnap, Object::type, UI_view2d_region_to_view(), and ARegion::v2d.
static void UNUSED_FUNCTION() CalcSnapGrid | ( | TransInfo * | t, |
float * | UNUSEDvec | ||
) | [static] |
Definition at line 769 of file transform_snap.c.
References BIG_GEARS, and snapGridAction().
static int cmpPeel | ( | void * | arg1, |
void * | arg2 | ||
) | [static] |
Definition at line 1736 of file transform_snap.c.
References DepthPeel::depth, and simple_enum_gen::val.
Referenced by peelObjects().
Definition at line 139 of file transform_snap.c.
References activeSnap(), TransSnapPoint::co, CTX_wm_region_view3d(), CTX_wm_view3d(), drawcircball(), ED_view3d_pixel_size(), ListBase::first, invert_m4_m4(), TransSnapPoint::next, p, POINT_INIT, TransSnap::points, TransSnap::selectedPoint, size(), TransSnap::snapNormal, TransSnap::snapPoint, SPACE_IMAGE, SPACE_VIEW3D, TransInfo::spacetype, TransSnap::status, TH_ACTIVE, TH_SELECT, TH_TRANSFORM, TH_VERTEX_SIZE, TransInfo::tsnap, UI_GetThemeColor3ubv(), UI_GetThemeValuef(), usingSnappingNormal(), validSnap(), validSnappingNormal(), RegionView3D::viewmat, and View3D::zbuf.
Referenced by drawTransformView().
void getSnapPoint | ( | TransInfo * | t, |
float | vec[3] | ||
) |
Definition at line 625 of file transform_snap.c.
References add_v3_v3(), TransSnapPoint::co, copy_v3_v3(), ListBase::first, mul_v3_fl(), TransSnapPoint::next, p, POINT_INIT, TransSnap::points, TransSnap::snapPoint, TransSnap::status, and TransInfo::tsnap.
Referenced by ApplySnapResize(), ApplySnapRotation(), and ApplySnapTranslation().
Definition at line 237 of file transform_snap.c.
References BIF_snappingSupported(), initSnapping(), MOUSEMOVE, NULL, TransInfo::obedit, SCE_SNAP, TransInfo::settings, wmEvent::shift, ToolSettings::snap_flag, TABKEY, wmEvent::type, and updateSelectedSnapPoint().
Referenced by transformEvent().
void initSnapping | ( | TransInfo * | t, |
wmOperator * | op | ||
) |
Definition at line 440 of file transform_snap.c.
References TransSnap::align, ELEM, TransInfo::flag, initSnappingMode(), MOD_SNAP, TransInfo::modifiers, normalize_v3(), TransSnap::peel, POINT_INIT, TransSnap::project, wmOperator::ptr, resetSnapping(), RNA_boolean_get(), RNA_enum_get(), RNA_float_get_array(), RNA_struct_find_property(), RNA_struct_property_is_set(), SCE_SNAP, SCE_SNAP_NO_SELF, SCE_SNAP_PROJECT, SCE_SNAP_ROTATE, TransInfo::settings, ToolSettings::snap_flag, SNAP_FORCED, TransSnap::snap_self, ToolSettings::snap_target, TransSnap::snapNormal, TransSnap::snapPoint, SPACE_IMAGE, SPACE_VIEW3D, TransInfo::spacetype, TransSnap::status, T_MODAL, TransSnap::target, and TransInfo::tsnap.
Referenced by handleSnapping(), initTransform(), and transformEvent().
static void initSnappingMode | ( | TransInfo * | t | ) | [static] |
Definition at line 383 of file transform_snap.c.
References TransSnap::applySnap, BASACT, ELEM4, TransInfo::flag, TransSnap::mode, TransSnap::modeSelect, NULL, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MESH, OB_MODE_PARTICLE_EDIT, TransInfo::obedit, TransSnap::project, SCE_SNAP_MODE_FACE, SCE_SNAP_MODE_INCREMENT, TransInfo::scene, setSnappingCallback(), TransInfo::settings, SNAP_ALL, ToolSettings::snap_mode, SNAP_NOT_OBEDIT, SNAP_NOT_SELECTED, TransSnap::snap_self, SPACE_IMAGE, SPACE_VIEW3D, TransInfo::spacetype, T_CAMERA, T_PROP_EDIT, TransInfo::tsnap, and Object::type.
Referenced by initSnapping().
static int peelDerivedMesh | ( | Object * | ob, |
DerivedMesh * | dm, | ||
float | obmat[][4], | ||
const float | ray_start[3], | ||
const float | ray_normal[3], | ||
const float | UNUSEDmval[2], | ||
ListBase * | depth_peels | ||
) | [static] |
Definition at line 1790 of file transform_snap.c.
References add_v3_v3(), addDepthPeel(), MVert::co, copy_m3_m4(), copy_v3_v3(), DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, i, invert_m4_m4(), isect_ray_tri_threshold_v3(), len_v3v3(), mul_m3_v3(), mul_m4_v3(), mul_mat3_m4_v3(), mul_v3_fl(), normal_quad_v3(), normal_tri_v3(), normalize_v3(), NULL, object_get_boundbox(), ray_hit_boundbox(), rna_array::test, transpose_m3(), MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by peelObjects().
static int peelObjects | ( | Scene * | scene, |
View3D * | v3d, | ||
ARegion * | ar, | ||
Object * | obedit, | ||
ListBase * | depth_peels, | ||
const float | mval[2] | ||
) | [static] |
Definition at line 1900 of file transform_snap.c.
References Scene::base, BASE_SELECTABLE, BLI_sortlist(), CD_MASK_BAREMESH, cmpPeel(), Object::data, ED_view3d_win_to_ray(), editmesh_get_derived_cage(), ListBase::first, free_object_duplilist(), mesh_get_derived_final(), DupliObject::next, Base::next, NULL, DupliObject::ob, OB_DUPLI, OB_MESH, Base::object, object_duplilist(), Object::obmat, peelDerivedMesh(), DerivedMesh::release, removeDoublesPeel(), Object::transflag, Object::type, and simple_enum_gen::val.
Referenced by peelObjectsContext(), and peelObjectsTransForm().
Definition at line 1986 of file transform_snap.c.
References CTX_data_edit_object(), CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), ListBase::first, peelObjects(), and ScrArea::spacedata.
Referenced by sk_getStrokeSnapPoint().
Definition at line 1981 of file transform_snap.c.
References TransInfo::ar, TransInfo::obedit, peelObjects(), TransInfo::scene, and TransInfo::view.
Referenced by CalcSnapGeometry().
static void removeDoublesPeel | ( | ListBase * | depth_peels | ) | [static] |
Definition at line 1754 of file transform_snap.c.
References ABS, DepthPeel::depth, ListBase::first, MEM_freeN(), DepthPeel::next, and DepthPeel::prev.
Referenced by peelObjects().
void removeSnapPoint | ( | TransInfo * | t | ) |
Definition at line 607 of file transform_snap.c.
References BLI_freelinkN(), ListBase::first, MULTI_POINTS, NULL, TransSnap::points, TransSnap::selectedPoint, TransSnap::status, TransInfo::tsnap, and updateSelectedSnapPoint().
Referenced by transformEvent().
void resetSnapping | ( | TransInfo * | t | ) |
Definition at line 349 of file transform_snap.c.
References TransSnap::align, TransSnap::applySnap, TransSnap::last, TransSnap::mode, TransSnap::modeSelect, NULL, TransSnap::project, TransSnap::snapNormal, TransSnap::status, TransSnap::target, and TransInfo::tsnap.
Referenced by initSnapping().
static float ResizeBetween | ( | TransInfo * | t, |
float | p1[3], | ||
float | p2[3] | ||
) | [static] |
Definition at line 744 of file transform_snap.c.
References TransCon::applyRot, TransInfo::center, TransInfo::con, CON_APPLY, copy_v3_v3(), TransInfo::flag, len_v3(), TransCon::mode, mul_m3_v3(), mul_m4_v3(), NULL, TransInfo::obedit, Object::obmat, TransCon::pmtx, TransInfo::poseobj, sub_v3_v3v3(), T_EDIT, and T_POSE.
Referenced by ApplySnapResize(), and setSnappingCallback().
static float RotationBetween | ( | TransInfo * | t, |
float | p1[3], | ||
float | p2[3] | ||
) | [static] |
Definition at line 688 of file transform_snap.c.
References acos(), angle(), TransCon::applyRot, KDL::atan2(), TransInfo::center, TransInfo::con, CON_APPLY, copy_m3_m4(), copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), TransInfo::flag, M_PI, TransCon::mode, mul_m3_v3(), mul_m4_v3(), normalize_v3(), NULL, TransInfo::obedit, Object::obmat, TransInfo::poseobj, project_v3_v3v3(), sub_v3_v3v3(), T_EDIT, T_POSE, and TransInfo::viewmat.
Referenced by ApplySnapRotation(), and setSnappingCallback().
static void setSnappingCallback | ( | TransInfo * | t | ) | [static] |
Definition at line 505 of file transform_snap.c.
References TransSnap::applySnap, ApplySnapResize(), ApplySnapRotation(), ApplySnapTranslation(), TransSnap::calcSnap, CalcSnapGeometry(), TransSnap::distance, TransInfo::mode, NULL, ResizeBetween(), RotationBetween(), SCE_SNAP_TARGET_ACTIVE, SCE_SNAP_TARGET_CENTER, SCE_SNAP_TARGET_CLOSEST, SCE_SNAP_TARGET_MEDIAN, TransSnap::target, TransSnap::targetSnap, TargetSnapActive(), TargetSnapCenter(), TargetSnapClosest(), TargetSnapMedian(), TFM_RESIZE, TFM_ROTATION, TFM_TRANSLATION, TranslationBetween(), and TransInfo::tsnap.
Referenced by initSnappingMode().
static int snapArmature | ( | short | snap_mode, |
ARegion * | ar, | ||
Object * | ob, | ||
bArmature * | arm, | ||
float | obmat[][4], | ||
const float | ray_start[3], | ||
const float | ray_normal[3], | ||
const float | mval[2], | ||
float | r_loc[3], | ||
float * | UNUSEDr_no, | ||
int * | r_dist, | ||
float * | r_depth | ||
) | [static] |
Definition at line 1288 of file transform_snap.c.
References bPoseChannel::bone, BONE_HIDDEN_A, BONE_HIDDEN_P, BONE_HIDDEN_PG, BONE_ROOTSEL, BONE_TIPSEL, bPose::chanbase, copy_v3_v3(), bArmature::edbo, ListBase::first, Bone::flag, EditBone::flag, EditBone::head, invert_m4_m4(), bArmature::layer, EditBone::layer, mul_m4_v3(), mul_mat3_m4_v3(), bPoseChannel::next, EditBone::next, NULL, Object::pose, bPoseChannel::pose_head, bPoseChannel::pose_tail, SCE_SNAP_MODE_EDGE, SCE_SNAP_MODE_VERTEX, snapEdge(), snapVertex(), and EditBone::tail.
Referenced by snapObject().
static int snapDerivedMesh | ( | short | snap_mode, |
ARegion * | ar, | ||
Object * | ob, | ||
DerivedMesh * | dm, | ||
EditMesh * | em, | ||
float | obmat[][4], | ||
const float | ray_start[3], | ||
const float | ray_normal[3], | ||
const float | mval[2], | ||
float | r_loc[3], | ||
float | r_no[3], | ||
int * | r_dist, | ||
float * | r_depth | ||
) | [static] |
Definition at line 1355 of file transform_snap.c.
References BLI_bvhtree_ray_cast(), bvhtree_from_mesh_faces(), CD_ORIGINDEX, MVert::co, BVHTreeRayHit::co, copy_m3_m4(), copy_v3_v3(), BVHTreeRayHit::dist, credits_svn_gen::e, BVHTreeFromMesh::em_evil, EM_free_index_arrays(), EM_get_edge_for_index(), EM_get_face_for_index(), EM_get_vert_for_index(), EM_init_index_arrays(), EditVert::f, FLT_MAX, DerivedMesh::getEdgeArray, DerivedMesh::getEdgeDataArray, DerivedMesh::getFaceArray, DerivedMesh::getFaceDataArray, DerivedMesh::getNumEdges, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, DerivedMesh::getVertDataArray, EditEdge::h, EditVert::h, EditFace::h, i, BVHTreeRayHit::index, invert_m4_m4(), len_v3(), mul_m3_v3(), mul_m4_v3(), mul_mat3_m4_v3(), MVert::no, BVHTreeRayHit::no, normalize_v3(), NULL, object_get_boundbox(), ORIGINDEX_NONE, ray_hit_boundbox(), BVHTreeFromMesh::raycast_callback, SCE_SNAP_MODE_EDGE, SCE_SNAP_MODE_FACE, SCE_SNAP_MODE_VERTEX, SELECT, snapEdge(), snapVertex(), rna_array::test, transpose_m3(), BVHTreeFromMesh::tree, MEdge::v1, EditEdge::v1, MFace::v1, EditFace::v1, MEdge::v2, EditEdge::v2, MFace::v2, EditFace::v2, MFace::v3, EditFace::v3, MFace::v4, and EditFace::v4.
Referenced by snapObject().
static int snapEdge | ( | ARegion * | ar, |
float | v1co[3], | ||
short | v1no[3], | ||
float | v2co[3], | ||
short | v2no[3], | ||
float | obmat[][4], | ||
float | timat[][3], | ||
const float | ray_start[3], | ||
const float | ray_start_local[3], | ||
const float | ray_normal_local[3], | ||
const float | mval[2], | ||
float | r_loc[3], | ||
float | r_no[3], | ||
int * | r_dist, | ||
float * | r_depth | ||
) | [static] |
Definition at line 1155 of file transform_snap.c.
References abs(), add_v3_v3v3(), copy_v3_v3(), dot_v3v3(), interp_v3_v3v3(), isect_line_line_v3(), len_v3v3(), mul(), mul_m3_v3(), mul_m4_v3(), mul_v3_fl(), normal_short_to_float_v3(), normalize_v3(), project_int(), sub_v3_v3v3(), and BoundBox::vec.
Referenced by snapArmature(), and snapDerivedMesh().
void snapGrid | ( | TransInfo * | t, |
float * | val | ||
) |
Definition at line 2011 of file transform_snap.c.
References activeSnap(), BIG_GEARS, MOD_PRECISION, TransSnap::mode, TransInfo::modifiers, NO_GEARS, SCE_SNAP_MODE_INCREMENT, SMALL_GEARS, snapGridAction(), and TransInfo::tsnap.
Referenced by BakeTime(), Bevel(), BevelWeight(), BoneEnvelope(), BoneRoll(), BoneSize(), Crease(), CurveShrinkFatten(), EdgeSlide(), postConstraintChecks(), PushPull(), Resize(), Rotation(), SeqSlide(), Shear(), ShrinkFatten(), Tilt(), ToSphere(), Trackball(), Translation(), and Warp().
Definition at line 1999 of file transform_snap.c.
References applyGrid(), BIG_GEARS, TransInfo::idx_max, NO_GEARS, SMALL_GEARS, and TransInfo::snap.
Referenced by CalcSnapGrid(), and snapGrid().
static int snapObject | ( | Scene * | scene, |
ARegion * | ar, | ||
Object * | ob, | ||
int | editobject, | ||
float | obmat[][4], | ||
const float | ray_start[3], | ||
const float | ray_normal[3], | ||
const float | mval[2], | ||
float | r_loc[3], | ||
float | r_no[3], | ||
int * | r_dist, | ||
float * | r_depth | ||
) | [static] |
Definition at line 1625 of file transform_snap.c.
References CD_MASK_BAREMESH, Object::data, editmesh_get_derived_base(), mesh_get_derived_final(), NULL, OB_ARMATURE, OB_MESH, DerivedMesh::release, ToolSettings::snap_mode, snapArmature(), snapDerivedMesh(), Scene::toolsettings, and Object::type.
Referenced by snapObjects().
static int snapObjects | ( | Scene * | scene, |
View3D * | v3d, | ||
ARegion * | ar, | ||
Object * | obedit, | ||
const float | mval[2], | ||
int * | r_dist, | ||
float | r_loc[3], | ||
float | r_no[3], | ||
SnapMode | mode | ||
) | [static] |
Definition at line 1660 of file transform_snap.c.
References BA_HAS_RECALC_DATA, BA_HAS_RECALC_OB, BA_WAS_SEL, BASACT, BASE_VISIBLE, ED_view3d_win_to_ray(), ELEM, ListBase::first, FIRSTBASE, Base::flag, FLT_MAX, free_object_duplilist(), DupliObject::mat, Object::mode, DupliObject::next, Base::next, NULL, DupliObject::ob, OB_DUPLI, OB_MODE_PARTICLE_EDIT, Base::object, object_duplilist(), Object::obmat, SELECT, SNAP_ALL, SNAP_NOT_OBEDIT, SNAP_NOT_SELECTED, snapObject(), and Object::transflag.
Referenced by snapObjectsContext(), and snapObjectsTransform().
int snapObjectsContext | ( | bContext * | C, |
const float | mval[2], | ||
int * | r_dist, | ||
float | r_loc[3], | ||
float | r_no[3], | ||
SnapMode | mode | ||
) |
Definition at line 1725 of file transform_snap.c.
References CTX_data_edit_object(), CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), ListBase::first, snapObjects(), and ScrArea::spacedata.
Referenced by EM_project_snap_verts(), and sk_getStrokeSnapPoint().
int snapObjectsTransform | ( | TransInfo * | t, |
const float | mval[2], | ||
int * | r_dist, | ||
float | r_loc[3], | ||
float | r_no[3], | ||
SnapMode | mode | ||
) |
Definition at line 1720 of file transform_snap.c.
References TransInfo::ar, TransInfo::obedit, TransInfo::scene, snapObjects(), and TransInfo::view.
Referenced by applyProject(), and CalcSnapGeometry().
static int snapVertex | ( | ARegion * | ar, |
float | vco[3], | ||
short | vno[3], | ||
float | obmat[][4], | ||
float | timat[][3], | ||
const float | ray_start[3], | ||
const float | ray_start_local[3], | ||
const float | ray_normal_local[3], | ||
const float | mval[2], | ||
float | r_loc[3], | ||
float | r_no[3], | ||
int * | r_dist, | ||
float * | r_depth | ||
) | [static] |
Definition at line 1242 of file transform_snap.c.
References abs(), copy_v3_v3(), dot_v3v3(), len_v3v3(), mul_m3_v3(), mul_m4_v3(), normal_short_to_float_v3(), normalize_v3(), project_int(), and sub_v3_v3v3().
Referenced by snapArmature(), and snapDerivedMesh().
static void TargetSnapActive | ( | TransInfo * | t | ) | [static] |
Definition at line 949 of file transform_snap.c.
References TransData::center, copy_v3_v3(), TransInfo::data, TransInfo::flag, TransData::flag, i, mul_m4_v3(), NULL, TransInfo::obedit, Object::obmat, TransInfo::poseobj, SCE_SNAP_TARGET_MEDIAN, TransSnap::snapTarget, TransSnap::status, T_EDIT, T_POSE, TransSnap::target, TARGET_INIT, TransSnap::targetSnap, TargetSnapMedian(), TD_ACTIVE, TD_SELECTED, and TransInfo::tsnap.
Referenced by setSnappingCallback().
static void TargetSnapCenter | ( | TransInfo * | t | ) | [static] |
Definition at line 934 of file transform_snap.c.
References TransInfo::center, copy_v3_v3(), TransInfo::flag, mul_m4_v3(), TransInfo::obedit, Object::obmat, TransInfo::poseobj, TransSnap::snapTarget, TransSnap::status, T_EDIT, T_POSE, TARGET_INIT, and TransInfo::tsnap.
Referenced by setSnappingCallback().
static void TargetSnapClosest | ( | TransInfo * | t | ) | [static] |
Definition at line 1016 of file transform_snap.c.
References copy_v3_v3(), TransInfo::data, TransSnap::dist, TransSnap::distance, fabs(), TransData::flag, TransInfo::flag, i, mul_m4_v3(), NULL, TransInfo::obedit, object_get_boundbox(), Object::obmat, POINT_INIT, TransInfo::poseobj, TransSnap::snapPoint, TransSnap::snapTarget, TransSnap::status, T_EDIT, T_OBJECT, T_POSE, TARGET_INIT, TD_SELECTED, TransInfo::tsnap, and BoundBox::vec.
Referenced by setSnappingCallback().
static void TargetSnapMedian | ( | TransInfo * | t | ) | [static] |
Definition at line 988 of file transform_snap.c.
References add_v3_v3(), TransData::center, TransInfo::data, TransInfo::flag, TransData::flag, i, mul_m4_v3(), mul_v3_fl(), NULL, TransInfo::obedit, Object::obmat, TransInfo::poseobj, TransSnap::snapTarget, TransSnap::status, T_EDIT, T_POSE, TARGET_INIT, TD_SELECTED, and TransInfo::tsnap.
Referenced by setSnappingCallback(), and TargetSnapActive().
static float TranslationBetween | ( | TransInfo * | UNUSEDt, |
float | p1[3], | ||
float | p2[3] | ||
) | [static] |
Definition at line 683 of file transform_snap.c.
References len_v3v3().
static float TranslationBetween | ( | TransInfo * | t, |
float | p1[3], | ||
float | p2[3] | ||
) | [static] |
Referenced by setSnappingCallback().
int updateSelectedSnapPoint | ( | TransInfo * | t | ) |
Definition at line 573 of file transform_snap.c.
References TransInfo::ar, TransSnapPoint::co, ListBase::first, MULTI_POINTS, TransInfo::mval, TransSnapPoint::next, NULL, p, TransSnap::points, project_int(), TransSnap::selectedPoint, TransSnap::status, and TransInfo::tsnap.
Referenced by handleSnapping(), and removeSnapPoint().
int usingSnappingNormal | ( | TransInfo * | t | ) |
Definition at line 365 of file transform_snap.c.
References TransSnap::align, and TransInfo::tsnap.
Referenced by applyTranslation(), and drawSnapping().
int validSnap | ( | TransInfo * | t | ) |
Definition at line 128 of file transform_snap.c.
References MULTI_POINTS, POINT_INIT, TransSnap::status, TARGET_INIT, and TransInfo::tsnap.
Referenced by applySnapping(), drawSnapping(), and validSnappingNormal().
int validSnappingNormal | ( | TransInfo * | t | ) |
Definition at line 370 of file transform_snap.c.
References dot_v3v3(), TransSnap::snapNormal, TransInfo::tsnap, and validSnap().
Referenced by applyTranslation(), and drawSnapping().