Blender V2.61 - r43446
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BKE_context.h"
#include "ED_image.h"
#include "ED_view3d.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "UI_resources.h"
#include "transform.h"
Go to the source code of this file.
Functions | |
static void | drawObjectConstraint (TransInfo *t) |
static void | constraintAutoValues (TransInfo *t, float vec[3]) |
void | constraintNumInput (TransInfo *t, float vec[3]) |
static void | postConstraintChecks (TransInfo *t, float vec[3], float pvec[3]) |
static void | viewAxisCorrectCenter (TransInfo *t, float t_con_center[3]) |
static void | axisProjection (TransInfo *t, float axis[3], float in[3], float out[3]) |
static void | planeProjection (TransInfo *t, float in[3], float out[3]) |
static void | applyAxisConstraintVec (TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3]) |
static void | applyObjectConstraintVec (TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3]) |
static void | applyAxisConstraintSize (TransInfo *t, TransData *td, float smat[3][3]) |
static void | applyObjectConstraintSize (TransInfo *t, TransData *td, float smat[3][3]) |
static void | applyAxisConstraintRot (TransInfo *t, TransData *td, float vec[3], float *angle) |
static void | applyObjectConstraintRot (TransInfo *t, TransData *td, float vec[3], float *angle) |
void | setConstraint (TransInfo *t, float space[3][3], int mode, const char text[]) |
void | setLocalConstraint (TransInfo *t, int mode, const char text[]) |
void | setUserConstraint (TransInfo *t, short orientation, int mode, const char ftext[]) |
void | drawConstraint (TransInfo *t) |
void | drawPropCircle (const struct bContext *C, TransInfo *t) |
void | startConstraint (TransInfo *t) |
void | stopConstraint (TransInfo *t) |
void | getConstraintMatrix (TransInfo *t) |
void | initSelectConstraint (TransInfo *t, float mtx[3][3]) |
void | selectConstraint (TransInfo *t) |
void | postSelectConstraint (TransInfo *t) |
static void | setNearestAxis2d (TransInfo *t) |
static void | setNearestAxis3d (TransInfo *t) |
void | setNearestAxis (TransInfo *t) |
char | constraintModeToChar (TransInfo *t) |
int | isLockConstraint (TransInfo *t) |
int | getConstraintSpaceDimension (TransInfo *t) |
Definition in file transform_constraints.c.
static void applyAxisConstraintRot | ( | TransInfo * | t, |
TransData * | td, | ||
float | vec[3], | ||
float * | angle | ||
) | [static] |
Definition at line 478 of file transform_constraints.c.
References TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, CON_NOFLIP, copy_v3_v3(), dot_v3v3(), hasNumInput(), TransCon::mode, TransCon::mtx, TransInfo::num, and TransInfo::viewinv.
Referenced by initSelectConstraint(), and setConstraint().
Definition at line 415 of file transform_constraints.c.
References TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, TransCon::imtx, TransCon::mode, TransCon::mtx, and mul_m3_m3m3().
Referenced by initSelectConstraint(), and setConstraint().
static void applyAxisConstraintVec | ( | TransInfo * | t, |
TransData * | td, | ||
float | in[3], | ||
float | out[3], | ||
float | pvec[3] | ||
) | [static] |
Definition at line 320 of file transform_constraints.c.
References activeSnap(), axisProjection(), TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, copy_v3_v3(), getConstraintSpaceDimension(), TransSnap::mode, TransCon::mode, TransCon::mtx, mul_m3_v3(), planeProjection(), TransCon::pmtx, postConstraintChecks(), SCE_SNAP_MODE_INCREMENT, and TransInfo::tsnap.
Referenced by initSelectConstraint(), and setConstraint().
static void applyObjectConstraintRot | ( | TransInfo * | t, |
TransData * | td, | ||
float | vec[3], | ||
float * | angle | ||
) | [static] |
Definition at line 520 of file transform_constraints.c.
References TransData::axismtx, TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, CON_NOFLIP, copy_v3_v3(), TransInfo::data, dot_v3v3(), hasNumInput(), TransCon::mode, NULL, TransInfo::num, and TransInfo::viewinv.
Referenced by setLocalConstraint().
Definition at line 441 of file transform_constraints.c.
References TransData::axismtx, TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, invert_m3_m3(), TransCon::mode, and mul_m3_m3m3().
Referenced by setLocalConstraint().
static void applyObjectConstraintVec | ( | TransInfo * | t, |
TransData * | td, | ||
float | in[3], | ||
float | out[3], | ||
float | pvec[3] | ||
) | [static] |
Definition at line 363 of file transform_constraints.c.
References TransData::axismtx, axisProjection(), TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, copy_v3_v3(), getConstraintSpaceDimension(), i, TransCon::mode, TransCon::mtx, mul_m3_v3(), planeProjection(), TransCon::pmtx, and postConstraintChecks().
Referenced by setLocalConstraint().
static void axisProjection | ( | TransInfo * | t, |
float | axis[3], | ||
float | in[3], | ||
float | out[3] | ||
) | [static] |
Definition at line 214 of file transform_constraints.c.
References add_v3_v3v3(), angle(), angle_v3v3(), TransCon::center, TransInfo::con, copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), fabsf, getViewVector(), isect_line_line_v3(), M_PI, mul_v3_fl(), norm(), normalize_v3(), project_v3_v3v3(), RAD2DEGF, sub_v3_v3v3(), viewAxisCorrectCenter(), and TransInfo::viewinv.
Referenced by applyAxisConstraintVec(), and applyObjectConstraintVec().
static void constraintAutoValues | ( | TransInfo * | t, |
float | vec[3] | ||
) | [static] |
Definition at line 76 of file transform_constraints.c.
References TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, TransInfo::flag, TransCon::mode, and T_NULL_ONE.
Referenced by postConstraintChecks().
char constraintModeToChar | ( | TransInfo * | t | ) |
Definition at line 984 of file transform_constraints.c.
References TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, and TransCon::mode.
Referenced by transformEvent().
void constraintNumInput | ( | TransInfo * | t, |
float | vec[3] | ||
) |
Definition at line 98 of file transform_constraints.c.
References TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, TransInfo::flag, getConstraintSpaceDimension(), TransCon::mode, and T_NULL_ONE.
Referenced by BoneSize(), postConstraintChecks(), and Resize().
void drawConstraint | ( | TransInfo * | t | ) |
Definition at line 646 of file transform_constraints.c.
References add_v3_v3(), TransCon::center, TransInfo::con, CON_APPLY, CON_AXIS0, CON_AXIS1, CON_AXIS2, CON_SELECT, convertViewVec(), TransCon::drawExtra, DRAWLIGHT, drawLine(), ELEM, TransInfo::flag, TransCon::imval, TransCon::mode, TransCon::mtx, TransInfo::mval, setlinestyle(), SPACE_IMAGE, SPACE_VIEW3D, TransInfo::spacetype, T_NO_CONSTRAINT, and T_USES_MANIPULATOR.
Referenced by drawTransformView().
static void drawObjectConstraint | ( | TransInfo * | t | ) | [static] |
Definition at line 754 of file transform_constraints.c.
References TransData::axismtx, TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, TransInfo::data, DRAWLIGHT, drawLine(), i, TransCon::mode, TransData::ob, Object::obmat, and TransInfo::total.
Referenced by setLocalConstraint().
Definition at line 710 of file transform_constraints.c.
References TransInfo::center, copy_m4_m4(), copy_v3_v3(), CTX_wm_region_view3d(), drawcircball(), ED_space_image_uv_aspect(), ListBase::first, TransInfo::flag, invert_m4_m4(), mul_m4_v3(), NULL, TransInfo::obedit, Object::obmat, TransInfo::prop_size, TransInfo::sa, set_inverted_drawing(), SPACE_IMAGE, SPACE_VIEW3D, ScrArea::spacedata, TransInfo::spacetype, T_PROP_EDIT, TH_GRID, UI_ThemeColor(), unit_m4(), and RegionView3D::viewmat.
Referenced by drawTransformView().
void getConstraintMatrix | ( | TransInfo * | t | ) |
Definition at line 806 of file transform_constraints.c.
References TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, TransCon::imtx, invert_m3_m3(), TransformOrientation::mat, TransCon::mode, TransCon::mtx, mul_m3_m3m3(), TransCon::pmtx, and unit_m3().
Referenced by setConstraint(), setLocalConstraint(), and setNearestAxis().
int getConstraintSpaceDimension | ( | TransInfo * | t | ) |
Definition at line 1029 of file transform_constraints.c.
References TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, and TransCon::mode.
Referenced by applyAxisConstraintVec(), applyObjectConstraintVec(), constraintNumInput(), and startConstraint().
void initSelectConstraint | ( | TransInfo * | t, |
float | mtx[3][3] | ||
) |
Definition at line 836 of file transform_constraints.c.
References applyAxisConstraintRot(), applyAxisConstraintSize(), applyAxisConstraintVec(), TransCon::applyRot, TransCon::applySize, TransCon::applyVec, TransInfo::con, CON_APPLY, CON_SELECT, copy_m3_m3(), TransCon::drawExtra, TransCon::mode, TransCon::mtx, NULL, and setNearestAxis().
Referenced by transformEvent().
int isLockConstraint | ( | TransInfo * | t | ) |
Definition at line 1005 of file transform_constraints.c.
References TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, and TransCon::mode.
Referenced by PushPull().
static void planeProjection | ( | TransInfo * | t, |
float | in[3], | ||
float | out[3] | ||
) | [static] |
Definition at line 290 of file transform_constraints.c.
References add_v3_v3v3(), TransCon::center, TransInfo::con, copy_v3_v3(), dot_v3v3(), fabs(), getViewVector(), mul_v3_fl(), norm(), and sub_v3_v3v3().
Referenced by applyAxisConstraintVec(), and applyObjectConstraintVec().
static void postConstraintChecks | ( | TransInfo * | t, |
float | vec[3], | ||
float | pvec[3] | ||
) | [static] |
Definition at line 142 of file transform_constraints.c.
References applyNumInput(), TransInfo::auto_values, TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, constraintAutoValues(), constraintNumInput(), TransInfo::flag, NumInput::flag, hasNumInput(), i, TransCon::imtx, TransCon::mode, TransCon::mtx, mul_m3_v3(), mul_v3_m3v3(), TransInfo::num, removeAspectRatio(), SNAP_FORCED, snapGrid(), TransSnap::status, T_AUTOVALUES, T_NULL_ONE, and TransInfo::tsnap.
Referenced by applyAxisConstraintVec(), and applyObjectConstraintVec().
void postSelectConstraint | ( | TransInfo * | t | ) |
Definition at line 857 of file transform_constraints.c.
References TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, CON_SELECT, TransCon::mode, TransInfo::redraw, setNearestAxis(), and startConstraint().
Referenced by transformEvent().
void selectConstraint | ( | TransInfo * | t | ) |
Definition at line 849 of file transform_constraints.c.
References TransInfo::con, CON_SELECT, TransCon::mode, setNearestAxis(), and startConstraint().
Referenced by transformApply().
void setConstraint | ( | TransInfo * | t, |
float | space[3][3], | ||
int | mode, | ||
const char | text[] | ||
) |
Definition at line 554 of file transform_constraints.c.
References applyAxisConstraintRot(), applyAxisConstraintSize(), applyAxisConstraintVec(), TransCon::applyRot, TransCon::applySize, TransCon::applyVec, BLI_strncpy(), TransInfo::con, copy_m3_m3(), TransCon::drawExtra, getConstraintMatrix(), TransCon::mode, TransCon::mtx, NULL, TransInfo::redraw, startConstraint(), and TransCon::text.
Referenced by setLocalConstraint(), and setUserConstraint().
void setLocalConstraint | ( | TransInfo * | t, |
int | mode, | ||
const char | text[] | ||
) |
Definition at line 570 of file transform_constraints.c.
References applyObjectConstraintRot(), applyObjectConstraintSize(), applyObjectConstraintVec(), TransCon::applyRot, TransCon::applySize, TransCon::applyVec, TransData::axismtx, BLI_strncpy(), TransInfo::con, copy_m3_m3(), copy_m3_m4(), TransInfo::data, TransCon::drawExtra, drawObjectConstraint(), TransInfo::flag, getConstraintMatrix(), TransCon::mode, TransCon::mtx, normalize_m3(), Scene::obedit, Object::obmat, TransInfo::redraw, TransInfo::scene, setConstraint(), startConstraint(), T_EDIT, TransCon::text, and TransInfo::total.
Referenced by setUserConstraint(), and transformEvent().
void setNearestAxis | ( | TransInfo * | t | ) |
Definition at line 962 of file transform_constraints.c.
References TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, getConstraintMatrix(), TransCon::mode, setNearestAxis2d(), setNearestAxis3d(), SPACE_VIEW3D, and TransInfo::spacetype.
Referenced by initSelectConstraint(), postSelectConstraint(), and selectConstraint().
static void setNearestAxis2d | ( | TransInfo * | t | ) | [static] |
Definition at line 873 of file transform_constraints.c.
References abs(), BLI_snprintf(), TransInfo::con, CON_AXIS0, CON_AXIS1, TransCon::imval, TransCon::mode, TransInfo::mval, and TransCon::text.
Referenced by setNearestAxis().
static void setNearestAxis3d | ( | TransInfo * | t | ) | [static] |
Definition at line 886 of file transform_constraints.c.
References add_v3_v3(), TransInfo::ar, BLI_snprintf(), TransCon::center, TransInfo::center, TransInfo::center2d, TransInfo::con, CON_AXIS0, CON_AXIS1, CON_AXIS2, copy_v3_v3(), i, TransCon::imval, len(), len_v3(), MOD_CONSTRAINT_PLANE, TransCon::mode, TransInfo::modifiers, TransCon::mtx, mul_v3_fl(), TransInfo::mval, normalize_v3(), TransInfo::persinv, TransInfo::persmat, project_v3_v3v3(), projectIntView(), TransInfo::spacename, sub_v3_v3v3(), TransCon::text, and ARegion::winx.
Referenced by setNearestAxis().
void setUserConstraint | ( | TransInfo * | t, |
short | orientation, | ||
int | mode, | ||
const char | ftext[] | ||
) |
Definition at line 605 of file transform_constraints.c.
References BLI_snprintf(), TransInfo::con, CON_USER, MAT3_UNITY, TransCon::mode, TransCon::orientation, setConstraint(), setLocalConstraint(), TransInfo::spacemtx, TransInfo::spacename, V3D_MANIP_GIMBAL, V3D_MANIP_GLOBAL, V3D_MANIP_LOCAL, V3D_MANIP_NORMAL, and V3D_MANIP_VIEW.
Referenced by initTransform(), and transformEvent().
void startConstraint | ( | TransInfo * | t | ) |
Definition at line 792 of file transform_constraints.c.
References TransInfo::con, CON_APPLY, getConstraintSpaceDimension(), NumInput::idx_max, TransInfo::idx_max, MIN2, TransCon::mode, TransInfo::num, and TransCon::text.
Referenced by postSelectConstraint(), selectConstraint(), setConstraint(), setLocalConstraint(), and btDiscreteDynamicsWorld::solveConstraints().
void stopConstraint | ( | TransInfo * | t | ) |
Definition at line 799 of file transform_constraints.c.
References TransInfo::con, CON_APPLY, CON_SELECT, NumInput::idx_max, TransInfo::idx_max, TransCon::mode, TransInfo::num, and TransCon::text.
Referenced by transformEvent().
static void viewAxisCorrectCenter | ( | TransInfo * | t, |
float | t_con_center[3] | ||
) | [static] |
Definition at line 188 of file transform_constraints.c.
References KDL::diff(), dot_v3v3(), len_v3(), mul_v3_fl(), negate_v3(), normalize_v3_v3(), project_v3_v3v3(), SPACE_VIEW3D, TransInfo::spacetype, sub_v3_v3(), sub_v3_v3v3(), and TransInfo::viewinv.
Referenced by axisProjection().