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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-06-19 10:47:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-06-19 10:52:26 +0300
commit7b14065729af4266bffbf70ef0de3bd646ec555c (patch)
treebbb13136b933e369227cea9f1baafdc455a93806 /source
parent2ecb9856bc3a77354c9785a7119a0904d11e0d8c (diff)
Manipulator: de-duplicate flags and scale option
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/resources.c15
-rw-r--r--source/blender/editors/manipulator_library/arrow3d_manipulator.c2
-rw-r--r--source/blender/editors/manipulator_library/dial3d_manipulator.c2
-rw-r--r--source/blender/editors/manipulator_library/manipulator_draw_utils.c2
-rw-r--r--source/blender/editors/mesh/editmesh_bisect.c2
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c2
-rw-r--r--source/blender/editors/transform/transform_manipulator.c2
-rw-r--r--source/blender/editors/transform/transform_manipulator2d.c2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h8
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_space.c2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c35
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator.c8
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c2
16 files changed, 45 insertions, 52 deletions
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 09ec08fe265..cf35f4d895b 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1798,14 +1798,10 @@ void init_userdef_do_versions(void)
U.savetime = 1;
// XXX error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n");
}
- /* transform widget settings */
- if (U.tw_hotspot == 0) {
- U.tw_hotspot = 14;
- U.tw_size = 25; /* percentage of window size */
- U.tw_handlesize = 16; /* percentage of widget radius */
- }
- if (U.manipulator_scale == 0)
- U.manipulator_scale = 75;
+ if (U.manipulator_size == 0) {
+ U.manipulator_size = 75;
+ U.manipulator_flag |= USER_MANIPULATOR_DRAW;
+ }
if (U.pad_rot_angle == 0.0f)
U.pad_rot_angle = 15.0f;
@@ -2642,9 +2638,6 @@ void init_userdef_do_versions(void)
if (!USER_VERSION_ATLEAST(269, 9)) {
bTheme *btheme;
-
- U.tw_size = U.tw_size * 5.0f;
-
/* Action Editor (and NLA Editor) - Keyframe Colors */
/* Graph Editor - larger vertex size defaults */
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
diff --git a/source/blender/editors/manipulator_library/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
index 7c688ea077f..41368240f46 100644
--- a/source/blender/editors/manipulator_library/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
@@ -163,7 +163,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
else {
const float len = 0.25f;
const float width = 0.06f;
- const bool use_lighting = select == false && ((U.manipulator_flag & V3D_SHADED_MANIPULATORS) != 0);
+ const bool use_lighting = (!select && ((U.manipulator_flag & USER_MANIPULATOR_SHADED) != 0));
/* translate to line end */
gpuTranslate3f(0.0f, 0.0f, arrow->len);
diff --git a/source/blender/editors/manipulator_library/dial3d_manipulator.c b/source/blender/editors/manipulator_library/dial3d_manipulator.c
index f4459b6bef2..111ea04cd3b 100644
--- a/source/blender/editors/manipulator_library/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/dial3d_manipulator.c
@@ -187,7 +187,7 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[
static void dial_ghostarc_draw(
const DialManipulator *dial, const float angle_ofs, const float angle_delta, const float color[4])
{
- const float width_inner = DIAL_WIDTH - dial->manipulator.line_width * 0.5f / U.manipulator_scale;
+ const float width_inner = DIAL_WIDTH - dial->manipulator.line_width * 0.5f / U.manipulator_size;
VertexFormat *format = immVertexFormat();
uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
index d9434be8e0a..cfa1bc38ed5 100644
--- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c
+++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
@@ -63,7 +63,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
/* TODO store the Batches inside the ManipulatorGeomInfo and updated it when geom changes
* So we don't need to re-created and discard it every time */
- const bool use_lighting = true || (!select && ((U.manipulator_flag & V3D_SHADED_MANIPULATORS) != 0));
+ const bool use_lighting = true || (!select && ((U.manipulator_flag & USER_MANIPULATOR_SHADED) != 0));
VertexBuffer *vbo;
ElementList *el;
Batch *batch;
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index 0f291937156..31b4c7ef87e 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -197,7 +197,7 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Setup manipulators */
{
View3D *v3d = CTX_wm_view3d(C);
- if (v3d && (v3d->twtype & V3D_USE_MANIPULATOR)) {
+ if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) {
WM_manipulator_group_add("MESH_WGT_bisect");
}
}
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index e722b89e9b1..c1f760be158 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -758,7 +758,7 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
#ifdef USE_MANIPULATOR
if (ret & OPERATOR_FINISHED) {
/* Setup manipulators */
- if (v3d && (v3d->twtype & V3D_USE_MANIPULATOR)) {
+ if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) {
WM_manipulator_group_add("MESH_WGT_spin");
}
}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index eaf9f73b39c..41851d8d358 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -344,7 +344,7 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->near = 0.01f;
v3d->far = 1000.0f;
- v3d->twflag |= U.manipulator_flag & V3D_USE_MANIPULATOR;
+ v3d->twflag |= U.manipulator_flag & V3D_MANIPULATOR_DRAW;
v3d->twtype = V3D_MANIP_TRANSLATE;
v3d->around = V3D_AROUND_CENTER_MEAN;
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 7acc67bc241..bb86b0a991f 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -328,7 +328,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* Transform widget / manipulators */
row = uiLayoutRow(layout, true);
uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- if (v3d->twflag & V3D_USE_MANIPULATOR) {
+ if (v3d->twflag & V3D_MANIPULATOR_DRAW) {
uiItemR(row, &v3dptr, "transform_manipulators", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
uiItemR(row, &v3dptr, "transform_orientation", 0, "", ICON_NONE);
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 38d41f6dc3a..2f276eb98b5 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -1360,7 +1360,7 @@ static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmMani
const ScrArea *sa = CTX_wm_area(C);
const View3D *v3d = sa->spacedata.first;
- return (((v3d->twflag & V3D_USE_MANIPULATOR) != 0) &&
+ return (((v3d->twflag & V3D_MANIPULATOR_DRAW) != 0) &&
((v3d->twtype & (V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE | V3D_MANIP_SCALE)) != 0));
}
diff --git a/source/blender/editors/transform/transform_manipulator2d.c b/source/blender/editors/transform/transform_manipulator2d.c
index 0035910f8d7..8cfa386cba2 100644
--- a/source/blender/editors/transform/transform_manipulator2d.c
+++ b/source/blender/editors/transform/transform_manipulator2d.c
@@ -199,7 +199,7 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator
ED_manipulator_arrow2d_set_line_len(axis, 0.8f);
WM_manipulator_set_matrix_offset_location(axis, offset);
WM_manipulator_set_line_width(axis, MANIPULATOR_AXIS_LINE_WIDTH);
- WM_manipulator_set_scale(axis, U.manipulator_scale);
+ WM_manipulator_set_scale(axis, U.manipulator_size);
WM_manipulator_set_color(axis, col);
WM_manipulator_set_color_highlight(axis, col_hi);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 9f5d33531f6..01ad818d0f1 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -494,8 +494,7 @@ typedef struct UserDef {
short gp_settings;
short tb_leftmouse, tb_rightmouse;
struct SolidLight light[3];
- short tw_hotspot, tw_flag, tw_handlesize, tw_size;
- short manipulator_flag, manipulator_scale;
+ short manipulator_flag, manipulator_size;
int pad3;
short textimeout, texcollectrate;
short wmdrawmethod; /* removed wmpad */
@@ -796,6 +795,11 @@ typedef enum eGP_UserdefSettings {
GP_PAINT_DOSIMPLIFY = (1 << 1),
} eGP_UserdefSettings;
+enum {
+ USER_MANIPULATOR_DRAW = (1 << 0),
+ USER_MANIPULATOR_SHADED = (1 << 1),
+};
+
/* color picker types */
typedef enum eColorPicker_Types {
USER_CP_CIRCLE_HSV = 0,
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 6c526d125d6..22bb3cd5add 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -380,11 +380,10 @@ enum {
#define V3D_MANIP_GIMBAL 4
#define V3D_MANIP_CUSTOM 5
-/* View3d->twflag */
- /* USE = user setting, DRAW = based on selection */
-#define V3D_USE_MANIPULATOR 1
-#define V3D_DRAW_MANIPULATOR (1 << 1)
-#define V3D_SHADED_MANIPULATORS (1 << 2)
+/* View3d->twflag (also) */
+enum {
+ V3D_MANIPULATOR_DRAW = (1 << 0),
+};
/* BGPic->flag */
/* may want to use 1 for select ? */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 38fbdbd895e..364059d9c72 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2678,7 +2678,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_USE_MANIPULATOR);
+ RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_MANIPULATOR_DRAW);
RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms");
RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 1d01e85205c..af77d037b69 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -176,10 +176,12 @@ static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, Point
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
- if (userdef->tw_flag & V3D_USE_MANIPULATOR)
- v3d->twflag |= V3D_USE_MANIPULATOR;
- else
- v3d->twflag &= ~V3D_USE_MANIPULATOR;
+ if (userdef->manipulator_flag & USER_MANIPULATOR_DRAW) {
+ v3d->twflag |= V3D_MANIPULATOR_DRAW;
+ }
+ else {
+ v3d->twflag &= ~V3D_MANIPULATOR_DRAW;
+ }
}
}
}
@@ -3496,30 +3498,25 @@ static void rna_def_userdef_view(BlenderRNA *brna)
/* 3D transform widget */
prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "tw_flag", V3D_USE_MANIPULATOR);
+ RNA_def_property_boolean_sdna(prop, NULL, "manipulator_flag", USER_MANIPULATOR_DRAW);
RNA_def_property_ui_text(prop, "Manipulator", "Use 3D transform manipulator");
RNA_def_property_update(prop, 0, "rna_userdef_show_manipulator_update");
+ /* TODO, expose once it's working. */
+#if 0
+ prop = RNA_def_property(srna, "show_manipulator_shaded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "manipulator_flag", USER_MANIPULATOR_SHADED);
+ RNA_def_property_ui_text(prop, "Manipulator Shaded", "Use 3D transform manipulator");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+#endif
+
prop = RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "tw_size");
+ RNA_def_property_int_sdna(prop, NULL, "manipulator_size");
RNA_def_property_range(prop, 10, 200);
RNA_def_property_int_default(prop, 75);
RNA_def_property_ui_text(prop, "Manipulator Size", "Diameter of the manipulator");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop = RNA_def_property(srna, "manipulator_handle_size", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "tw_handlesize");
- RNA_def_property_range(prop, 2, 40);
- RNA_def_property_int_default(prop, 25);
- RNA_def_property_ui_text(prop, "Manipulator Handle Size", "Size of manipulator handles as percentage of the radius");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "manipulator_hotspot", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "tw_hotspot");
- RNA_def_property_range(prop, 4, 40);
- RNA_def_property_int_default(prop, 14);
- RNA_def_property_ui_text(prop, "Manipulator Hotspot", "Distance around the handles to accept mouse clicks");
-
prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
RNA_def_property_range(prop, 4, 10);
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
index b842d2143d9..34b0af88f7a 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
@@ -418,19 +418,19 @@ void wm_manipulator_calculate_scale(wmManipulator *mpr, const bContext *C)
float scale = 1.0f;
if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_SCALE_3D) {
- if (rv3d /*&& (U.manipulator_flag & V3D_DRAW_MANIPULATOR) == 0*/) { /* UserPref flag might be useful for later */
+ if (rv3d) {
if (mpr->type->matrix_world_get) {
float matrix_world[4][4];
mpr->type->matrix_world_get(mpr, matrix_world);
- scale = ED_view3d_pixel_size(rv3d, matrix_world[3]) * (float)U.manipulator_scale;
+ scale = ED_view3d_pixel_size(rv3d, matrix_world[3]) * (float)U.manipulator_size;
}
else {
- scale = ED_view3d_pixel_size(rv3d, mpr->matrix[3]) * (float)U.manipulator_scale;
+ scale = ED_view3d_pixel_size(rv3d, mpr->matrix[3]) * (float)U.manipulator_size;
}
}
else {
- scale = U.manipulator_scale * 0.02f;
+ scale = U.manipulator_size * 0.02f;
}
}
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index 92a81bbac2d..6bca825fd16 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -248,7 +248,7 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext
const bool draw_multisample = (U.ogl_multisamples != USER_MULTISAMPLE_NONE);
/* TODO this will need it own shader probably? don't think it can be handled from that point though. */
-/* const bool use_lighting = (U.manipulator_flag & V3D_SHADED_MANIPULATORS) != 0; */
+/* const bool use_lighting = (U.manipulator_flag & V3D_MANIPULATOR_SHADED) != 0; */
/* enable multisampling */
if (draw_multisample) {