Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r--source/blender/editors/transform/transform_constraints.c66
1 files changed, 44 insertions, 22 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 9414d5862b6..ee08eb20ea3 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -129,14 +129,17 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
snapGridIncrement(t, vec);
if (t->flag & T_NULL_ONE) {
- if (!(t->con.mode & CON_AXIS0))
+ if (!(t->con.mode & CON_AXIS0)) {
vec[0] = 1.0f;
+ }
- if (!(t->con.mode & CON_AXIS1))
+ if (!(t->con.mode & CON_AXIS1)) {
vec[1] = 1.0f;
+ }
- if (!(t->con.mode & CON_AXIS2))
+ if (!(t->con.mode & CON_AXIS2)) {
vec[2] = 1.0f;
+ }
}
if (applyNumInput(&t->num, vec)) {
@@ -221,10 +224,12 @@ static void axisProjection(const TransInfo *t,
factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
/* Since camera distance is quite relative, use quadratic relationship.
* holding shift can compensate. */
- if (factor < 0.0f)
+ if (factor < 0.0f) {
factor *= -factor;
- else
+ }
+ else {
factor *= factor;
+ }
/* -factor makes move down going backwards */
normalize_v3_v3_length(out, axis, -factor);
@@ -267,12 +272,15 @@ static void axisProjection(const TransInfo *t,
/* possible some values become nan when
* viewpoint and object are both zero */
- if (!isfinite(out[0]))
+ if (!isfinite(out[0])) {
out[0] = 0.0f;
- if (!isfinite(out[1]))
+ }
+ if (!isfinite(out[1])) {
out[1] = 0.0f;
- if (!isfinite(out[2]))
+ }
+ if (!isfinite(out[2])) {
out[2] = 0.0f;
+ }
}
}
}
@@ -741,12 +749,15 @@ void drawConstraint(TransInfo *t)
{
TransCon *tc = &(t->con);
- if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE))
+ if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE)) {
return;
- if (!(tc->mode & CON_APPLY))
+ }
+ if (!(tc->mode & CON_APPLY)) {
return;
- if (t->flag & T_NO_CONSTRAINT)
+ }
+ if (t->flag & T_NO_CONSTRAINT) {
return;
+ }
if (tc->drawExtra) {
tc->drawExtra(t);
@@ -764,8 +775,9 @@ void drawConstraint(TransInfo *t)
drawLine(t, t->center_global, tc->mtx[2], 'Z', 0);
depth_test_enabled = GPU_depth_test_enabled();
- if (depth_test_enabled)
+ if (depth_test_enabled) {
GPU_depth_test(false);
+ }
const uint shdr_pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
@@ -788,8 +800,9 @@ void drawConstraint(TransInfo *t)
immUnbindProgram();
- if (depth_test_enabled)
+ if (depth_test_enabled) {
GPU_depth_test(true);
+ }
}
if (tc->mode & CON_AXIS0) {
@@ -841,8 +854,9 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
}
depth_test_enabled = GPU_depth_test_enabled();
- if (depth_test_enabled)
+ if (depth_test_enabled) {
GPU_depth_test(false);
+ }
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
@@ -855,8 +869,9 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
immUnbindProgram();
- if (depth_test_enabled)
+ if (depth_test_enabled) {
GPU_depth_test(true);
+ }
GPU_matrix_pop();
}
@@ -990,8 +1005,9 @@ void selectConstraint(TransInfo *t)
void postSelectConstraint(TransInfo *t)
{
- if (!(t->con.mode & CON_SELECT))
+ if (!(t->con.mode & CON_SELECT)) {
return;
+ }
t->con.mode &= ~CON_AXIS0;
t->con.mode &= ~CON_AXIS1;
@@ -1150,14 +1166,17 @@ bool isLockConstraint(TransInfo *t)
{
int mode = t->con.mode;
- if ((mode & (CON_AXIS0 | CON_AXIS1)) == (CON_AXIS0 | CON_AXIS1))
+ if ((mode & (CON_AXIS0 | CON_AXIS1)) == (CON_AXIS0 | CON_AXIS1)) {
return true;
+ }
- if ((mode & (CON_AXIS1 | CON_AXIS2)) == (CON_AXIS1 | CON_AXIS2))
+ if ((mode & (CON_AXIS1 | CON_AXIS2)) == (CON_AXIS1 | CON_AXIS2)) {
return true;
+ }
- if ((mode & (CON_AXIS0 | CON_AXIS2)) == (CON_AXIS0 | CON_AXIS2))
+ if ((mode & (CON_AXIS0 | CON_AXIS2)) == (CON_AXIS0 | CON_AXIS2)) {
return true;
+ }
return false;
}
@@ -1174,14 +1193,17 @@ int getConstraintSpaceDimension(TransInfo *t)
{
int n = 0;
- if (t->con.mode & CON_AXIS0)
+ if (t->con.mode & CON_AXIS0) {
n++;
+ }
- if (t->con.mode & CON_AXIS1)
+ if (t->con.mode & CON_AXIS1) {
n++;
+ }
- if (t->con.mode & CON_AXIS2)
+ if (t->con.mode & CON_AXIS2) {
n++;
+ }
return n;
/*