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:
authorRohan Rathi <rohanrathi08@gmail.com>2018-07-02 21:01:19 +0300
committerRohan Rathi <rohanrathi08@gmail.com>2018-07-02 21:01:19 +0300
commit31e43d021fdc55c6ec6741d382f4bbb05d1d62e9 (patch)
tree8ad72888c5516dcc0eb982d629a732c406177c83 /source/blender/editors/transform
parent368a64fe041ee0950584f5b51e2f64036edb31d0 (diff)
parent31c9bd35bc9bb913b7a786da9c80751dbc60e006 (diff)
Merge branch 'blender2.8' into soc-2018-bevel
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c141
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c19
-rw-r--r--source/blender/editors/transform/transform_conversions.c1
-rw-r--r--source/blender/editors/transform/transform_generics.c1
-rw-r--r--source/blender/editors/transform/transform_manipulator_2d.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator_3d.c136
-rw-r--r--source/blender/editors/transform/transform_ops.c9
-rw-r--r--source/blender/editors/transform/transform_snap.c10
9 files changed, 169 insertions, 156 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index acb92b1606c..ba9430c46f7 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -76,6 +76,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_image.h"
#include "ED_keyframing.h"
@@ -658,7 +659,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
static void viewRedrawPost(bContext *C, TransInfo *t)
{
- ED_area_headerprint(t->sa, NULL);
+ ED_area_status_text(t->sa, NULL);
if (t->spacetype == SPACE_VIEW3D) {
/* if autokeying is enabled, send notifiers that keyframes were added */
@@ -1723,7 +1724,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
immEnd();
}
-static int helpline_poll(bContext *C)
+static bool helpline_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
@@ -1770,15 +1771,15 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
UNUSED_VARS_NDEBUG(shdr_pos); /* silence warning */
BLI_assert(shdr_pos == POS_INDEX);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformThemeColor(TH_VIEW_OVERLAY);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -1804,7 +1805,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3fv(mval);
gpuRotateAxis(-RAD2DEGF(atan2f(cent[0] - tmval[0], cent[1] - tmval[1])), 'Z');
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArrow(UP, 5, 10, 5);
drawArrow(DOWN, 5, 10, 5);
break;
@@ -1812,7 +1813,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
immUniformThemeColor(TH_VIEW_OVERLAY);
gpuTranslate3fv(mval);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArrow(RIGHT, 5, 10, 5);
drawArrow(LEFT, 5, 10, 5);
break;
@@ -1821,7 +1822,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3fv(mval);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArrow(UP, 5, 10, 5);
drawArrow(DOWN, 5, 10, 5);
break;
@@ -1837,7 +1838,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3f(cent[0] - tmval[0] + mval[0], cent[1] - tmval[1] + mval[1], 0);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArc(dist, angle - delta_angle, angle - spacing_angle, 10);
drawArc(dist, angle + spacing_angle, angle + delta_angle, 10);
@@ -1863,16 +1864,16 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3fv(mval);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
UI_make_axis_color(col, col2, 'X');
- immUniformColor3ubv((GLubyte *)col2);
+ immUniformColor3ubv(col2);
drawArrow(RIGHT, 5, 10, 5);
drawArrow(LEFT, 5, 10, 5);
UI_make_axis_color(col, col2, 'Y');
- immUniformColor3ubv((GLubyte *)col2);
+ immUniformColor3ubv(col2);
drawArrow(UP, 5, 10, 5);
drawArrow(DOWN, 5, 10, 5);
@@ -1889,7 +1890,7 @@ static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), voi
{
TransInfo *t = arg;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
drawConstraint(t);
drawPropCircle(C, t);
@@ -1929,15 +1930,15 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
#endif
/* autokey recording icon... */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
xco -= U.widget_unit;
yco -= (int)printable_size[1] / 2;
UI_icon_draw(xco, yco, ICON_REC);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg)
@@ -1969,7 +1970,7 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- int constraint_axis[3] = {0, 0, 0};
+ bool constraint_axis[3] = {false, false, false};
int proportional = 0;
PropertyRNA *prop;
@@ -2091,13 +2092,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
if (t->con.mode & CON_APPLY) {
if (t->con.mode & CON_AXIS0) {
- constraint_axis[0] = 1;
+ constraint_axis[0] = true;
}
if (t->con.mode & CON_AXIS1) {
- constraint_axis[1] = 1;
+ constraint_axis[1] = true;
}
if (t->con.mode & CON_AXIS2) {
- constraint_axis[2] = 1;
+ constraint_axis[2] = true;
}
}
@@ -2287,7 +2288,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* Constraint init from operator */
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
- int constraint_axis[3];
+ bool constraint_axis[3];
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
@@ -3189,7 +3190,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3343,7 +3344,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3622,7 +3623,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3725,7 +3726,7 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3823,7 +3824,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4190,7 +4191,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4307,7 +4308,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4757,7 +4758,7 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4859,7 +4860,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4938,7 +4939,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5019,7 +5020,7 @@ static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5125,7 +5126,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5206,7 +5207,7 @@ static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5301,7 +5302,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5383,7 +5384,7 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5468,7 +5469,7 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5591,7 +5592,7 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5668,7 +5669,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -7165,10 +7166,10 @@ static void drawEdgeSlide(TransInfo *t)
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
if (v3d && v3d->zbuf)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
gpuPushMatrix();
gpuMultMatrix(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
@@ -7188,7 +7189,7 @@ static void drawEdgeSlide(TransInfo *t)
add_v3_v3v3(co_a, curr_sv->v_co_orig, curr_sv->dir_side[0]);
add_v3_v3v3(co_b, curr_sv->v_co_orig, curr_sv->dir_side[1]);
- glLineWidth(line_size);
+ GPU_line_width(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
immBeginAtMost(GWN_PRIM_LINES, 4);
if (curr_sv->v_side[0]) {
@@ -7202,7 +7203,7 @@ static void drawEdgeSlide(TransInfo *t)
immEnd();
immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade);
- glPointSize(ctrl_size);
+ GPU_point_size(ctrl_size);
immBegin(GWN_PRIM_POINTS, 1);
if (slp->flipped) {
if (curr_sv->v_side[1]) immVertex3fv(pos, curr_sv->v_side[1]->co);
@@ -7213,7 +7214,7 @@ static void drawEdgeSlide(TransInfo *t)
immEnd();
immUniformThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade);
- glPointSize(guide_size);
+ GPU_point_size(guide_size);
immBegin(GWN_PRIM_POINTS, 1);
interp_line_v3_v3v3v3(co_mark, co_b, curr_sv->v_co_orig, co_a, fac);
immVertex3fv(pos, co_mark);
@@ -7226,7 +7227,7 @@ static void drawEdgeSlide(TransInfo *t)
int i;
const int alpha_shade = -160;
- glLineWidth(line_size);
+ GPU_line_width(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
immBegin(GWN_PRIM_LINES, sld->totsv * 2);
@@ -7261,10 +7262,10 @@ static void drawEdgeSlide(TransInfo *t)
gpuPopMatrix();
- glDisable(GL_BLEND);
+ GPU_blend(false);
if (v3d && v3d->zbuf)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
}
@@ -7394,7 +7395,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -7801,15 +7802,15 @@ static void drawVertSlide(TransInfo *t)
int i;
if (v3d && v3d->zbuf)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
gpuPushMatrix();
gpuMultMatrix(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
- glLineWidth(line_size);
+ GPU_line_width(line_size);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
@@ -7840,7 +7841,7 @@ static void drawVertSlide(TransInfo *t)
}
immEnd();
- glPointSize(ctrl_size);
+ GPU_point_size(ctrl_size);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(shdr_pos, (slp->flipped && slp->use_even) ?
@@ -7872,15 +7873,15 @@ static void drawVertSlide(TransInfo *t)
add_v3_v3(co_dest_3d, curr_sv->co_orig_3d);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -7896,7 +7897,7 @@ static void drawVertSlide(TransInfo *t)
gpuPopMatrix();
if (v3d && v3d->zbuf)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
}
@@ -7993,7 +7994,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8067,7 +8068,7 @@ static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8158,7 +8159,7 @@ static void applyBakeTime(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8219,7 +8220,7 @@ static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
else {
size[0] = size[1] = size[2] = 1;
@@ -8242,9 +8243,9 @@ static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
if (t->flag & T_2D_EDIT)
- ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y)"));
+ ED_area_status_text(t->sa, IFACE_("Select a mirror axis (X, Y)"));
else
- ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
+ ED_area_status_text(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
}
}
/** \} */
@@ -8306,7 +8307,7 @@ static void applyAlign(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, IFACE_("Align"));
+ ED_area_status_text(t->sa, IFACE_("Align"));
}
/** \} */
@@ -8405,7 +8406,7 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8689,7 +8690,7 @@ static void applyTimeTranslate(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8879,7 +8880,7 @@ static void applyTimeSlide(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -9000,12 +9001,12 @@ static void applyTimeScale(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
-/* TODO, move to: transform_queries.c */
+/* TODO, move to: transform_query.c */
bool checkUseAxisMatrix(TransInfo *t)
{
/* currently only checks for editmode */
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index d72d311e0f6..b9fbb37722c 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -890,7 +890,7 @@ void freeVertSlideVerts(TransInfo *t, TransDataContainer *tc, TransCustomData *c
void projectVertSlideData(TransInfo *t, bool is_final);
-/* TODO. transform_queries.c */
+/* TODO. transform_query.c */
bool checkUseAxisMatrix(TransInfo *t);
#define TRANSFORM_SNAP_MAX_PX 100.0f
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 3c70eaae2d3..9df8264cc76 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -44,6 +44,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -559,7 +560,7 @@ static void applyObjectConstraintRot(
/* on setup call, use first object */
if (td == NULL) {
- td = tc->data;
+ td = TRANS_DATA_CONTAINER_FIRST_OK(t)->data;
}
if (t->flag & T_EDIT) {
@@ -742,19 +743,19 @@ void drawConstraint(TransInfo *t)
drawLine(t, t->center_global, tc->mtx[1], 'Y', 0);
drawLine(t, t->center_global, tc->mtx[2], 'Z', 0);
- depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
+ depth_test_enabled = GPU_depth_test_enabled();
if (depth_test_enabled)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
@@ -767,7 +768,7 @@ void drawConstraint(TransInfo *t)
immUnbindProgram();
if (depth_test_enabled)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
if (tc->mode & CON_AXIS0) {
@@ -818,9 +819,9 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
gpuScale2f(1.0f, (ysize / xsize) * (xmask / ymask));
}
- depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
+ depth_test_enabled = GPU_depth_test_enabled();
if (depth_test_enabled)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
@@ -834,7 +835,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
immUnbindProgram();
if (depth_test_enabled)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
gpuPopMatrix();
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 8462004c549..c622a50ff11 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -61,7 +61,6 @@
#include "BLI_bitmap.h"
#include "BLI_rect.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_constraint.h"
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 053647cbfea..db8bbe05c69 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -2336,4 +2336,3 @@ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot)
copy_v3_v3(td->ext->rot, eul);
}
}
-
diff --git a/source/blender/editors/transform/transform_manipulator_2d.c b/source/blender/editors/transform/transform_manipulator_2d.c
index d2743f47000..fd6e7ed5442 100644
--- a/source/blender/editors/transform/transform_manipulator_2d.c
+++ b/source/blender/editors/transform/transform_manipulator_2d.c
@@ -223,7 +223,7 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator
/* assign operator */
PointerRNA *ptr = WM_manipulator_operator_set(axis, 0, ot_translate, NULL);
- int constraint[3] = {0};
+ bool constraint[3] = {0};
constraint[(axis_idx + 1) % 2] = 1;
if (RNA_struct_find_property(ptr, "constraint_axis"))
RNA_boolean_set_array(ptr, "constraint_axis", constraint);
@@ -240,8 +240,8 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator
ptr = WM_manipulator_operator_set(man->cage, 0, ot_translate, NULL);
RNA_boolean_set(ptr, "release_confirm", 1);
- int constraint_x[3] = {1, 0, 0};
- int constraint_y[3] = {0, 1, 0};
+ bool constraint_x[3] = {1, 0, 0};
+ bool constraint_y[3] = {0, 1, 0};
ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X, ot_resize, NULL);
PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c
index 75da0fc2d23..8f547fb7451 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -159,18 +159,15 @@ enum {
MAN_AXES_SCALE,
};
-/* naming from old blender we may combine. */
-enum {
- V3D_MANIP_TRANSLATE = 1,
- V3D_MANIP_ROTATE = 2,
- V3D_MANIP_SCALE = 4,
-};
-
-
typedef struct ManipulatorGroup {
bool all_hidden;
int twtype;
+ /* Users may change the twtype, detect changes to re-setup manipulator options. */
+ int twtype_init;
+ int twtype_prev;
+ int use_twtype_refresh;
+
struct wmManipulator *manipulators[MAN_AXIS_LAST];
} ManipulatorGroup;
@@ -269,9 +266,9 @@ static bool manipulator_is_axis_visible(
}
}
- if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & V3D_MANIP_TRANSLATE)) ||
- (axis_type == MAN_AXES_ROTATE && !(twtype & V3D_MANIP_ROTATE)) ||
- (axis_type == MAN_AXES_SCALE && !(twtype & V3D_MANIP_SCALE)))
+ if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & SCE_MANIP_TRANSLATE)) ||
+ (axis_type == MAN_AXES_ROTATE && !(twtype & SCE_MANIP_ROTATE)) ||
+ (axis_type == MAN_AXES_SCALE && !(twtype & SCE_MANIP_SCALE)))
{
return false;
}
@@ -301,34 +298,34 @@ static bool manipulator_is_axis_visible(
case MAN_AXIS_SCALE_Z:
return (rv3d->twdrawflag & MAN_SCALE_Z);
case MAN_AXIS_SCALE_C:
- return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & V3D_MANIP_TRANSLATE) == 0);
+ return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & SCE_MANIP_TRANSLATE) == 0);
case MAN_AXIS_TRANS_XY:
return (rv3d->twdrawflag & MAN_TRANS_X &&
rv3d->twdrawflag & MAN_TRANS_Y &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_TRANS_YZ:
return (rv3d->twdrawflag & MAN_TRANS_Y &&
rv3d->twdrawflag & MAN_TRANS_Z &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_TRANS_ZX:
return (rv3d->twdrawflag & MAN_TRANS_Z &&
rv3d->twdrawflag & MAN_TRANS_X &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_XY:
return (rv3d->twdrawflag & MAN_SCALE_X &&
rv3d->twdrawflag & MAN_SCALE_Y &&
- (twtype & V3D_MANIP_TRANSLATE) == 0 &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_TRANSLATE) == 0 &&
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_YZ:
return (rv3d->twdrawflag & MAN_SCALE_Y &&
rv3d->twdrawflag & MAN_SCALE_Z &&
- (twtype & V3D_MANIP_TRANSLATE) == 0 &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_TRANSLATE) == 0 &&
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_ZX:
return (rv3d->twdrawflag & MAN_SCALE_Z &&
rv3d->twdrawflag & MAN_SCALE_X &&
- (twtype & V3D_MANIP_TRANSLATE) == 0 &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_TRANSLATE) == 0 &&
+ (twtype & SCE_MANIP_ROTATE) == 0);
}
return false;
}
@@ -404,9 +401,9 @@ static void manipulator_get_axis_color(
r_col_hi[3] = alpha_hi * alpha_fac;
}
-static void manipulator_get_axis_constraint(const int axis_idx, int r_axis[3])
+static void manipulator_get_axis_constraint(const int axis_idx, bool r_axis[3])
{
- zero_v3_int(r_axis);
+ ARRAY_SET_ITEMS(r_axis, 0, 0, 0);
switch (axis_idx) {
case MAN_AXIS_TRANS_X:
@@ -1122,15 +1119,15 @@ static void manipulator_line_range(const int twtype, const short axis_type, floa
switch (axis_type) {
case MAN_AXES_TRANSLATE:
- if (twtype & V3D_MANIP_SCALE) {
+ if (twtype & SCE_MANIP_SCALE) {
*r_start = *r_len - ofs + 0.075f;
}
- if (twtype & V3D_MANIP_ROTATE) {
+ if (twtype & SCE_MANIP_ROTATE) {
*r_len += ofs;
}
break;
case MAN_AXES_SCALE:
- if (twtype & (V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE)) {
+ if (twtype & (SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE)) {
*r_len -= ofs + 0.025f;
}
break;
@@ -1172,8 +1169,10 @@ static void manipulator_xform_message_subscribe(
if (type_fn == TRANSFORM_WGT_manipulator) {
extern PropertyRNA rna_ToolSettings_transform_pivot_point;
+ extern PropertyRNA rna_ToolSettings_use_manipulator_mode;
const PropertyRNA *props[] = {
- &rna_ToolSettings_transform_pivot_point
+ &rna_ToolSettings_transform_pivot_point,
+ &rna_ToolSettings_use_manipulator_mode,
};
for (int i = 0; i < ARRAY_SIZE(props); i++) {
WM_msg_subscribe_rna(mbus, &toolsettings_ptr, props[i], &msg_sub_value_mpr_tag_refresh, __func__);
@@ -1285,45 +1284,16 @@ static int manipulator_modal(
return OPERATOR_RUNNING_MODAL;
}
-static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup *mgroup)
+static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgroup)
{
- ManipulatorGroup *man = manipulatorgroup_init(mgroup);
struct {
wmOperatorType *translate, *rotate, *trackball, *resize;
} ot_store = {NULL};
-
- mgroup->customdata = man;
-
- {
- /* TODO: support mixing modes again? - it's supported but tool system makes it unobvious. */
- man->twtype = 0;
- ScrArea *sa = CTX_wm_area(C);
- bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
- wmKeyMap *km = tref_rt ? WM_keymap_find_all(C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW) : NULL;
- /* Weak, check first event */
- wmKeyMapItem *kmi = km ? km->items.first : NULL;
-
- if (kmi == NULL) {
- man->twtype |= V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE | V3D_MANIP_SCALE;
- }
- else if (STREQ(kmi->idname, "TRANSFORM_OT_translate")) {
- man->twtype |= V3D_MANIP_TRANSLATE;
- }
- else if (STREQ(kmi->idname, "TRANSFORM_OT_rotate")) {
- man->twtype |= V3D_MANIP_ROTATE;
- }
- else if (STREQ(kmi->idname, "TRANSFORM_OT_resize")) {
- man->twtype |= V3D_MANIP_SCALE;
- }
- BLI_assert(man->twtype != 0);
- }
-
- /* *** set properties for axes *** */
-
+ ManipulatorGroup *man = mgroup->customdata;
MAN_ITER_AXES_BEGIN(axis, axis_idx)
{
const short axis_type = manipulator_get_axis_type(axis_idx);
- int constraint_axis[3] = {1, 0, 0};
+ bool constraint_axis[3] = {1, 0, 0};
PointerRNA *ptr;
manipulator_get_axis_constraint(axis_idx, constraint_axis);
@@ -1340,7 +1310,7 @@ static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup
case MAN_AXIS_SCALE_Z:
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
int draw_options = 0;
- if ((man->twtype & (V3D_MANIP_ROTATE | V3D_MANIP_SCALE)) == 0) {
+ if ((man->twtype & (SCE_MANIP_ROTATE | SCE_MANIP_SCALE)) == 0) {
draw_options |= ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM;
}
RNA_enum_set(axis->ptr, "draw_options", draw_options);
@@ -1434,6 +1404,39 @@ static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup
MAN_ITER_AXES_END;
}
+static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup *mgroup)
+{
+ ManipulatorGroup *man = manipulatorgroup_init(mgroup);
+
+ mgroup->customdata = man;
+
+ {
+ man->twtype = 0;
+ ScrArea *sa = CTX_wm_area(C);
+ const bToolRef *tref = sa->runtime.tool;
+
+ if (tref == NULL || STREQ(tref->idname, "Transform")) {
+ /* Setup all manipulators, they can be toggled via 'ToolSettings.manipulator_flag' */
+ man->twtype = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE;
+ man->use_twtype_refresh = true;
+ }
+ else if (STREQ(tref->idname, "Move")) {
+ man->twtype |= SCE_MANIP_TRANSLATE;
+ }
+ else if (STREQ(tref->idname, "Rotate")) {
+ man->twtype |= SCE_MANIP_ROTATE;
+ }
+ else if (STREQ(tref->idname, "Scale")) {
+ man->twtype |= SCE_MANIP_SCALE;
+ }
+ BLI_assert(man->twtype != 0);
+ man->twtype_init = man->twtype;
+ }
+
+ /* *** set properties for axes *** */
+ manipulatorgroup_init_properties_from_twtype(mgroup);
+}
+
static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGroup *mgroup)
{
ManipulatorGroup *man = mgroup->customdata;
@@ -1443,6 +1446,15 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
RegionView3D *rv3d = ar->regiondata;
struct TransformBounds tbounds;
+ if (man->use_twtype_refresh) {
+ Scene *scene = CTX_data_scene(C);
+ man->twtype = scene->toolsettings->manipulator_flag & man->twtype_init;
+ if (man->twtype != man->twtype_prev) {
+ man->twtype_prev = man->twtype;
+ manipulatorgroup_init_properties_from_twtype(mgroup);
+ }
+ }
+
/* skip, we don't draw anything anyway */
if ((man->all_hidden =
(ED_transform_calc_manipulator_stats(
@@ -1481,7 +1493,7 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
RNA_float_set(axis->ptr, "length", len);
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
- if (man->twtype & V3D_MANIP_ROTATE) {
+ if (man->twtype & SCE_MANIP_ROTATE) {
/* Avoid rotate and translate arrows overlap. */
start_co[2] += 0.215f;
}
@@ -1653,7 +1665,7 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulato
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
- int constraint[3] = {x != 1, y != 1, z != 1};
+ bool constraint[3] = {x != 1, y != 1, z != 1};
ptr = WM_manipulator_operator_set(mpr, i, ot_resize, NULL);
if (prop_release_confirm == NULL) {
prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index d98e3e3261a..cfac908f976 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -226,7 +226,7 @@ static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent
return delete_orientation_exec(C, op);
}
-static int delete_orientation_poll(bContext *C)
+static bool delete_orientation_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
@@ -307,7 +307,7 @@ static void transformops_loopsel_hack(bContext *C, wmOperator *op)
if (op->opm && op->opm->opm && op->opm->opm->prev) {
wmOperator *op_prev = op->opm->opm->prev;
Scene *scene = CTX_data_scene(C);
- int mesh_select_mode[3];
+ bool mesh_select_mode[3];
PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init");
if (prop && RNA_property_is_set(op_prev->ptr, prop)) {
@@ -652,7 +652,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
}
-static int skin_resize_poll(bContext *C)
+static bool skin_resize_poll(bContext *C)
{
struct Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_MESH) {
@@ -1148,11 +1148,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
/* Will fall-through to texture-space transform. */
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_transform_axis_target", TKEY, KM_PRESS, KM_SHIFT, 0);
+#ifdef USE_WM_KEYMAP_27X
kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "texture_space", true);
kmi = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "texture_space", true);
+#endif
WM_keymap_add_item(keymap, OP_SKIN_RESIZE, AKEY, KM_PRESS, KM_CTRL, 0);
@@ -1264,4 +1266,3 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
break;
}
}
-
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 704582deaca..48ec664d634 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -50,8 +50,8 @@
#include "BLI_utildefines.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_anim.h" /* for duplis */
@@ -160,7 +160,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
float imat[4][4];
float size;
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
@@ -202,7 +202,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
immUnbindProgram();
if (v3d->zbuf)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
else if (t->spacetype == SPACE_IMAGE) {
@@ -219,7 +219,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
- glEnable(GL_BLEND);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -244,7 +244,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
}