forked from bartvdbraak/blender
Cleanup: trailing space
This commit is contained in:
parent
c84b8d4801
commit
b99d064e91
File diff suppressed because it is too large
Load Diff
@ -188,16 +188,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;
|
||||
@ -449,7 +449,7 @@ typedef struct TransInfo {
|
||||
short twtype; /* backup from view3d, to restore on end */
|
||||
|
||||
short prop_mode;
|
||||
|
||||
|
||||
short mirror;
|
||||
|
||||
float values[4];
|
||||
@ -652,8 +652,10 @@ bool transdata_check_local_islands(TransInfo *t, short around);
|
||||
int count_set_pose_transflags(int *out_mode, short around, struct Object *ob);
|
||||
|
||||
/* auto-keying stuff used by special_aftertrans_update */
|
||||
void autokeyframe_ob_cb_func(struct bContext *C, struct Scene *scene, struct View3D *v3d, struct Object *ob, int tmode);
|
||||
void autokeyframe_pose_cb_func(struct bContext *C, struct Scene *scene, struct View3D *v3d, struct Object *ob, int tmode, short targetless_ik);
|
||||
void autokeyframe_ob_cb_func(
|
||||
struct bContext *C, struct Scene *scene, struct View3D *v3d, struct Object *ob, int tmode);
|
||||
void autokeyframe_pose_cb_func(
|
||||
struct bContext *C, struct Scene *scene, struct View3D *v3d, struct Object *ob, int tmode, short targetless_ik);
|
||||
|
||||
/*********************** Constraints *****************************/
|
||||
|
||||
|
@ -206,7 +206,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;
|
||||
@ -237,7 +237,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);
|
||||
|
||||
@ -255,11 +255,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
@ -128,11 +128,11 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
|
||||
ModifierData *md = ob->modifiers.first;
|
||||
float tolerance[3] = {0.0f, 0.0f, 0.0f};
|
||||
int axis = 0;
|
||||
|
||||
|
||||
for (; md; md = md->next) {
|
||||
if ((md->type == eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
|
||||
MirrorModifierData *mmd = (MirrorModifierData *) md;
|
||||
|
||||
|
||||
if (mmd->flag & MOD_MIR_CLIPPING) {
|
||||
axis = 0;
|
||||
if (mmd->flag & MOD_MIR_AXIS_X) {
|
||||
@ -151,35 +151,35 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
|
||||
float mtx[4][4], imtx[4][4];
|
||||
int i;
|
||||
TransData *td = t->data;
|
||||
|
||||
|
||||
if (mmd->mirror_ob) {
|
||||
float obinv[4][4];
|
||||
|
||||
|
||||
invert_m4_m4(obinv, mmd->mirror_ob->obmat);
|
||||
mul_m4_m4m4(mtx, obinv, ob->obmat);
|
||||
invert_m4_m4(imtx, mtx);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < t->total; i++, td++) {
|
||||
int clip;
|
||||
float loc[3], iloc[3];
|
||||
|
||||
|
||||
if (td->flag & TD_NOACTION)
|
||||
break;
|
||||
if (td->loc == NULL)
|
||||
break;
|
||||
|
||||
|
||||
if (td->flag & TD_SKIP)
|
||||
continue;
|
||||
|
||||
|
||||
copy_v3_v3(loc, td->loc);
|
||||
copy_v3_v3(iloc, td->iloc);
|
||||
|
||||
|
||||
if (mmd->mirror_ob) {
|
||||
mul_m4_v3(mtx, loc);
|
||||
mul_m4_v3(mtx, iloc);
|
||||
}
|
||||
|
||||
|
||||
clip = 0;
|
||||
if (axis & 1) {
|
||||
if (fabsf(iloc[0]) <= tolerance[0] ||
|
||||
@ -189,7 +189,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
|
||||
clip = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (axis & 2) {
|
||||
if (fabsf(iloc[1]) <= tolerance[1] ||
|
||||
loc[1] * iloc[1] < 0.0f)
|
||||
@ -214,7 +214,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,7 +226,7 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
|
||||
TransData *td = t->data;
|
||||
BMVert *eve;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < t->total; i++, td++) {
|
||||
if (td->flag & TD_NOACTION)
|
||||
break;
|
||||
@ -234,14 +234,14 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
|
||||
break;
|
||||
if (td->flag & TD_SKIP)
|
||||
continue;
|
||||
|
||||
|
||||
eve = td->extra;
|
||||
if (eve) {
|
||||
eve->co[0] = -td->loc[0];
|
||||
eve->co[1] = td->loc[1];
|
||||
eve->co[2] = td->loc[2];
|
||||
}
|
||||
|
||||
|
||||
if (td->flag & TD_MIRROR_EDGE) {
|
||||
td->loc[0] = 0;
|
||||
}
|
||||
@ -252,11 +252,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
|
||||
@ -267,26 +267,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]
|
||||
@ -294,7 +294,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
|
||||
@ -309,9 +309,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;
|
||||
}
|
||||
@ -340,12 +340,12 @@ static void recalcData_actedit(TransInfo *t)
|
||||
{
|
||||
Scene *scene = t->scene;
|
||||
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;
|
||||
@ -355,9 +355,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 */
|
||||
@ -367,8 +367,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) {
|
||||
@ -377,7 +377,7 @@ static void recalcData_actedit(TransInfo *t)
|
||||
ANIM_list_elem_update(t->scene, ale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now free temp channels */
|
||||
ANIM_animdata_freelist(&anim_data);
|
||||
}
|
||||
@ -387,11 +387,11 @@ static void recalcData_graphedit(TransInfo *t)
|
||||
{
|
||||
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
|
||||
Scene *scene;
|
||||
|
||||
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimContext ac = {NULL};
|
||||
int filter;
|
||||
|
||||
|
||||
bAnimListElem *ale;
|
||||
int dosort = 0;
|
||||
|
||||
@ -404,20 +404,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;
|
||||
@ -427,17 +427,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);
|
||||
}
|
||||
@ -450,7 +450,7 @@ static void recalcData_nla(TransInfo *t)
|
||||
Scene *scene = t->scene;
|
||||
double secf = FPS;
|
||||
int i;
|
||||
|
||||
|
||||
/* for each strip we've got, perform some additional validation of the values that got set before
|
||||
* using RNA to set the value (which does some special operations when setting these values to make
|
||||
* sure that everything works ok)
|
||||
@ -460,48 +460,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
|
||||
*
|
||||
@ -510,7 +510,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
|
||||
@ -528,21 +528,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
|
||||
*/
|
||||
@ -555,7 +555,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 */
|
||||
{
|
||||
@ -570,12 +570,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]);
|
||||
@ -584,36 +584,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
|
||||
*/
|
||||
@ -624,7 +624,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++;
|
||||
}
|
||||
@ -635,14 +635,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--;
|
||||
}
|
||||
@ -674,11 +674,11 @@ static void recalcData_image(TransInfo *t)
|
||||
}
|
||||
else if (t->obedit && 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();
|
||||
|
||||
|
||||
DAG_id_tag_update(t->obedit->data, 0);
|
||||
}
|
||||
}
|
||||
@ -739,14 +739,14 @@ static void recalcData_objects(TransInfo *t)
|
||||
Curve *cu = t->obedit->data;
|
||||
ListBase *nurbs = BKE_curve_editNurbs_get(cu);
|
||||
Nurb *nu = nurbs->first;
|
||||
|
||||
|
||||
if (t->state != TRANS_CANCEL) {
|
||||
clipMirrorModifier(t, t->obedit);
|
||||
applyProject(t);
|
||||
}
|
||||
|
||||
|
||||
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
||||
|
||||
|
||||
if (t->state == TRANS_CANCEL) {
|
||||
while (nu) {
|
||||
BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
|
||||
@ -764,13 +764,13 @@ static void recalcData_objects(TransInfo *t)
|
||||
}
|
||||
else if (t->obedit->type == OB_LATTICE) {
|
||||
Lattice *la = t->obedit->data;
|
||||
|
||||
|
||||
if (t->state != TRANS_CANCEL) {
|
||||
applyProject(t);
|
||||
}
|
||||
|
||||
|
||||
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
||||
|
||||
|
||||
if (la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
|
||||
}
|
||||
else if (t->obedit->type == OB_MESH) {
|
||||
@ -792,7 +792,7 @@ static void recalcData_objects(TransInfo *t)
|
||||
}
|
||||
|
||||
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
||||
|
||||
|
||||
EDBM_mesh_normals_update(em);
|
||||
BKE_editmesh_tessface_calc(em);
|
||||
}
|
||||
@ -802,15 +802,15 @@ static void recalcData_objects(TransInfo *t)
|
||||
EditBone *ebo, *ebo_parent;
|
||||
TransData *td = t->data;
|
||||
int i;
|
||||
|
||||
|
||||
if (t->state != TRANS_CANCEL) {
|
||||
applyProject(t);
|
||||
}
|
||||
|
||||
|
||||
/* Ensure all bones are correctly adjusted */
|
||||
for (ebo = edbo->first; ebo; ebo = ebo->next) {
|
||||
ebo_parent = (ebo->flag & BONE_CONNECTED) ? ebo->parent : NULL;
|
||||
|
||||
|
||||
if (ebo_parent) {
|
||||
/* If this bone has a parent tip that has been moved */
|
||||
if (ebo_parent->flag & BONE_TIPSEL) {
|
||||
@ -823,7 +823,7 @@ static void recalcData_objects(TransInfo *t)
|
||||
if (t->mode == TFM_BONE_ENVELOPE) ebo_parent->rad_tail = ebo->rad_head;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* on extrude bones, oldlength==0.0f, so we scale radius of points */
|
||||
ebo->length = len_v3v3(ebo->head, ebo->tail);
|
||||
if (ebo->oldlength == 0.0f) {
|
||||
@ -847,7 +847,7 @@ static void recalcData_objects(TransInfo *t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!ELEM(t->mode, TFM_BONE_ROLL, TFM_BONE_ENVELOPE, TFM_BONE_ENVELOPE_DIST, TFM_BONESIZE)) {
|
||||
/* fix roll */
|
||||
for (i = 0; i < t->total; i++, td++) {
|
||||
@ -855,7 +855,7 @@ static void recalcData_objects(TransInfo *t)
|
||||
float vec[3], up_axis[3];
|
||||
float qrot[4];
|
||||
float roll;
|
||||
|
||||
|
||||
ebo = td->extra;
|
||||
|
||||
if (t->state == TRANS_CANCEL) {
|
||||
@ -877,7 +877,7 @@ static void recalcData_objects(TransInfo *t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (arm->flag & ARM_MIRROR_EDIT) {
|
||||
if (t->state != TRANS_CANCEL)
|
||||
ED_armature_edit_transform_mirror_update(t->obedit);
|
||||
@ -895,7 +895,7 @@ static void recalcData_objects(TransInfo *t)
|
||||
else if ((t->flag & T_POSE) && t->poseobj) {
|
||||
Object *ob = t->poseobj;
|
||||
bArmature *arm = ob->data;
|
||||
|
||||
|
||||
/* if animtimer is running, and the object already has animation data,
|
||||
* check if the auto-record feature means that we should record 'samples'
|
||||
* (i.e. uneditable animation values)
|
||||
@ -905,11 +905,11 @@ static void recalcData_objects(TransInfo *t)
|
||||
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
||||
if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) {
|
||||
int targetless_ik = (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
|
||||
|
||||
|
||||
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
||||
autokeyframe_pose_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
|
||||
}
|
||||
|
||||
|
||||
/* old optimize trick... this enforces to bypass the depgraph */
|
||||
if (!(arm->flag & ARM_DELAYDEFORM)) {
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
|
||||
@ -927,21 +927,21 @@ static void recalcData_objects(TransInfo *t)
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
|
||||
|
||||
if (t->state != TRANS_CANCEL) {
|
||||
applyProject(t);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < t->total; i++) {
|
||||
TransData *td = t->data + i;
|
||||
Object *ob = td->ob;
|
||||
|
||||
|
||||
if (td->flag & TD_NOACTION)
|
||||
break;
|
||||
|
||||
|
||||
if (td->flag & TD_SKIP)
|
||||
continue;
|
||||
|
||||
|
||||
/* if animtimer is running, and the object already has animation data,
|
||||
* check if the auto-record feature means that we should record 'samples'
|
||||
* (i.e. uneditable animation values)
|
||||
@ -951,8 +951,8 @@ static void recalcData_objects(TransInfo *t)
|
||||
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
||||
autokeyframe_ob_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode);
|
||||
}
|
||||
|
||||
/* sets recalc flags fully, instead of flushing existing ones
|
||||
|
||||
/* sets recalc flags fully, instead of flushing existing ones
|
||||
* otherwise proxies don't function correctly
|
||||
*/
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
|
||||
@ -1054,18 +1054,18 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = t->view;
|
||||
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
|
||||
//if (t->obedit) glLoadMatrixf(t->obedit->obmat); // sets opengl viewing
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
@ -1074,13 +1074,13 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
|
||||
}
|
||||
UI_make_axis_color(col, col2, axis);
|
||||
glColor3ubv(col2);
|
||||
|
||||
|
||||
setlinestyle(0);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3fv(v1);
|
||||
glVertex3fv(v2);
|
||||
glEnd();
|
||||
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
@ -1134,7 +1134,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
bGPdata *gpd = CTX_data_gpencil_data(C);
|
||||
PropertyRNA *prop;
|
||||
|
||||
|
||||
t->scene = sce;
|
||||
t->sa = sa;
|
||||
t->ar = ar;
|
||||
@ -1149,13 +1149,13 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
|
||||
t->data = NULL;
|
||||
t->ext = NULL;
|
||||
|
||||
|
||||
t->helpline = HLP_NONE;
|
||||
|
||||
|
||||
t->flag = 0;
|
||||
|
||||
|
||||
t->redraw = TREDRAW_HARD; /* redraw first time */
|
||||
|
||||
|
||||
if (event) {
|
||||
t->mouse.imval[0] = event->mval[0];
|
||||
t->mouse.imval[1] = event->mval[1];
|
||||
@ -1164,18 +1164,18 @@ 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->total = 0;
|
||||
|
||||
|
||||
t->val = 0.0f;
|
||||
|
||||
zero_v3(t->vec);
|
||||
@ -1183,7 +1183,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
zero_v3(t->center_global);
|
||||
|
||||
unit_m3(t->mat);
|
||||
|
||||
|
||||
/* if there's an event, we're modal */
|
||||
if (event) {
|
||||
t->flag |= T_MODAL;
|
||||
@ -1201,7 +1201,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;
|
||||
@ -1238,10 +1238,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 */
|
||||
// FIXME: but don't do this when USING the manipulator...
|
||||
if (t->flag & T_MODAL) {
|
||||
@ -1251,7 +1251,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
|
||||
if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
|
||||
t->around = v3d->around;
|
||||
|
||||
|
||||
/* bend always uses the cursor */
|
||||
if (t->mode == TFM_BEND) {
|
||||
t->around = V3D_AROUND_CURSOR;
|
||||
@ -1383,7 +1383,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)) {
|
||||
@ -1420,7 +1420,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)))
|
||||
{
|
||||
@ -1429,14 +1429,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)))
|
||||
{
|
||||
@ -1449,7 +1449,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) {
|
||||
@ -1473,7 +1473,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
void postTrans(bContext *C, TransInfo *t)
|
||||
{
|
||||
TransData *td;
|
||||
|
||||
|
||||
if (t->draw_handle_view)
|
||||
ED_region_draw_cb_exit(t->ar->type, t->draw_handle_view);
|
||||
if (t->draw_handle_apply)
|
||||
@ -1501,7 +1501,7 @@ void postTrans(bContext *C, TransInfo *t)
|
||||
|
||||
/* postTrans can be called when nothing is selected, so data is NULL already */
|
||||
if (t->data) {
|
||||
|
||||
|
||||
/* free data malloced per trans-data */
|
||||
if ((t->obedit && ELEM(t->obedit->type, OB_CURVE, OB_SURF)) ||
|
||||
(t->spacetype == SPACE_IPO))
|
||||
@ -1515,7 +1515,7 @@ void postTrans(bContext *C, TransInfo *t)
|
||||
}
|
||||
MEM_freeN(t->data);
|
||||
}
|
||||
|
||||
|
||||
BLI_freelistN(&t->tsnap.points);
|
||||
|
||||
if (t->ext) MEM_freeN(t->ext);
|
||||
@ -1523,7 +1523,7 @@ void postTrans(bContext *C, TransInfo *t)
|
||||
MEM_freeN(t->data2d);
|
||||
t->data2d = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (t->spacetype == SPACE_IMAGE) {
|
||||
if (t->options & (CTX_MASK | CTX_PAINT_CURVE)) {
|
||||
/* pass */
|
||||
@ -1541,7 +1541,7 @@ void postTrans(bContext *C, TransInfo *t)
|
||||
v3d->twtype = t->twtype;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (t->mouse.data) {
|
||||
MEM_freeN(t->mouse.data);
|
||||
}
|
||||
@ -1552,7 +1552,7 @@ void postTrans(bContext *C, TransInfo *t)
|
||||
void applyTransObjects(TransInfo *t)
|
||||
{
|
||||
TransData *td;
|
||||
|
||||
|
||||
for (td = t->data; td < t->data + t->total; td++) {
|
||||
copy_v3_v3(td->iloc, td->loc);
|
||||
if (td->ext->rot) {
|
||||
@ -1593,7 +1593,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;
|
||||
@ -1608,7 +1608,7 @@ void restoreTransObjects(TransInfo *t)
|
||||
for (td = t->data; td < t->data + t->total; td++) {
|
||||
restoreElement(td);
|
||||
}
|
||||
|
||||
|
||||
for (td2d = t->data2d; t->data2d && td2d < t->data2d + t->total; td2d++) {
|
||||
if (td2d->h1) {
|
||||
td2d->h1[0] = td2d->ih1[0];
|
||||
@ -1621,7 +1621,7 @@ void restoreTransObjects(TransInfo *t)
|
||||
}
|
||||
|
||||
unit_m3(t->mat);
|
||||
|
||||
|
||||
recalcData(t);
|
||||
}
|
||||
|
||||
@ -1632,7 +1632,7 @@ void calculateCenter2D(TransInfo *t)
|
||||
if (t->flag & (T_EDIT | T_POSE)) {
|
||||
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
||||
float vec[3];
|
||||
|
||||
|
||||
copy_v3_v3(vec, t->center);
|
||||
mul_m4_v3(ob->obmat, vec);
|
||||
projectFloatView(t, vec, t->center2d);
|
||||
@ -1660,15 +1660,15 @@ void calculateCenterGlobal(
|
||||
void calculateCenterCursor(TransInfo *t, float r_center[3])
|
||||
{
|
||||
const float *cursor;
|
||||
|
||||
|
||||
cursor = ED_view3d_cursor3d_get(t->scene, t->view);
|
||||
copy_v3_v3(r_center, cursor);
|
||||
|
||||
|
||||
/* If edit or pose mode, move cursor in local space */
|
||||
if (t->flag & (T_EDIT | T_POSE)) {
|
||||
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
||||
float mat[3][3], imat[3][3];
|
||||
|
||||
|
||||
sub_v3_v3v3(r_center, r_center, ob->obmat[3]);
|
||||
copy_m3_m4(mat, ob->obmat);
|
||||
invert_m3_m3(imat, mat);
|
||||
@ -1686,7 +1686,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;
|
||||
@ -1732,7 +1732,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;
|
||||
@ -1749,7 +1749,7 @@ void calculateCenterMedian(TransInfo *t, float r_center[3])
|
||||
float partial[3] = {0.0f, 0.0f, 0.0f};
|
||||
int total = 0;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < t->total; i++) {
|
||||
if (t->data[i].flag & TD_SELECTED) {
|
||||
if (!(t->data[i].flag & TD_NOCENTER)) {
|
||||
@ -1883,20 +1883,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[0] - 6.0f * axis[0];
|
||||
axis[1] = t->center[1] - 6.0f * axis[1];
|
||||
axis[2] = t->center[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, axis);
|
||||
@ -1905,7 +1905,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() */
|
||||
|
||||
@ -1969,14 +1969,14 @@ void calculatePropRatio(TransInfo *t)
|
||||
* that means we can stop when it finds one element outside of the propsize.
|
||||
* do not set 'td->flag |= TD_NOACTION', the prop circle is being changed.
|
||||
*/
|
||||
|
||||
|
||||
td->factor = 0.0f;
|
||||
restoreElement(td);
|
||||
}
|
||||
else {
|
||||
/* Use rdist for falloff calculations, it is the real distance */
|
||||
td->flag &= ~TD_NOACTION;
|
||||
|
||||
|
||||
if (connected)
|
||||
dist = (t->prop_size - td->dist) / t->prop_size;
|
||||
else
|
||||
@ -1989,7 +1989,7 @@ void calculatePropRatio(TransInfo *t)
|
||||
*/
|
||||
if (dist < 0.0f)
|
||||
dist = 0.0f;
|
||||
|
||||
|
||||
switch (t->prop_mode) {
|
||||
case PROP_SHARP:
|
||||
td->factor = dist * dist;
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "transform.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
/* ************************** INPUT FROM MOUSE *************************** */
|
||||
|
||||
@ -125,7 +125,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];
|
||||
@ -140,7 +140,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];
|
||||
|
@ -611,7 +611,7 @@ static int calc_manipulator_stats(const bContext *C, struct TransformBounds *tbo
|
||||
if (ob && totsel && !is_gp_edit) {
|
||||
|
||||
switch (v3d->twmode) {
|
||||
|
||||
|
||||
case V3D_MANIP_GLOBAL:
|
||||
{
|
||||
break; /* nothing to do */
|
||||
@ -1035,7 +1035,7 @@ static void draw_manipulator_rotate(
|
||||
|
||||
|
||||
ortho = is_orthogonal_m4(rv3d->twmat);
|
||||
|
||||
|
||||
/* apply the transform delta */
|
||||
if (is_moving) {
|
||||
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
|
||||
|
@ -163,7 +163,7 @@ static int select_orientation_exec(bContext *C, wmOperator *op)
|
||||
int orientation = RNA_enum_get(op->ptr, "orientation");
|
||||
|
||||
BIF_selectTransformOrientationValue(C, orientation);
|
||||
|
||||
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@ -209,7 +209,7 @@ static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
|
||||
|
||||
BIF_removeTransformOrientationIndex(C, selected_index);
|
||||
|
||||
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
|
||||
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
|
||||
|
||||
@ -225,15 +225,15 @@ static int delete_orientation_poll(bContext *C)
|
||||
{
|
||||
int selected_index = -1;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
|
||||
if (ED_operator_areaactive(C) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
|
||||
if (v3d) {
|
||||
selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
|
||||
}
|
||||
|
||||
|
||||
return selected_index >= 0;
|
||||
}
|
||||
|
||||
@ -270,7 +270,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;
|
||||
}
|
||||
|
||||
@ -470,7 +470,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;
|
||||
@ -541,7 +541,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);
|
||||
@ -550,11 +550,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");
|
||||
@ -606,7 +606,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;
|
||||
|
||||
@ -637,7 +637,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;
|
||||
|
||||
@ -702,7 +702,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;
|
||||
|
||||
@ -805,7 +805,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;
|
||||
@ -846,7 +846,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;
|
||||
|
||||
@ -1023,7 +1023,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);
|
||||
|
||||
@ -1036,7 +1036,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);
|
||||
@ -1079,41 +1079,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;
|
||||
|
@ -67,7 +67,7 @@ void BIF_clearTransformOrientation(bContext *C)
|
||||
|
||||
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
||||
BLI_freelistN(transform_spaces);
|
||||
|
||||
|
||||
// Need to loop over all view3d
|
||||
if (v3d && v3d->twmode >= V3D_MANIP_CUSTOM) {
|
||||
v3d->twmode = V3D_MANIP_GLOBAL; /* fallback to global */
|
||||
@ -188,14 +188,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";
|
||||
}
|
||||
@ -205,7 +205,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";
|
||||
}
|
||||
@ -215,7 +215,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";
|
||||
}
|
||||
@ -230,7 +230,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 */
|
||||
@ -246,7 +246,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;
|
||||
}
|
||||
|
||||
@ -272,13 +272,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;
|
||||
}
|
||||
|
||||
@ -417,7 +417,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;
|
||||
@ -434,7 +434,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;
|
||||
}
|
||||
|
||||
@ -465,7 +465,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);
|
||||
@ -473,9 +473,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))
|
||||
@ -598,10 +598,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);
|
||||
|
||||
@ -611,12 +611,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;
|
||||
@ -641,7 +641,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) {
|
||||
@ -702,7 +702,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;
|
||||
@ -932,7 +932,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is_zero_v3(normal)) {
|
||||
result = ORIENTATION_FACE;
|
||||
}
|
||||
@ -942,7 +942,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]);
|
||||
@ -990,7 +990,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ok) {
|
||||
if (!is_zero_v3(plane)) {
|
||||
result = ORIENTATION_EDGE;
|
||||
@ -1047,12 +1047,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;
|
||||
}
|
||||
}
|
||||
@ -1076,14 +1076,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;
|
||||
}
|
||||
|
||||
|
@ -112,12 +112,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
|
||||
@ -137,19 +137,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;
|
||||
@ -157,13 +157,13 @@ 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);
|
||||
|
||||
|
||||
for (p = t->tsnap.points.first; p; p = p->next) {
|
||||
if (p == t->tsnap.selectedPoint) {
|
||||
glColor4ubv(selectedCol);
|
||||
@ -171,20 +171,20 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
|
||||
else {
|
||||
glColor4ubv(col);
|
||||
}
|
||||
|
||||
|
||||
drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size * 0.75f, imat);
|
||||
}
|
||||
|
||||
|
||||
if (t->tsnap.status & POINT_INIT) {
|
||||
glColor4ubv(activeCol);
|
||||
|
||||
|
||||
drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat);
|
||||
}
|
||||
|
||||
|
||||
/* draw normal if needed */
|
||||
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
|
||||
glColor4ubv(activeCol);
|
||||
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
|
||||
glVertex3f(t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
|
||||
@ -192,7 +192,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
|
||||
t->tsnap.snapPoint[2] + t->tsnap.snapNormal[2]);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
if (v3d->zbuf)
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
@ -204,28 +204,28 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
|
||||
float xuser_asp, yuser_asp;
|
||||
int wi, hi;
|
||||
float w, h;
|
||||
|
||||
|
||||
calc_image_view(G.sima, 'f'); // float
|
||||
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
ED_space_image_get_aspect(t->sa->spacedata.first, &xuser_aspx, &yuser_asp);
|
||||
ED_space_image_width(t->sa->spacedata.first, &wi, &hi);
|
||||
w = (((float)wi) / IMG_SIZE_FALLBACK) * G.sima->zoom * xuser_asp;
|
||||
h = (((float)hi) / IMG_SIZE_FALLBACK) * G.sima->zoom * yuser_asp;
|
||||
|
||||
|
||||
cpack(0xFFFFFF);
|
||||
glTranslate2fv(t->tsnap.snapPoint);
|
||||
|
||||
|
||||
//glRectf(0, 0, 1, 1);
|
||||
|
||||
|
||||
setlinestyle(0);
|
||||
cpack(0x0);
|
||||
fdrawline(-0.020 / w, 0, -0.1 / w, 0);
|
||||
fdrawline(0.1 / w, 0, 0.020 / w, 0);
|
||||
fdrawline(0, -0.020 / h, 0, -0.1 / h);
|
||||
fdrawline(0, 0.1 / h, 0, 0.020 / h);
|
||||
|
||||
|
||||
glTranslatef(-t->tsnap.snapPoint[0], -t->tsnap.snapPoint[1], 0.0f);
|
||||
setlinestyle(0);
|
||||
#endif
|
||||
@ -236,11 +236,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);
|
||||
|
||||
|
||||
for (p = t->tsnap.points.first; p; p = p->next) {
|
||||
if (p == t->tsnap.selectedPoint) {
|
||||
glColor4ubv(selectedCol);
|
||||
@ -248,16 +248,16 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
|
||||
else {
|
||||
glColor4ubv(col);
|
||||
}
|
||||
|
||||
|
||||
ED_node_draw_snap(&ar->v2d, p->co, size, 0);
|
||||
}
|
||||
|
||||
|
||||
if (t->tsnap.status & POINT_INIT) {
|
||||
glColor4ubv(activeCol);
|
||||
|
||||
|
||||
ED_node_draw_snap(&ar->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder);
|
||||
}
|
||||
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
@ -278,7 +278,7 @@ eRedrawFlag handleSnapping(TransInfo *t, const wmEvent *event)
|
||||
if (event->type == MOUSEMOVE) {
|
||||
status |= updateSelectedSnapPoint(t);
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ void applyProject(TransInfo *t)
|
||||
float tvec[3];
|
||||
float imat[4][4];
|
||||
int i;
|
||||
|
||||
|
||||
if (t->flag & (T_EDIT | T_POSE)) {
|
||||
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
||||
invert_m4_m4(imat, ob->obmat);
|
||||
@ -300,16 +300,16 @@ void applyProject(TransInfo *t)
|
||||
float iloc[3], loc[3], no[3];
|
||||
float mval_fl[2];
|
||||
float dist_px = TRANSFORM_DIST_MAX_PX;
|
||||
|
||||
|
||||
if (td->flag & TD_NOACTION)
|
||||
break;
|
||||
|
||||
|
||||
if (td->flag & TD_SKIP)
|
||||
continue;
|
||||
|
||||
if ((t->flag & T_PROP_EDIT) && (td->factor == 0.0f))
|
||||
continue;
|
||||
|
||||
|
||||
copy_v3_v3(iloc, td->loc);
|
||||
if (t->flag & (T_EDIT | T_POSE)) {
|
||||
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
||||
@ -319,7 +319,7 @@ void applyProject(TransInfo *t)
|
||||
BKE_object_eval_transform_all(G.main->eval_ctx, t->scene, td->ob);
|
||||
copy_v3_v3(iloc, td->ob->obmat[3]);
|
||||
}
|
||||
|
||||
|
||||
if (ED_view3d_project_float_global(t->ar, iloc, mval_fl, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||
if (snapObjectsTransform(
|
||||
t, mval_fl, &dist_px,
|
||||
@ -351,7 +351,7 @@ void applyProject(TransInfo *t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//XXX constraintTransLim(t, td);
|
||||
}
|
||||
}
|
||||
@ -365,14 +365,14 @@ void applyGridAbsolute(TransInfo *t)
|
||||
float (*obmat)[4] = NULL;
|
||||
bool use_obmat = false;
|
||||
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;
|
||||
@ -381,25 +381,25 @@ void applyGridAbsolute(TransInfo *t)
|
||||
/* early exit on unusable grid size */
|
||||
if (grid_size == 0.0f)
|
||||
return;
|
||||
|
||||
|
||||
if (t->flag & (T_EDIT | T_POSE)) {
|
||||
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
||||
obmat = ob->obmat;
|
||||
use_obmat = true;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0, td = t->data; i < t->total; i++, td++) {
|
||||
float iloc[3], loc[3], tvec[3];
|
||||
|
||||
|
||||
if (td->flag & TD_NOACTION)
|
||||
break;
|
||||
|
||||
|
||||
if (td->flag & TD_SKIP)
|
||||
continue;
|
||||
|
||||
|
||||
if ((t->flag & T_PROP_EDIT) && (td->factor == 0.0f))
|
||||
continue;
|
||||
|
||||
|
||||
copy_v3_v3(iloc, td->loc);
|
||||
if (use_obmat) {
|
||||
mul_m4_v3(obmat, iloc);
|
||||
@ -408,7 +408,7 @@ void applyGridAbsolute(TransInfo *t)
|
||||
BKE_object_eval_transform_all(G.main->eval_ctx, t->scene, td->ob);
|
||||
copy_v3_v3(iloc, td->ob->obmat[3]);
|
||||
}
|
||||
|
||||
|
||||
mul_v3_v3fl(loc, iloc, 1.0f / grid_size);
|
||||
loc[0] = roundf(loc[0]);
|
||||
loc[1] = roundf(loc[1]);
|
||||
@ -426,21 +426,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)) {
|
||||
@ -463,7 +463,7 @@ void resetSnapping(TransInfo *t)
|
||||
t->tsnap.snapNormal[0] = 0;
|
||||
t->tsnap.snapNormal[1] = 0;
|
||||
t->tsnap.snapNormal[2] = 0;
|
||||
|
||||
|
||||
t->tsnap.snapNodeBorder = 0;
|
||||
}
|
||||
|
||||
@ -479,7 +479,7 @@ bool validSnappingNormal(TransInfo *t)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -522,20 +522,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;
|
||||
}
|
||||
|
||||
@ -577,7 +577,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;
|
||||
}
|
||||
@ -615,9 +615,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")) {
|
||||
@ -626,12 +626,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");
|
||||
@ -666,7 +666,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);
|
||||
@ -884,24 +884,24 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3])
|
||||
|
||||
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, 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
|
||||
@ -909,22 +909,22 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3])
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@ -941,7 +941,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),
|
||||
@ -965,10 +965,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,
|
||||
@ -981,7 +981,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);
|
||||
@ -996,7 +996,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, t->obedit, ima, co, t->tsnap.snapPoint)) {
|
||||
@ -1013,11 +1013,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 {
|
||||
@ -1035,7 +1035,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;
|
||||
@ -1064,7 +1064,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;
|
||||
}
|
||||
}
|
||||
@ -1102,20 +1102,20 @@ static void TargetSnapMedian(TransInfo *t)
|
||||
t->tsnap.snapTarget[0] = 0;
|
||||
t->tsnap.snapTarget[1] = 0;
|
||||
t->tsnap.snapTarget[2] = 0;
|
||||
|
||||
|
||||
for (td = t->data, i = 0; i < t->total && td->flag & TD_SELECTED; i++, td++) {
|
||||
add_v3_v3(t->tsnap.snapTarget, td->center);
|
||||
}
|
||||
|
||||
|
||||
mul_v3_fl(t->tsnap.snapTarget, 1.0 / i);
|
||||
|
||||
|
||||
if (t->flag & (T_EDIT | T_POSE)) {
|
||||
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
||||
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
|
||||
}
|
||||
|
||||
|
||||
TargetSnapOffset(t, NULL);
|
||||
|
||||
|
||||
t->tsnap.status |= TARGET_INIT;
|
||||
}
|
||||
}
|
||||
@ -1126,24 +1126,24 @@ static void TargetSnapClosest(TransInfo *t)
|
||||
if (t->tsnap.status & POINT_INIT) {
|
||||
float dist_closest = 0.0f;
|
||||
TransData *closest = NULL, *td = NULL;
|
||||
|
||||
|
||||
/* Object mode */
|
||||
if (t->flag & T_OBJECT) {
|
||||
int i;
|
||||
for (td = t->data, i = 0; i < t->total && td->flag & TD_SELECTED; i++, td++) {
|
||||
struct BoundBox *bb = BKE_object_boundbox_get(td->ob);
|
||||
|
||||
|
||||
/* use boundbox if possible */
|
||||
if (bb) {
|
||||
int j;
|
||||
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
float loc[3];
|
||||
float dist;
|
||||
|
||||
|
||||
copy_v3_v3(loc, bb->vec[j]);
|
||||
mul_m4_v3(td->ext->obmat, loc);
|
||||
|
||||
|
||||
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
|
||||
|
||||
if ((dist != TRANSFORM_DIST_INVALID) &&
|
||||
@ -1159,9 +1159,9 @@ static void TargetSnapClosest(TransInfo *t)
|
||||
else {
|
||||
float loc[3];
|
||||
float dist;
|
||||
|
||||
|
||||
copy_v3_v3(loc, td->center);
|
||||
|
||||
|
||||
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
|
||||
|
||||
if ((dist != TRANSFORM_DIST_INVALID) &&
|
||||
@ -1178,16 +1178,16 @@ static void TargetSnapClosest(TransInfo *t)
|
||||
for (td = t->data, i = 0; i < t->total && td->flag & TD_SELECTED; i++, td++) {
|
||||
float loc[3];
|
||||
float dist;
|
||||
|
||||
|
||||
copy_v3_v3(loc, td->center);
|
||||
|
||||
|
||||
if (t->flag & (T_EDIT | T_POSE)) {
|
||||
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
||||
mul_m4_v3(ob->obmat, loc);
|
||||
}
|
||||
|
||||
|
||||
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
|
||||
|
||||
|
||||
if ((dist != TRANSFORM_DIST_INVALID) &&
|
||||
(closest == NULL || fabsf(dist) < fabsf(dist_closest)))
|
||||
{
|
||||
@ -1197,9 +1197,9 @@ static void TargetSnapClosest(TransInfo *t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TargetSnapOffset(t, closest);
|
||||
|
||||
|
||||
t->tsnap.status |= TARGET_INIT;
|
||||
}
|
||||
}
|
||||
@ -1344,9 +1344,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) {
|
||||
@ -1356,7 +1356,7 @@ static bool snapNode(
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (border & NODE_RIGHT) {
|
||||
new_dist = abs(totr.xmax - mval[0]);
|
||||
if (new_dist < *r_dist_px) {
|
||||
@ -1366,7 +1366,7 @@ static bool snapNode(
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (border & NODE_BOTTOM) {
|
||||
new_dist = abs(totr.ymin - mval[1]);
|
||||
if (new_dist < *r_dist_px) {
|
||||
@ -1376,7 +1376,7 @@ static bool snapNode(
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (border & NODE_TOP) {
|
||||
new_dist = abs(totr.ymax - mval[1]);
|
||||
if (new_dist < *r_dist_px) {
|
||||
@ -1386,7 +1386,7 @@ static bool snapNode(
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1398,15 +1398,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;
|
||||
}
|
||||
|
||||
@ -1431,7 +1431,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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user