Blender V2.61 - r43446
Defines | Functions

transform_snap.c File Reference

#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)

Detailed Description

Definition in file transform_snap.c.


Define Documentation

#define USE_BVH_FACE_SNAP

Definition at line 89 of file transform_snap.c.


Function Documentation

int activeSnap ( TransInfo t)
static void addDepthPeel ( ListBase depth_peels,
float  depth,
float  p[3],
float  no[3],
Object ob 
) [static]
void addSnapPoint ( TransInfo t)
static void applyGrid ( TransInfo t,
float *  val,
int  max_index,
float  fac[3],
GearsType  action 
) [static]
void applyProject ( TransInfo t)
void applySnapping ( TransInfo t,
float *  vec 
)
static void ApplySnapResize ( TransInfo t,
float  vec[2] 
) [static]

Referenced by setSnappingCallback().

static void ApplySnapResize ( TransInfo t,
float  vec[3] 
) [static]
static void ApplySnapRotation ( TransInfo t,
float *  vec 
) [static]
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]
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().

void drawSnapping ( const struct bContext C,
TransInfo t 
)
void getSnapPoint ( TransInfo t,
float  vec[3] 
)
int handleSnapping ( TransInfo t,
wmEvent event 
)
void initSnapping ( TransInfo t,
wmOperator op 
)
static void initSnappingMode ( TransInfo t) [static]
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]
static int peelObjects ( Scene scene,
View3D v3d,
ARegion ar,
Object obedit,
ListBase depth_peels,
const float  mval[2] 
) [static]
int peelObjectsContext ( bContext C,
ListBase depth_peels,
const float  mval[2] 
)
int peelObjectsTransForm ( TransInfo t,
ListBase depth_peels,
const float  mval[2] 
)
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)
void resetSnapping ( TransInfo t)
static float ResizeBetween ( TransInfo t,
float  p1[3],
float  p2[3] 
) [static]
static float RotationBetween ( TransInfo t,
float  p1[3],
float  p2[3] 
) [static]
static void setSnappingCallback ( TransInfo t) [static]
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]
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]
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]
void snapGrid ( TransInfo t,
float *  val 
)
void snapGridAction ( TransInfo t,
float *  val,
GearsType  action 
)

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]
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]
int snapObjectsContext ( bContext C,
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 
)
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]
static void TargetSnapActive ( TransInfo t) [static]
static void TargetSnapCenter ( TransInfo t) [static]
static void TargetSnapClosest ( TransInfo t) [static]
static void TargetSnapMedian ( TransInfo t) [static]
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)
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)
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().