Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-05-13 06:56:51 +02:00
commit 59c6487e93
9 changed files with 736 additions and 736 deletions

File diff suppressed because it is too large Load Diff

View File

@ -200,16 +200,16 @@ typedef struct TransSeq {
/* for NLA transform (stored in td->extra pointer) */
typedef struct TransDataNla {
ID *id; /* ID-block NLA-data is attached to */
struct NlaTrack *oldTrack; /* Original NLA-Track that the strip belongs to */
struct NlaTrack *nlt; /* Current NLA-Track that the strip belongs to */
struct NlaStrip *strip; /* NLA-strip this data represents */
/* dummy values for transform to write in - must have 3 elements... */
float h1[3]; /* start handle */
float h2[3]; /* end handle */
int trackIndex; /* index of track that strip is currently in */
int handle; /* handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends */
} TransDataNla;
@ -507,7 +507,7 @@ typedef struct TransInfo {
short twflag; /* backup from view3d, to restore on end */
short prop_mode;
short mirror;
float values[4];

View File

@ -208,7 +208,7 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
/* checks for center being too close to the view center */
viewAxisCorrectCenter(t, t_con_center);
angle = fabsf(angle_v3v3(axis, t->viewinv[2]));
if (angle > (float)M_PI_2) {
angle = (float)M_PI - angle;
@ -239,7 +239,7 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
project_v3_v3v3(vec, in, plane);
sub_v3_v3v3(vec, in, vec);
add_v3_v3v3(v, vec, t_con_center);
getViewVector(t, v, norm);
@ -257,11 +257,11 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
else {
add_v3_v3v3(v2, t_con_center, axis);
add_v3_v3v3(v4, v, norm);
isect_line_line_v3(t_con_center, v2, v, v4, i1, i2);
sub_v3_v3v3(v, i2, v);
sub_v3_v3v3(out, i1, t_con_center);
/* possible some values become nan when

File diff suppressed because it is too large Load Diff

View File

@ -263,11 +263,11 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
{
ScreenAnimData *sad = (animtimer) ? animtimer->customdata : NULL;
/* sanity checks */
if (ELEM(NULL, scene, id, sad))
return;
/* check if we need a new strip if:
* - if animtimer is running
* - we're not only keying for available channels
@ -278,26 +278,26 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
AnimData *adt = BKE_animdata_from_id(id);
const bool is_first = (adt) && (adt->nla_tracks.first == NULL);
/* perform push-down manually with some differences
/* perform push-down manually with some differences
* NOTE: BKE_nla_action_pushdown() sync warning...
*/
if ((adt->action) && !(adt->flag & ADT_NLA_EDIT_ON)) {
float astart, aend;
/* only push down if action is more than 1-2 frames long */
calc_action_range(adt->action, &astart, &aend, 1);
if (aend > astart + 2.0f) {
NlaStrip *strip = BKE_nlastack_add_strip(adt, adt->action);
/* clear reference to action now that we've pushed it onto the stack */
id_us_min(&adt->action->id);
adt->action = NULL;
/* adjust blending + extend so that they will behave correctly */
strip->extendmode = NLASTRIP_EXTEND_NOTHING;
strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE);
/* copy current "action blending" settings from adt to the strip,
* as it was keyframed with these settings, so omitting them will
* change the effect [T54766]
@ -305,7 +305,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
if (is_first == false) {
strip->blendmode = adt->act_blendmode;
strip->influence = adt->act_influence;
if (adt->act_influence < 1.0f) {
/* enable "user-controlled" influence (which will insert a default keyframe)
* so that the influence doesn't get lost on the new update
@ -320,9 +320,9 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
BKE_nlastrip_validate_fcurves(strip);
}
}
/* also, adjust the AnimData's action extend mode to be on
* 'nothing' so that previous result still play
/* also, adjust the AnimData's action extend mode to be on
* 'nothing' so that previous result still play
*/
adt->act_extendmode = NLASTRIP_EXTEND_NOTHING;
}
@ -351,12 +351,12 @@ static void recalcData_actedit(TransInfo *t)
{
ViewLayer *view_layer = t->view_layer;
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
bAnimContext ac = {NULL};
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
/* initialize relevant anim-context 'context' data from TransInfo data */
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
ac.scene = t->scene;
@ -367,9 +367,9 @@ static void recalcData_actedit(TransInfo *t)
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
ANIM_animdata_context_getdata(&ac);
/* perform flush */
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
/* flush transform values back to actual coordinates */
@ -379,8 +379,8 @@ static void recalcData_actedit(TransInfo *t)
/* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* just tag these animdata-blocks to recalc, assuming that some data there changed
/* just tag these animdata-blocks to recalc, assuming that some data there changed
* BUT only do this if realtime updates are enabled
*/
if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
@ -389,7 +389,7 @@ static void recalcData_actedit(TransInfo *t)
ANIM_list_elem_update(t->scene, ale);
}
}
/* now free temp channels */
ANIM_animdata_freelist(&anim_data);
}
@ -399,11 +399,11 @@ static void recalcData_graphedit(TransInfo *t)
{
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
ViewLayer *view_layer = t->view_layer;
ListBase anim_data = {NULL, NULL};
bAnimContext ac = {NULL};
int filter;
bAnimListElem *ale;
int dosort = 0;
@ -417,20 +417,20 @@ static void recalcData_graphedit(TransInfo *t)
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
ANIM_animdata_context_getdata(&ac);
/* do the flush first */
flushTransGraphData(t);
/* get curves to check if a re-sort is needed */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* now test if there is a need to re-sort */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
/* ignore FC-Curves without any selected verts */
if (!fcu_test_selected(fcu))
continue;
@ -440,17 +440,17 @@ static void recalcData_graphedit(TransInfo *t)
dosort++;
else
calchandles_fcurve(fcu);
/* set refresh tags for objects using this animation,
* BUT only if realtime updates are enabled
* BUT only if realtime updates are enabled
*/
if ((sipo->flag & SIPO_NOREALTIMEUPDATES) == 0)
ANIM_list_elem_update(t->scene, ale);
}
/* do resort and other updates? */
if (dosort) remake_graph_transdata(t, &anim_data);
/* now free temp channels */
ANIM_animdata_freelist(&anim_data);
}
@ -475,48 +475,48 @@ static void recalcData_nla(TransInfo *t)
PointerRNA strip_ptr;
short pExceeded, nExceeded, iter;
int delta_y1, delta_y2;
/* if this tdn has no handles, that means it is just a dummy that should be skipped */
if (tdn->handle == 0)
continue;
/* set refresh tags for objects using this animation,
* BUT only if realtime updates are enabled
* BUT only if realtime updates are enabled
*/
if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0)
ANIM_id_update(t->scene, tdn->id);
/* if canceling transform, just write the values without validating, then move on */
if (t->state == TRANS_CANCEL) {
/* clear the values by directly overwriting the originals, but also need to restore
* endpoints of neighboring transition-strips
*/
/* start */
strip->start = tdn->h1[0];
if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
strip->prev->end = tdn->h1[0];
/* end */
strip->end = tdn->h2[0];
if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION))
strip->next->start = tdn->h2[0];
/* flush transforms to child strips (since this should be a meta) */
BKE_nlameta_flush_transforms(strip);
/* restore to original track (if needed) */
if (tdn->oldTrack != tdn->nlt) {
/* just append to end of list for now, since strips get sorted in special_aftertrans_update() */
BLI_remlink(&tdn->nlt->strips, strip);
BLI_addtail(&tdn->oldTrack->strips, strip);
}
continue;
}
/* firstly, check if the proposed transform locations would overlap with any neighboring strips
* (barring transitions) which are absolute barriers since they are not being moved
*
@ -525,7 +525,7 @@ static void recalcData_nla(TransInfo *t)
for (iter = 0; iter < 5; iter++) {
pExceeded = ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end));
nExceeded = ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start));
if ((pExceeded && nExceeded) || (iter == 4)) {
/* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise)
* - simply crop strip to fit within the bounds of the strips bounding it
@ -543,21 +543,21 @@ static void recalcData_nla(TransInfo *t)
else if (nExceeded) {
/* move backwards */
float offset = tdn->h2[0] - strip->next->start;
tdn->h1[0] -= offset;
tdn->h2[0] -= offset;
}
else if (pExceeded) {
/* more forwards */
float offset = strip->prev->end - tdn->h1[0];
tdn->h1[0] += offset;
tdn->h2[0] += offset;
}
else /* all is fine and well */
break;
}
/* handle auto-snapping
* NOTE: only do this when transform is still running, or we can't restore
*/
@ -570,7 +570,7 @@ static void recalcData_nla(TransInfo *t)
tdn->h2[0] = floorf(tdn->h2[0] + 0.5f);
break;
}
case SACTSNAP_SECOND: /* snap to nearest second */
case SACTSNAP_TSTEP: /* second step - this is basically the same, since we don't have any remapping going on */
{
@ -585,12 +585,12 @@ static void recalcData_nla(TransInfo *t)
*/
float h1_new = (float)(floor(((double)tdn->h1[0] / secf) + 0.5) * secf);
float delta = h1_new - tdn->h1[0];
tdn->h1[0] = h1_new;
tdn->h2[0] += delta;
break;
}
case SACTSNAP_MARKER: /* snap to nearest marker */
{
tdn->h1[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]);
@ -599,36 +599,36 @@ static void recalcData_nla(TransInfo *t)
}
}
}
/* Use RNA to write the values to ensure that constraints on these are obeyed
* (e.g. for transition strips, the values are taken from the neighbors)
*
*
* NOTE: we write these twice to avoid truncation errors which can arise when
* moving the strips a large distance using numeric input [#33852]
* moving the strips a large distance using numeric input [#33852]
*/
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
/* flush transforms to child strips (since this should be a meta) */
BKE_nlameta_flush_transforms(strip);
/* now, check if we need to try and move track
* - we need to calculate both, as only one may have been altered by transform if only 1 handle moved
*/
delta_y1 = ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
delta_y2 = ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
if (delta_y1 || delta_y2) {
NlaTrack *track;
int delta = (delta_y2) ? delta_y2 : delta_y1;
int n;
/* move in the requested direction, checking at each layer if there's space for strip to pass through,
* stopping on the last track available or that we're able to fit in
*/
@ -639,7 +639,7 @@ static void recalcData_nla(TransInfo *t)
/* move strip to this track */
BLI_remlink(&tdn->nlt->strips, strip);
BKE_nlatrack_add_strip(track, strip);
tdn->nlt = track;
tdn->trackIndex++;
}
@ -650,14 +650,14 @@ static void recalcData_nla(TransInfo *t)
else {
/* make delta 'positive' before using it, since we now know to go backwards */
delta = -delta;
for (track = tdn->nlt->prev, n = 0; (track) && (n < delta); track = track->prev, n++) {
/* check if space in this track for the strip */
if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
/* move strip to this track */
BLI_remlink(&tdn->nlt->strips, strip);
BKE_nlatrack_add_strip(track, strip);
tdn->nlt = track;
tdn->trackIndex--;
}
@ -689,7 +689,7 @@ static void recalcData_image(TransInfo *t)
}
else if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
SpaceImage *sima = t->sa->spacedata.first;
flushTransUVs(t);
if (sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
@ -968,7 +968,7 @@ static void recalcData_objects(TransInfo *t)
}
else {
int i;
if (t->state != TRANS_CANCEL) {
applyProject(t);
}
@ -1102,15 +1102,15 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = t->view;
gpuPushMatrix();
copy_v3_v3(v3, dir);
mul_v3_fl(v3, v3d->far);
sub_v3_v3v3(v2, center, v3);
add_v3_v3v3(v1, center, v3);
if (options & DRAWLIGHT) {
col[0] = col[1] = col[2] = 220;
}
@ -1239,7 +1239,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->reports = op ? op->reports : NULL;
t->helpline = HLP_NONE;
t->flag = 0;
t->obedit_type = (object_mode == OB_MODE_EDIT) ? object_type : -1;
@ -1251,7 +1251,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
t->redraw = TREDRAW_HARD; /* redraw first time */
if (event) {
t->mouse.imval[0] = event->mval[0];
t->mouse.imval[1] = event->mval[1];
@ -1260,25 +1260,25 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->mouse.imval[0] = 0;
t->mouse.imval[1] = 0;
}
t->con.imval[0] = t->mouse.imval[0];
t->con.imval[1] = t->mouse.imval[1];
t->mval[0] = t->mouse.imval[0];
t->mval[1] = t->mouse.imval[1];
t->transform = NULL;
t->handleEvent = NULL;
t->data_len_all = 0;
t->val = 0.0f;
zero_v3(t->vec);
zero_v3(t->center_global);
unit_m3(t->mat);
/* if there's an event, we're modal */
if (event) {
t->flag |= T_MODAL;
@ -1296,7 +1296,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->remove_on_cancel = true;
}
}
/* GPencil editing context */
if ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)) {
t->options |= CTX_GPENCIL_STROKES;
@ -1333,10 +1333,10 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
bScreen *animscreen = ED_screen_animation_playing(CTX_wm_manager(C));
t->view = v3d;
t->animtimer = (animscreen) ? animscreen->animtimer : NULL;
/* turn manipulator off during transform */
if (t->flag & T_MODAL) {
t->twflag = v3d->twflag;
@ -1493,7 +1493,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->mirror = 1;
}
}
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
if (op && (prop = RNA_struct_find_property(op->ptr, "proportional"))) {
if (RNA_property_is_set(op->ptr, prop)) {
@ -1530,7 +1530,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
}
if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) &&
RNA_property_is_set(op->ptr, prop)))
{
@ -1539,14 +1539,14 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
else {
t->prop_size = ts->proportional_size;
}
/* TRANSFORM_FIX_ME rna restrictions */
if (t->prop_size <= 0.00001f) {
printf("Proportional size (%f) under 0.00001, resetting to 1!\n", t->prop_size);
t->prop_size = 1.0f;
}
if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
RNA_property_is_set(op->ptr, prop)))
{
@ -1559,7 +1559,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
else { /* add not pet option to context when not available */
t->options |= CTX_NO_PET;
}
// Mirror is not supported with PET, turn it off.
#if 0
if (t->flag & T_PROP_EDIT) {
@ -1650,12 +1650,12 @@ void postTrans(bContext *C, TransInfo *t)
}
}
MEM_freeN(tc->data);
MEM_SAFE_FREE(tc->data_ext);
MEM_SAFE_FREE(tc->data_2d);
}
}
MEM_SAFE_FREE(t->data_container);
t->data_container = NULL;
@ -1678,7 +1678,7 @@ void postTrans(bContext *C, TransInfo *t)
v3d->twflag = t->twflag;
}
}
if (t->mouse.data) {
MEM_freeN(t->mouse.data);
}
@ -1732,7 +1732,7 @@ static void restoreElement(TransData *td)
copy_qt_qt(td->ext->quat, td->ext->iquat);
}
}
if (td->flag & TD_BEZTRIPLE) {
*(td->hdata->h1) = td->hdata->ih1;
*(td->hdata->h2) = td->hdata->ih2;
@ -1764,7 +1764,7 @@ void restoreTransObjects(TransInfo *t)
unit_m3(t->mat);
}
recalcData(t);
}
@ -1792,10 +1792,10 @@ void calculateCenterLocal(
void calculateCenterCursor(TransInfo *t, float r_center[3])
{
const float *cursor;
cursor = ED_view3d_cursor3d_get(t->scene, t->view)->location;
copy_v3_v3(r_center, cursor);
/* If edit or pose mode, move cursor in local space */
if (t->options & CTX_PAINT_CURVE) {
if (ED_view3d_project_float_global(t->ar, cursor, r_center, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
@ -1809,7 +1809,7 @@ void calculateCenterCursor(TransInfo *t, float r_center[3])
void calculateCenterCursor2D(TransInfo *t, float r_center[2])
{
const float *cursor = NULL;
if (t->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
cursor = sima->cursor;
@ -1855,7 +1855,7 @@ void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2])
{
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
Scene *scene = t->scene;
/* cursor is combination of current frame, and graph-editor cursor value */
if (sipo->mode == SIPO_MODE_DRIVERS) {
r_center[0] = sipo->cursorTime;
@ -2031,20 +2031,20 @@ void calculateCenter(TransInfo *t)
/* for panning from cameraview */
if ((t->flag & T_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) {
if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
if (t->flag & T_CAMERA) {
float axis[3];
/* persinv is nasty, use viewinv instead, always right */
copy_v3_v3(axis, t->viewinv[2]);
normalize_v3(axis);
/* 6.0 = 6 grid units */
axis[0] = t->center_global[0] - 6.0f * axis[0];
axis[1] = t->center_global[1] - 6.0f * axis[1];
axis[2] = t->center_global[2] - 6.0f * axis[2];
projectFloatView(t, axis, t->center2d);
/* rotate only needs correct 2d center, grab needs ED_view3d_calc_zfac() value */
if (t->mode == TFM_TRANSLATION) {
copy_v3_v3(t->center_global, axis);
@ -2052,7 +2052,7 @@ void calculateCenter(TransInfo *t)
}
}
}
if (t->spacetype == SPACE_VIEW3D) {
/* ED_view3d_calc_zfac() defines a factor for perspective depth correction, used in ED_view3d_win_to_delta() */

View File

@ -40,7 +40,7 @@
#include "transform.h"
#include "MEM_guardedalloc.h"
#include "MEM_guardedalloc.h"
/* ************************** INPUT FROM MOUSE *************************** */
@ -128,7 +128,7 @@ void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, const int mval_start[
int *data;
mi->data = MEM_reallocN(mi->data, sizeof(int) * 4);
data = mi->data;
data[0] = mval_start[0];
@ -143,7 +143,7 @@ static void InputCustomRatioFlip(TransInfo *UNUSED(t), MouseInput *mi, const dou
double distance;
double dx, dy;
const int *data = mi->data;
if (data) {
int mdx, mdy;
dx = data[2] - data[0];

View File

@ -262,7 +262,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@ -466,7 +466,7 @@ static int transform_exec(bContext *C, wmOperator *op)
transformEnd(C, t);
transformops_exit(C, op);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
@ -549,7 +549,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(prop, PROP_HIDDEN);
if (flags & P_ALIGN_SNAP) {
prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
@ -558,11 +558,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
}
}
if (flags & P_GPENCIL_EDIT) {
RNA_def_boolean(ot->srna, "gpencil_strokes", 0, "Edit Grease Pencil", "Edit selected Grease Pencil strokes");
}
if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) {
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
prop = RNA_def_boolean(ot->srna, "remove_on_cancel", 0, "Remove on Cancel", "Remove elements on cancel");
@ -616,7 +616,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Resize";
ot->description = "Scale (resize) selected items";
ot->description = "Scale (resize) selected items";
ot->idname = OP_RESIZE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@ -649,7 +649,7 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Skin Resize";
ot->description = "Scale selected vertices' skin radii";
ot->description = "Scale selected vertices' skin radii";
ot->idname = OP_SKIN_RESIZE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@ -720,7 +720,7 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
/* optional -
* "Tilt selected vertices"
* "Specify an extra axis rotation for selected vertices of 3D curve" */
ot->description = "Tilt selected control vertices of 3D curve";
ot->description = "Tilt selected control vertices of 3D curve";
ot->idname = OP_TILT;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@ -833,7 +833,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "To Sphere";
//added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()"
//added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()"
ot->description = "Move selected vertices outward in a spherical shape around mesh center";
ot->idname = OP_TOSPHERE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@ -876,7 +876,7 @@ static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
/* identifiers */
ot->name = "Edge Slide";
ot->description = "Slide an edge loop along a mesh";
ot->description = "Slide an edge loop along a mesh";
ot->idname = OP_EDGE_SLIDE;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
@ -1067,7 +1067,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
{
wmKeyMapItem *kmi;
wmKeyMap *modalmap;
/* transform.c, only adds modal map once, checks if it's there */
modalmap = transform_modal_keymap(keyconf);
@ -1080,7 +1080,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
}
WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
}
switch (spaceid) {
case SPACE_VIEW3D:
WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
@ -1125,41 +1125,41 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
case SPACE_ACTION:
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SLIDE);
break;
case SPACE_IPO:
WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
break;
case SPACE_NLA:
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
break;

View File

@ -192,14 +192,14 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
int type;
type = getTransformOrientation(C, normal, plane);
switch (type) {
case ORIENTATION_VERT:
if (createSpaceNormal(mat, normal) == 0) {
BKE_reports_prepend(reports, "Cannot use vertex with zero-length normal");
return NULL;
}
if (name[0] == 0) {
name = "Vertex";
}
@ -209,7 +209,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
BKE_reports_prepend(reports, "Cannot use zero-length edge");
return NULL;
}
if (name[0] == 0) {
name = "Edge";
}
@ -219,7 +219,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
BKE_reports_prepend(reports, "Cannot use zero-area face");
return NULL;
}
if (name[0] == 0) {
name = "Face";
}
@ -234,7 +234,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports,
bool createSpaceNormal(float mat[3][3], const float normal[3])
{
float tangent[3] = {0.0f, 0.0f, 1.0f};
copy_v3_v3(mat[2], normal);
if (normalize_v3(mat[2]) == 0.0f) {
return false; /* error return */
@ -250,7 +250,7 @@ bool createSpaceNormal(float mat[3][3], const float normal[3])
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_m3(mat);
return true;
}
@ -276,13 +276,13 @@ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const floa
if (normalize_v3(mat[0]) == 0.0f) {
return false; /* error return */
}
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_v3(mat[1]);
/* final matrix must be normalized, do inline */
// normalize_m3(mat);
return true;
}
@ -406,7 +406,7 @@ static int count_bone_select(bArmature *arm, ListBase *lb, const bool do_it)
Bone *bone;
bool do_next;
int total = 0;
for (bone = lb->first; bone; bone = bone->next) {
bone->flag &= ~BONE_TRANSFORM;
do_next = do_it;
@ -423,7 +423,7 @@ static int count_bone_select(bArmature *arm, ListBase *lb, const bool do_it)
}
total += count_bone_select(arm, &bone->childbase, do_next);
}
return total;
}
@ -454,7 +454,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
ATTR_FALLTHROUGH; /* we define 'normal' as 'local' in Object mode */
case V3D_MANIP_LOCAL:
BLI_strncpy(t->spacename, IFACE_("local"), sizeof(t->spacename));
if (ob) {
copy_m3_m4(t->spacemtx, ob->obmat);
normalize_m3(t->spacemtx);
@ -462,9 +462,9 @@ void initTransformOrientation(bContext *C, TransInfo *t)
else {
unit_m3(t->spacemtx);
}
break;
case V3D_MANIP_VIEW:
if ((t->spacetype == SPACE_VIEW3D) &&
(t->ar->regiontype == RGN_TYPE_WINDOW))
@ -595,10 +595,10 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
if (obedit) {
float imat[3][3], mat[3][3];
/* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
invert_m3_m3(mat, imat);
transpose_m3(mat);
@ -608,12 +608,12 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
BMEditMesh *em = BKE_editmesh_from_object(ob);
BMEditSelection ese;
float vec[3] = {0, 0, 0};
/* USE LAST SELECTED WITH ACTIVE */
if (activeOnly && BM_select_history_active_get(em->bm, &ese)) {
BM_editselection_normal(&ese, normal);
BM_editselection_plane(&ese, plane);
switch (ese.htype) {
case BM_VERT:
result = ORIENTATION_VERT;
@ -638,7 +638,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
add_v3_v3(plane, vec);
}
}
result = ORIENTATION_FACE;
}
else if (em->bm->totvertsel == 3) {
@ -699,7 +699,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
else if (em->bm->totedgesel == 1 || em->bm->totvertsel == 2) {
BMVert *v_pair[2] = {NULL, NULL};
BMEdge *eed = NULL;
if (em->bm->totedgesel == 1) {
if (bm_mesh_edges_select_get_n(em->bm, &eed, 1) == 1) {
v_pair[0] = eed->v1;
@ -929,7 +929,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
}
}
}
if (!is_zero_v3(normal)) {
result = ORIENTATION_FACE;
}
@ -939,7 +939,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
MetaElem *ml;
bool ok = false;
float tmat[3][3];
if (activeOnly && (ml = mb->lastelem)) {
quat_to_mat3(tmat, ml->quat);
add_v3_v3(normal, tmat[2]);
@ -987,7 +987,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
}
}
}
if (ok) {
if (!is_zero_v3(plane)) {
result = ORIENTATION_EDGE;
@ -1044,12 +1044,12 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
if (ok) {
/* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
invert_m3_m3(mat, imat);
transpose_m3(mat);
mul_m3_v3(mat, normal);
mul_m3_v3(mat, plane);
result = ORIENTATION_EDGE;
}
}
@ -1073,14 +1073,14 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
}
}
}
if (ob) {
copy_v3_v3(normal, ob->obmat[2]);
copy_v3_v3(plane, ob->obmat[1]);
}
result = ORIENTATION_NORMAL;
}
return result;
}

View File

@ -114,12 +114,12 @@ static NodeBorder snapNodeBorder(int snap_node_mode);
int BIF_snappingSupported(Object *obedit)
{
int status = 0;
/* only support object mesh, armature, curves */
if (obedit == NULL || ELEM(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) {
status = 1;
}
return status;
}
#endif
@ -139,19 +139,19 @@ bool activeSnap(TransInfo *t)
void drawSnapping(const struct bContext *C, TransInfo *t)
{
unsigned char col[4], selectedCol[4], activeCol[4];
if (!activeSnap(t))
return;
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
col[3] = 128;
UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
selectedCol[3] = 128;
UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
activeCol[3] = 192;
if (t->spacetype == SPACE_VIEW3D) {
if (validSnap(t)) {
TransSnapPoint *p;
@ -159,11 +159,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float imat[4][4];
float size;
glDisable(GL_DEPTH_TEST);
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
invert_m4_m4(imat, rv3d->viewmat);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
@ -177,20 +177,20 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
else {
immUniformColor4ubv(col);
}
imm_drawcircball(p->co, ED_view3d_pixel_size(rv3d, p->co) * size * 0.75f, imat, pos);
}
if (t->tsnap.status & POINT_INIT) {
immUniformColor4ubv(activeCol);
imm_drawcircball(t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat, pos);
}
/* draw normal if needed */
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
immUniformColor4ubv(activeCol);
immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
immVertex3f(pos, t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
@ -216,11 +216,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
ARegion *ar = CTX_wm_region(C);
TransSnapPoint *p;
float size;
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
glEnable(GL_BLEND);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@ -232,13 +232,13 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
else {
immUniformColor4ubv(col);
}
ED_node_draw_snap(&ar->v2d, p->co, size, 0, pos);
}
if (t->tsnap.status & POINT_INIT) {
immUniformColor4ubv(activeCol);
ED_node_draw_snap(&ar->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos);
}
@ -264,7 +264,7 @@ eRedrawFlag handleSnapping(TransInfo *t, const wmEvent *event)
if (event->type == MOUSEMOVE) {
status |= updateSelectedSnapPoint(t);
}
return status;
}
@ -345,14 +345,14 @@ void applyGridAbsolute(TransInfo *t)
float grid_size = 0.0f;
GearsType grid_action;
int i;
if (!(activeSnap(t) && (ELEM(t->tsnap.mode, SCE_SNAP_MODE_INCREMENT, SCE_SNAP_MODE_GRID))))
return;
grid_action = BIG_GEARS;
if (t->modifiers & MOD_PRECISION)
grid_action = SMALL_GEARS;
switch (grid_action) {
case NO_GEARS: grid_size = t->snap_spatial[0]; break;
case BIG_GEARS: grid_size = t->snap_spatial[1]; break;
@ -361,7 +361,7 @@ void applyGridAbsolute(TransInfo *t)
/* early exit on unusable grid size */
if (grid_size == 0.0f)
return;
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
TransData *td;
@ -404,21 +404,21 @@ void applySnapping(TransInfo *t, float *vec)
/* project is not applied this way */
if (t->tsnap.project)
return;
if (t->tsnap.status & SNAP_FORCED) {
t->tsnap.targetSnap(t);
t->tsnap.applySnap(t, vec);
}
else if (!ELEM(t->tsnap.mode, SCE_SNAP_MODE_INCREMENT, SCE_SNAP_MODE_GRID) && activeSnap(t)) {
double current = PIL_check_seconds_timer();
// Time base quirky code to go around findnearest slowness
/* !TODO! add exception for object mode, no need to slow it down then */
if (current - t->tsnap.last >= 0.01) {
t->tsnap.calcSnap(t, vec);
t->tsnap.targetSnap(t);
t->tsnap.last = current;
}
if (validSnap(t)) {
@ -441,7 +441,7 @@ void resetSnapping(TransInfo *t)
t->tsnap.snapNormal[0] = 0;
t->tsnap.snapNormal[1] = 0;
t->tsnap.snapNormal[2] = 0;
t->tsnap.snapNodeBorder = 0;
}
@ -457,7 +457,7 @@ bool validSnappingNormal(TransInfo *t)
return true;
}
}
return false;
}
@ -501,20 +501,20 @@ static void initSnappingMode(TransInfo *t)
if (t->spacetype == SPACE_NODE) {
/* force project off when not supported */
t->tsnap.project = 0;
t->tsnap.mode = ts->snap_node_mode;
}
else if (t->spacetype == SPACE_IMAGE) {
/* force project off when not supported */
t->tsnap.project = 0;
t->tsnap.mode = ts->snap_uv_mode;
}
else {
/* force project off when not supported */
if (ts->snap_mode != SCE_SNAP_MODE_FACE)
t->tsnap.project = 0;
t->tsnap.mode = ts->snap_mode;
}
@ -556,7 +556,7 @@ static void initSnappingMode(TransInfo *t)
}
else if (t->spacetype == SPACE_NODE) {
setSnappingCallback(t);
if (t->tsnap.applySnap != NULL) {
t->tsnap.modeSelect = SNAP_NOT_SELECTED;
}
@ -593,9 +593,9 @@ void initSnapping(TransInfo *t, wmOperator *op)
{
ToolSettings *ts = t->settings;
short snap_target = t->settings->snap_target;
resetSnapping(t);
/* if snap property exists */
if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap")) {
if (RNA_boolean_get(op->ptr, "snap")) {
@ -604,12 +604,12 @@ void initSnapping(TransInfo *t, wmOperator *op)
if (RNA_struct_property_is_set(op->ptr, "snap_target")) {
snap_target = RNA_enum_get(op->ptr, "snap_target");
}
if (RNA_struct_property_is_set(op->ptr, "snap_point")) {
RNA_float_get_array(op->ptr, "snap_point", t->tsnap.snapPoint);
t->tsnap.status |= SNAP_FORCED | POINT_INIT;
}
/* snap align only defined in specific cases */
if (RNA_struct_find_property(op->ptr, "snap_align")) {
t->tsnap.align = RNA_boolean_get(op->ptr, "snap_align");
@ -644,7 +644,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
t->tsnap.snap_spatial_grid = ((t->settings->snap_flag & SCE_SNAP_ABS_GRID) != 0);
}
}
t->tsnap.target = snap_target;
initSnappingMode(t);
@ -863,24 +863,24 @@ static float RotationBetween(
sub_v3_v3v3(start, p1, t->center_global);
sub_v3_v3v3(end, p2, t->center_global);
// Angle around a constraint axis (error prone, will need debug)
if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
float axis[3], tmp[3];
t->con.applyRot(t, NULL, NULL, axis, NULL);
project_v3_v3v3(tmp, end, axis);
sub_v3_v3v3(end, end, tmp);
project_v3_v3v3(tmp, start, axis);
sub_v3_v3v3(start, start, tmp);
normalize_v3(end);
normalize_v3(start);
cross_v3_v3v3(tmp, start, end);
if (dot_v3v3(tmp, axis) < 0.0f)
angle = -acosf(dot_v3v3(start, end));
else
@ -888,22 +888,22 @@ static float RotationBetween(
}
else {
float mtx[3][3];
copy_m3_m4(mtx, t->viewmat);
mul_m3_v3(mtx, end);
mul_m3_v3(mtx, start);
angle = atan2f(start[1], start[0]) - atan2f(end[1], end[0]);
}
if (angle > (float)M_PI) {
angle = angle - 2 * (float)M_PI;
}
else if (angle < -((float)M_PI)) {
angle = 2.0f * (float)M_PI + angle;
}
return angle;
}
@ -920,7 +920,7 @@ static float ResizeBetween(TransInfo *t, const float p1[3], const float p2[3])
}
project_v3_v3v3(d1, d1, d2);
len_d1 = len_v3(d1);
/* Use 'invalid' dist when `center == p1` (after projecting),
@ -944,10 +944,10 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
float mval[2];
bool found = false;
float dist_px = SNAP_MIN_DISTANCE; // Use a user defined value here
mval[0] = t->mval[0];
mval[1] = t->mval[1];
if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME) {
found = peelObjectsTransform(
t, mval,
@ -960,7 +960,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
t, mval, &dist_px,
loc, no);
}
if (found == true) {
copy_v3_v3(t->tsnap.snapPoint, loc);
copy_v3_v3(t->tsnap.snapNormal, no);
@ -975,7 +975,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
/* same as above but for UV's */
Image *ima = ED_space_image(t->sa->spacedata.first);
float co[2];
UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], &co[0], &co[1]);
if (ED_uvedit_nearest_uv(t->scene, TRANS_DATA_CONTAINER_FIRST_EVIL(t)->obedit, ima, co, t->tsnap.snapPoint)) {
@ -992,11 +992,11 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
float loc[2];
float dist_px = SNAP_MIN_DISTANCE; // Use a user defined value here
char node_border;
if (snapNodesTransform(t, t->mval, loc, &dist_px, &node_border)) {
copy_v2_v2(t->tsnap.snapPoint, loc);
t->tsnap.snapNodeBorder = node_border;
t->tsnap.status |= POINT_INIT;
}
else {
@ -1014,7 +1014,7 @@ static void TargetSnapOffset(TransInfo *t, TransData *td)
char border = t->tsnap.snapNodeBorder;
float width = BLI_rctf_size_x(&node->totr);
float height = BLI_rctf_size_y(&node->totr);
#ifdef USE_NODE_CENTER
if (border & NODE_LEFT)
t->tsnap.snapTarget[0] -= 0.5f * width;
@ -1043,7 +1043,7 @@ static void TargetSnapCenter(TransInfo *t)
if ((t->tsnap.status & TARGET_INIT) == 0) {
copy_v3_v3(t->tsnap.snapTarget, t->center_global);
TargetSnapOffset(t, NULL);
t->tsnap.status |= TARGET_INIT;
}
}
@ -1094,9 +1094,9 @@ static void TargetSnapMedian(TransInfo *t)
}
mul_v3_fl(t->tsnap.snapTarget, 1.0 / i_accum);
TargetSnapOffset(t, NULL);
t->tsnap.status |= TARGET_INIT;
}
}
@ -1107,7 +1107,7 @@ static void TargetSnapClosest(TransInfo *t)
if (t->tsnap.status & POINT_INIT) {
float dist_closest = 0.0f;
TransData *closest = NULL;
/* Object mode */
if (t->flag & T_OBJECT) {
int i;
@ -1183,9 +1183,9 @@ static void TargetSnapClosest(TransInfo *t)
}
}
}
TargetSnapOffset(t, closest);
t->tsnap.status |= TARGET_INIT;
}
}
@ -1330,9 +1330,9 @@ static bool snapNode(
bool retval = false;
rcti totr;
int new_dist;
UI_view2d_view_to_region_rcti(v2d, &node->totr, &totr);
if (border & NODE_LEFT) {
new_dist = abs(totr.xmin - mval[0]);
if (new_dist < *r_dist_px) {
@ -1342,7 +1342,7 @@ static bool snapNode(
retval = true;
}
}
if (border & NODE_RIGHT) {
new_dist = abs(totr.xmax - mval[0]);
if (new_dist < *r_dist_px) {
@ -1352,7 +1352,7 @@ static bool snapNode(
retval = true;
}
}
if (border & NODE_BOTTOM) {
new_dist = abs(totr.ymin - mval[1]);
if (new_dist < *r_dist_px) {
@ -1362,7 +1362,7 @@ static bool snapNode(
retval = true;
}
}
if (border & NODE_TOP) {
new_dist = abs(totr.ymax - mval[1]);
if (new_dist < *r_dist_px) {
@ -1372,7 +1372,7 @@ static bool snapNode(
retval = true;
}
}
return retval;
}
@ -1384,15 +1384,15 @@ static bool snapNodes(
bNodeTree *ntree = snode->edittree;
bNode *node;
bool retval = false;
*r_node_border = 0;
for (node = ntree->nodes.first; node; node = node->next) {
if (snapNodeTest(&ar->v2d, node, snap_select)) {
retval |= snapNode(ts, snode, ar, node, mval, r_loc, r_dist_px, r_node_border);
}
}
return retval;
}
@ -1417,7 +1417,7 @@ void snapGridIncrementAction(TransInfo *t, float *val, GearsType action)
fac[NO_GEARS] = t->snap[0];
fac[BIG_GEARS] = t->snap[1];
fac[SMALL_GEARS] = t->snap[2];
applyGridIncrement(t, val, t->idx_max, fac, action);
}