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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-27 20:15:18 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-27 21:11:10 +0300
commit6baea955bf562399caa9c6186601815af29b584d (patch)
tree8a7e330dd0a7600613ade4fd91582c5d77195236 /source/blender/editors/space_view3d/view3d_gizmo_navigate.c
parent0b4c440baa567a02669c3fd790bb0b778efaaeff (diff)
UI: use new 3D viewport navigation icons and image icon in add menu.
I had to make the viewport navigation icons a bit smaller in the SVG since the edges were being clipped off, we only support 16x16 icons currently. They are a bit blurry because of this.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_navigate.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate.c86
1 files changed, 15 insertions, 71 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index 66faac49304..4eee7251022 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -51,13 +51,13 @@
* \{ */
/* Offset from screen edge. */
-#define GIZMO_OFFSET_FAC 1.2f
+#define GIZMO_OFFSET_FAC 1.1f
/* Size of main icon. */
#define GIZMO_SIZE 80
-/* Factor for size of smaller button. */
-#define GIZMO_MINI_FAC 0.35f
+/* Size of the smaller icons. */
+#define GIZMO_ICON_SIZE 20
/* How much mini buttons offset from the primary. */
-#define GIZMO_MINI_OFFSET_FAC 0.42f
+#define GIZMO_MINI_OFFSET_FAC 0.32f
enum {
@@ -74,94 +74,40 @@ enum {
MPR_TOTAL = 6,
};
-/* Vector icons compatible with 'GPU_batch_from_poly_2d_encoded' */
-static const uchar shape_camera[] = {
- 0xa3, 0x19, 0x78, 0x55, 0x4d, 0x19, 0x4f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 0x25, 0xda, 0x0a, 0xb0, 0x00, 0x7f, 0x0a, 0x4f,
- 0x25, 0x25, 0x4f, 0x0a, 0x7f, 0x00, 0x80, 0x0d, 0x1d, 0x45, 0x1d, 0x45, 0xb0, 0x0a,
- 0xda, 0x25, 0xf5, 0x4f, 0xff, 0x80, 0xf5, 0xb0, 0xda, 0xda, 0xb0, 0xf5, 0x80, 0xff,
- 0x80, 0xf2, 0xe3, 0xba, 0xe3, 0x45, 0x80, 0x0d, 0x7f, 0x00, 0x7f, 0x00,
-};
-static const uchar shape_pan[] = {
- 0xbf, 0x4c, 0xbf, 0x66, 0x99, 0x66, 0x99, 0x40, 0xb2, 0x40, 0x7f, 0x0d, 0x7f, 0x00,
- 0xb0, 0x0a, 0xda, 0x25, 0xf5, 0x4f, 0xff, 0x80, 0xf5, 0xb0, 0xda, 0xda, 0xb0, 0xf5,
- 0x80, 0xff, 0x80, 0xf2, 0xb3, 0xbf, 0x99, 0xbf, 0x99, 0x99, 0xbf, 0x99, 0xbf, 0xb2,
- 0xf2, 0x7f, 0xf2, 0x7f, 0x40, 0xb3, 0x40, 0x99, 0x66, 0x99, 0x66, 0xbf, 0x4d, 0xbf,
- 0x80, 0xf2, 0x80, 0xff, 0x4f, 0xf5, 0x25, 0xda, 0x0a, 0xb0, 0x00, 0x7f, 0x0a, 0x4f,
- 0x25, 0x25, 0x4f, 0x0a, 0x7f, 0x00, 0x7f, 0x0d, 0x4c, 0x40, 0x66, 0x40, 0x66, 0x66,
- 0x40, 0x66, 0x40, 0x4d, 0x0d, 0x80, 0x0d, 0x80,
-};
-static const uchar shape_persp[] = {
- 0xda, 0xda, 0xb0, 0xf5, 0x80, 0xff, 0x4f, 0xf5, 0x25, 0xda, 0x0a, 0xb0, 0x00, 0x7f,
- 0x0a, 0x4f, 0x25, 0x25, 0x4f, 0x0a, 0x7f, 0x00, 0x80, 0x07, 0x30, 0x50, 0x18, 0xbd,
- 0x80, 0xdb, 0xe8, 0xbd, 0xf5, 0xb0, 0xf5, 0xb0, 0x83, 0x0f, 0x87, 0x7b, 0xe2, 0xb7,
- 0xe3, 0xba, 0xe0, 0xbb, 0x80, 0x87, 0x20, 0xbb, 0x1d, 0xba, 0x1d, 0xb7, 0x78, 0x7b,
- 0x7d, 0x0f, 0x80, 0x0c, 0x80, 0x0c, 0xd0, 0x50, 0x80, 0x07, 0x7f, 0x00, 0xb0, 0x0a,
- 0xda, 0x25, 0xf5, 0x4f, 0xff, 0x80, 0xf5, 0xb0, 0xe8, 0xbd, 0xe8, 0xbd,
-};
-static const uchar shape_zoom[] = {
- 0xad, 0x7f, 0xf1, 0x7f, 0xff, 0x80, 0xf5, 0xb0, 0xda, 0xda, 0xb0, 0xf5, 0x80, 0xff,
- 0x4f, 0xf5, 0x25, 0xda, 0x0a, 0xb0, 0x00, 0x7f, 0x0d, 0x7f, 0x52, 0x7f, 0x69, 0xb7,
- 0x48, 0xb7, 0x80, 0xd8, 0xb8, 0xb7, 0x96, 0xb7, 0x96, 0xb7, 0x7f, 0x2f, 0x0d, 0x7f,
- 0x00, 0x7f, 0x0a, 0x4f, 0x25, 0x25, 0x4f, 0x0a, 0x7f, 0x00, 0xb0, 0x0a, 0xda, 0x25,
- 0xf5, 0x4f, 0xff, 0x80, 0xf1, 0x7f, 0xf1, 0x7f,
-};
-
-
struct NavigateGizmoInfo {
const char *opname;
const char *gizmo;
- const unsigned char *shape;
- uint shape_size;
+ uint icon;
};
-#define SHAPE_VARS(shape_id) shape = shape_id, .shape_size = ARRAY_SIZE(shape_id)
-
static struct NavigateGizmoInfo g_navigate_params[MPR_TOTAL] = {
{
.opname = "VIEW3D_OT_move",
.gizmo = "GIZMO_GT_button_2d",
- .SHAPE_VARS(shape_pan),
+ ICON_VIEW_PAN,
}, {
.opname = "VIEW3D_OT_rotate",
.gizmo = "VIEW3D_GT_navigate_rotate",
- .shape = NULL,
- .shape_size = 0,
+ 0,
}, {
.opname = "VIEW3D_OT_zoom",
.gizmo = "GIZMO_GT_button_2d",
- .SHAPE_VARS(shape_zoom),
+ ICON_VIEW_ZOOM,
}, {
.opname = "VIEW3D_OT_view_persportho",
.gizmo = "GIZMO_GT_button_2d",
- .SHAPE_VARS(shape_persp),
+ ICON_VIEW_PERSPECTIVE,
}, {
.opname = "VIEW3D_OT_view_persportho",
.gizmo = "GIZMO_GT_button_2d",
- .SHAPE_VARS(shape_ortho),
+ ICON_VIEW_ORTHO,
}, {
.opname = "VIEW3D_OT_view_camera",
.gizmo = "GIZMO_GT_button_2d",
- .SHAPE_VARS(shape_camera),
+ ICON_VIEW_CAMERA,
},
};
-#undef SHAPE_VARS
-
struct NavigateWidgetGroup {
wmGizmo *gz_array[MPR_TOTAL];
/* Store the view state to check for changes. */
@@ -216,12 +162,10 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
/* may be overwritten later */
- gz->scale_basis = (GIZMO_SIZE * GIZMO_MINI_FAC) / 2;
- if (info->shape != NULL) {
- PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "shape");
- RNA_property_string_set_bytes(
- gz->ptr, prop,
- (const char *)info->shape, info->shape_size);
+ gz->scale_basis = (GIZMO_ICON_SIZE) / 2;
+ if (info->icon != 0) {
+ PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
+ RNA_property_enum_set(gz->ptr, prop, info->icon);
RNA_enum_set(gz->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_OUTLINE);
}