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:
authorCampbell Barton <ideasman42@gmail.com>2018-07-01 21:15:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-01 21:15:21 +0300
commit37994e0af2cf6f0d7ed8a072eb765dfb022ceaef (patch)
tree07ea3a893aa2dc586f22a46681aa77c430f63317 /source/blender
parent192e5d65a746798f6bddf897570ff8aba55c9c5a (diff)
parent26c5a1c301d3d554c4b1244b219f9883249f382d (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/alembic/intern/abc_customdata.cc11
-rw-r--r--source/blender/editors/interface/interface.c29
-rw-r--r--source/blender/editors/interface/interface_draw.c124
-rw-r--r--source/blender/editors/interface/interface_handlers.c60
-rw-r--r--source/blender/editors/interface/interface_layout.c29
-rw-r--r--source/blender/editors/interface/interface_ops.c35
-rw-r--r--source/blender/editors/interface/interface_panel.c48
-rw-r--r--source/blender/editors/interface/interface_query.c14
-rw-r--r--source/blender/editors/interface/interface_region_search.c15
-rw-r--r--source/blender/editors/interface/interface_templates.c277
-rw-r--r--source/blender/editors/interface/interface_utils.c5
-rw-r--r--source/blender/editors/interface/interface_widgets.c42
-rw-r--r--source/blender/editors/interface/view2d.c22
-rw-r--r--source/blender/editors/interface/view2d_ops.c76
14 files changed, 461 insertions, 326 deletions
diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc
index 8ab9f1118f4..87545007870 100644
--- a/source/blender/alembic/intern/abc_customdata.cc
+++ b/source/blender/alembic/intern/abc_customdata.cc
@@ -26,7 +26,14 @@
#include <Alembic/AbcGeom/All.h>
#include <algorithm>
+
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900)
#include <unordered_map>
+typedef std::unordered_map<uint64_t, int> uv_index_map;
+#else
+#include <map>
+typedef std::map<uint64_t, int> uv_index_map;
+#endif
extern "C" {
#include "DNA_customdata_types.h"
@@ -106,7 +113,7 @@ static void get_uvs(const CDStreamConfig &config,
}
}
else {
- std::unordered_map<uint64_t, int> idx_map;
+ uv_index_map idx_map;
int idx_count = 0;
for (int i = 0; i < num_poly; ++i) {
@@ -117,7 +124,7 @@ static void get_uvs(const CDStreamConfig &config,
loopuvpoly--;
Imath::V2f uv(loopuvpoly->uv[0], loopuvpoly->uv[1]);
uint64_t k = uv_to_hash_key(uv);
- std::unordered_map<uint64_t, int>::iterator it = idx_map.find(k);
+ uv_index_map::iterator it = idx_map.find(k);
if (it == idx_map.end()) {
idx_map[k] = idx_count;
uvs.push_back(uv);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 834abc84c0d..3b2a2e9d3ed 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -935,10 +935,11 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_str
else {
butstr_orig = BLI_strdup(but->str);
}
- BLI_snprintf(but->strdata,
- sizeof(but->strdata),
- "%s" UI_SEP_CHAR_S "%s",
- butstr_orig, shortcut_str);
+ BLI_snprintf(
+ but->strdata,
+ sizeof(but->strdata),
+ "%s" UI_SEP_CHAR_S "%s",
+ butstr_orig, shortcut_str);
MEM_freeN(butstr_orig);
but->str = but->strdata;
but->flag |= UI_BUT_HAS_SEP_CHAR;
@@ -2121,8 +2122,9 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va
precision = float_precision;
}
- bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision,
- unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad);
+ bUnit_AsString(
+ str, len_max, ui_get_but_scale_unit(but, value), precision,
+ unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad);
}
static float ui_get_but_step_unit(uiBut *but, float step_default)
@@ -2343,8 +2345,9 @@ static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char
/* ugly, use the draw string to get the value,
* this could cause problems if it includes some text which resolves to a unit */
- bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr,
- ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
+ bUnit_ReplaceString(
+ str_unit_convert, sizeof(str_unit_convert), but->drawstr,
+ ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
return BPY_execute_string_as_number(C, str_unit_convert, true, r_value);
}
@@ -3429,12 +3432,14 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
}
else {
if (item->icon) {
- uiDefIconTextButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0,
- UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
+ uiDefIconTextButI(
+ block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0,
+ UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
}
else {
- uiDefButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0,
- UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
+ uiDefButI(
+ block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0,
+ UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
}
}
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index da1135da00a..3e724fd5c5c 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -152,8 +152,10 @@ void UI_draw_roundbox_aa(bool filled, float minx, float miny, float maxx, float
void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float maxy, float rad, const float col[4])
{
#if 0
- float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+ float vec[7][2] = {
+ {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+ {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805},
+ };
int a;
Gwn_VertFormat *format = immVertexFormat();
@@ -267,8 +269,10 @@ void UI_draw_roundbox_shade_x(
float rad, float shadetop, float shadedown, const float col[4])
{
#if 0
- float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+ float vec[7][2] = {
+ {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+ {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805},
+ };
const float div = maxy - miny;
const float idiv = 1.0f / div;
float coltop[3], coldown[3];
@@ -412,8 +416,10 @@ void UI_draw_roundbox_shade_y(
bool filled, float minx, float miny, float maxx, float maxy,
float rad, float shadeleft, float shaderight, const float col[4])
{
- float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+ float vec[7][2] = {
+ {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+ {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805},
+ };
const float div = maxx - minx;
const float idiv = 1.0f / div;
float colLeft[3], colRight[3];
@@ -551,10 +557,10 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highligh
const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize;
int a;
float vec[4][2] = {
- {0.195, 0.02},
- {0.55, 0.169},
- {0.831, 0.45},
- {0.98, 0.805},
+ {0.195, 0.02},
+ {0.55, 0.169},
+ {0.831, 0.45},
+ {0.98, 0.805},
};
@@ -659,8 +665,9 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
- immDrawPixelsTex(&state, (float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect,
- facx, facy, NULL);
+ immDrawPixelsTex(
+ &state, (float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect,
+ facx, facy, NULL);
GPU_blend(false);
@@ -804,10 +811,11 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS
/* need scissor test, histogram can draw outside of boundary */
int scissor[4];
GPU_scissor_geti(scissor);
- GPU_scissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -927,10 +935,11 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
/* need scissor test, waveform can draw outside of boundary */
GPU_scissor_geti(scissor);
- GPU_scissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
/* draw scale numbers first before binding any shader */
for (int i = 0; i < 6; i++) {
@@ -1199,10 +1208,11 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
/* need scissor test, hvectorscope can draw outside of boundary */
int scissor[4];
GPU_scissor_geti(scissor);
- GPU_scissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1584,8 +1594,9 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
float fy = rect->ymin + zoomy * (-offsy);
if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin));
- float line_count = floorf((rect->xmax - fx) / dx) + 1.0f +
- floorf((rect->ymax - fy) / dy) + 1.0f;
+ float line_count = (
+ floorf((rect->xmax - fx) / dx) + 1.0f +
+ floorf((rect->ymax - fy) / dy) + 1.0f);
immBegin(GWN_PRIM_LINES, (int)line_count * 2);
while (fx < rect->xmax) {
@@ -1604,9 +1615,10 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
static void gl_shaded_color(unsigned char *col, int shade)
{
- immUniformColor3ub(col[0] - shade > 0 ? col[0] - shade : 0,
- col[1] - shade > 0 ? col[1] - shade : 0,
- col[2] - shade > 0 ? col[2] - shade : 0);
+ immUniformColor3ub(
+ col[0] - shade > 0 ? col[0] - shade : 0,
+ col[1] - shade > 0 ? col[1] - shade : 0,
+ col[2] - shade > 0 ? col[2] - shade : 0);
}
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti *rect)
@@ -1633,10 +1645,11 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
};
rcti scissor_region = {0, ar->winx, 0, ar->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
- GPU_scissor(scissor_new.xmin,
- scissor_new.ymin,
- BLI_rcti_size_x(&scissor_new),
- BLI_rcti_size_y(&scissor_new));
+ GPU_scissor(
+ scissor_new.xmin,
+ scissor_new.ymin,
+ BLI_rcti_size_x(&scissor_new),
+ BLI_rcti_size_y(&scissor_new));
/* calculate offset and zoom */
float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&cumap->curr);
@@ -1679,10 +1692,11 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
gl_shaded_color((unsigned char *)wcol->inner, -20);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
immUniformColor3ubv((unsigned char *)wcol->inner);
- immRectf(pos, rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
- rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
- rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
- rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
+ immRectf(pos,
+ rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
+ rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
+ rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
+ rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
}
else {
immUniformColor3ubv((unsigned char *)wcol->inner);
@@ -1848,10 +1862,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
/* need scissor test, preview image can draw outside of boundary */
int scissor[4];
GPU_scissor_geti(scissor);
- GPU_scissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
if (scopes->track_disabled) {
float color[4] = {0.7f, 0.3f, 0.3f, 0.3f};
@@ -1867,10 +1882,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
if (scopes->track_preview)
IMB_freeImBuf(scopes->track_preview);
- ImBuf *tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width, scopes->frame_height,
- scopes->track_search, scopes->track,
- &scopes->undist_marker, true, scopes->use_track_mask,
- width, height, scopes->track_pos);
+ ImBuf *tmpibuf = BKE_tracking_sample_pattern(
+ scopes->frame_width, scopes->frame_height,
+ scopes->track_search, scopes->track,
+ &scopes->undist_marker, true, scopes->use_track_mask,
+ width, height, scopes->track_pos);
if (tmpibuf) {
if (tmpibuf->rect_float)
IMB_rect_from_float(tmpibuf);
@@ -1903,10 +1919,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
/* draw cross for pixel position */
gpuTranslate2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]);
- GPU_scissor(rect.xmin,
- rect.ymin,
- BLI_rctf_size_x(&rect),
- BLI_rctf_size_y(&rect));
+ GPU_scissor(
+ rect.xmin,
+ rect.ymin,
+ BLI_rctf_size_x(&rect),
+ BLI_rctf_size_y(&rect));
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1991,10 +2008,11 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
rcti scissor_region = {0, ar->winx, 0, ar->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
- GPU_scissor(scissor_new.xmin,
- scissor_new.ymin,
- BLI_rcti_size_x(&scissor_new),
- BLI_rcti_size_y(&scissor_new));
+ GPU_scissor(
+ scissor_new.xmin,
+ scissor_new.ymin,
+ BLI_rcti_size_x(&scissor_new),
+ BLI_rcti_size_y(&scissor_new));
float x = 0.5f * (recti->xmin + recti->xmax);
float y = 0.5f * (recti->ymin + recti->ymax);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ad17a771772..ac7ed3d5106 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1325,8 +1325,10 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
if (but) {
if (but->flag & UI_BUT_DRAG_LOCK) {
- const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect),
- BLI_rctf_cent_y(&but->rect)};
+ const float but_cent_new[2] = {
+ BLI_rctf_cent_x(&but->rect),
+ BLI_rctf_cent_y(&but->rect),
+ };
/* check if this is a different button, chances are high the button wont move about :) */
if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
@@ -1398,10 +1400,11 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
ui_apply_but_undo(but);
}
- WM_event_remove_ui_handler(&win->modalhandlers,
- ui_handler_region_drag_toggle,
- ui_handler_region_drag_toggle_remove,
- drag_info, false);
+ WM_event_remove_ui_handler(
+ &win->modalhandlers,
+ ui_handler_region_drag_toggle,
+ ui_handler_region_drag_toggle_remove,
+ drag_info, false);
ui_handler_region_drag_toggle_remove(C, drag_info);
WM_event_add_mousemove(C);
@@ -3159,13 +3162,15 @@ static void ui_do_but_textedit(
}
break;
case RIGHTARROWKEY:
- ui_textedit_move(but, data, STRCUR_DIR_NEXT,
- event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_NEXT,
+ event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case LEFTARROWKEY:
- ui_textedit_move(but, data, STRCUR_DIR_PREV,
- event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_PREV,
+ event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case WHEELDOWNMOUSE:
@@ -3182,8 +3187,9 @@ static void ui_do_but_textedit(
}
ATTR_FALLTHROUGH;
case ENDKEY:
- ui_textedit_move(but, data, STRCUR_DIR_NEXT,
- event->shift != 0, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_NEXT,
+ event->shift != 0, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
break;
case WHEELUPMOUSE:
@@ -3200,8 +3206,9 @@ static void ui_do_but_textedit(
}
ATTR_FALLTHROUGH;
case HOMEKEY:
- ui_textedit_move(but, data, STRCUR_DIR_PREV,
- event->shift != 0, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_PREV,
+ event->shift != 0, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
break;
case PADENTER:
@@ -3210,14 +3217,16 @@ static void ui_do_but_textedit(
retval = WM_UI_HANDLER_BREAK;
break;
case DELKEY:
- changed = ui_textedit_delete(but, data, 1,
- event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ changed = ui_textedit_delete(
+ but, data, 1,
+ event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case BACKSPACEKEY:
- changed = ui_textedit_delete(but, data, 0,
- event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ changed = ui_textedit_delete(
+ but, data, 0,
+ event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
@@ -3232,10 +3241,12 @@ static void ui_do_but_textedit(
if (event->ctrl && !IS_EVENT_MOD(event, shift, alt, oskey))
#endif
{
- ui_textedit_move(but, data, STRCUR_DIR_PREV,
- false, STRCUR_JUMP_ALL);
- ui_textedit_move(but, data, STRCUR_DIR_NEXT,
- true, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_PREV,
+ false, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_NEXT,
+ true, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
}
break;
@@ -9675,8 +9686,9 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
#ifdef USE_DRAG_TOGGLE
{
- WM_event_free_ui_handler_all(C, &win->modalhandlers,
- ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove);
+ WM_event_free_ui_handler_all(
+ C, &win->modalhandlers,
+ ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove);
}
#endif
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 062a7681372..4ff19d66bac 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -594,8 +594,9 @@ static void ui_item_array(
icon = boolarr[a] ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
}
- width_item = (compact && type == PROP_BOOLEAN) ?
- min_ii(w, ui_text_icon_width(layout, str_buf, icon, false)) : w;
+ width_item = (
+ (compact && type == PROP_BOOLEAN) ?
+ min_ii(w, ui_text_icon_width(layout, str_buf, icon, false)) : w);
but = uiDefAutoButR(block, ptr, prop, a, str_buf, icon, 0, 0, width_item, UI_UNIT_Y);
if (slider && but->type == UI_BTYPE_NUM)
@@ -776,8 +777,9 @@ static uiBut *ui_item_with_label(
but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, prop_but_width - UI_UNIT_X, h);
/* BUTTONS_OT_file_browse calls UI_context_active_but_prop_get_filebrowser */
- uiDefIconButO(block, UI_BTYPE_BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse",
- WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
+ uiDefIconButO(
+ block, UI_BTYPE_BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse",
+ WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
}
else if (flag & UI_ITEM_R_EVENT) {
but = uiDefButR_prop(block, UI_BTYPE_KEY_EVENT, 0, name, x, y, prop_but_width, h, ptr, prop, index, 0, 0, -1, -1, NULL);
@@ -796,8 +798,9 @@ static uiBut *ui_item_with_label(
}
else {
const char *str = (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY)) ? NULL : "";
- but = uiDefAutoButR(block, ptr, prop, index, str, icon,
- x, y, prop_but_width, h);
+ but = uiDefAutoButR(
+ block, ptr, prop, index, str, icon,
+ x, y, prop_but_width, h);
}
UI_block_layout_set_current(block, layout);
@@ -1185,8 +1188,9 @@ void uiItemsFullEnumO_items(
}
else {
/* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
- but = uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
- 0.0, 0.0, 0, 0, "");
+ but = uiDefBut(
+ block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
+ 0.0, 0.0, 0, 0, "");
}
ui_but_tip_from_enum_item(but, item);
}
@@ -1964,8 +1968,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
}
UI_but_func_search_set(
- but, ui_searchbox_create_generic, ui_rna_collection_search_cb,
- coll_search, NULL, NULL);
+ but, ui_searchbox_create_generic, ui_rna_collection_search_cb,
+ coll_search, NULL, NULL);
but->free_search_arg = true;
}
else if (but->type == UI_BTYPE_SEARCH_MENU) {
@@ -2386,8 +2390,9 @@ void uiItemMenuEnumO_ptr(
BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname));
lvl->opcontext = layout->root->opcontext;
- but = ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl,
- RNA_struct_ui_description(ot->srna), true);
+ but = ui_item_menu(
+ layout, name, icon, menu_item_enum_opname_menu, NULL, lvl,
+ RNA_struct_ui_description(ot->srna), true);
/* add hotkey here, lower UI code can't detect it */
if ((layout->root->block->flag & UI_BLOCK_LOOP) &&
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 571c1327f78..0f08f8c7ed9 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -347,7 +347,7 @@ enum {
static EnumPropertyItem override_type_items[] = {
{UIOverride_Type_NOOP, "NOOP", 0, "NoOp",
- "'No-Operation', place holder preventing automatic override to ever affect the property"},
+ "'No-Operation', place holder preventing automatic override to ever affect the property"},
{UIOverride_Type_Replace, "REPLACE", 0, "Replace", "Completely replace value from linked data by local one"},
{UIOverride_Type_Difference, "DIFFERENCE", 0, "Difference", "Store difference to linked data value"},
{UIOverride_Type_Factor, "FACTOR", 0, "Factor", "Store factor to linked data value (useful e.g. for scale)"},
@@ -408,7 +408,7 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
}
IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_get(
- &ptr, prop, operation, index, true, NULL, &created);
+ &ptr, prop, operation, index, true, NULL, &created);
if (!created) {
opop->operation = operation;
}
@@ -443,8 +443,9 @@ static void UI_OT_override_type_set_button(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
- ot->prop = RNA_def_enum(ot->srna, "type", override_type_items, UIOverride_Type_Replace,
- "Type", "Type of override operation");
+ ot->prop = RNA_def_enum(
+ ot->srna, "type", override_type_items, UIOverride_Type_Replace,
+ "Type", "Type of override operation");
/* TODO: add itemf callback, not all options are available for all data types... */
}
@@ -493,7 +494,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
bool is_strict_find;
/* Remove override operation for given item, add singular operations for the other items as needed. */
IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find(
- oprop, NULL, NULL, index, index, false, &is_strict_find);
+ oprop, NULL, NULL, index, index, false, &is_strict_find);
BLI_assert(opop != NULL);
if (!is_strict_find) {
/* No specific override operation, we have to get generic one,
@@ -1024,9 +1025,10 @@ static int editsource_exec(bContext *C, wmOperator *op)
if (but_store) {
if (but_store->py_dbg_ln != -1) {
- ret = editsource_text_edit(C, op,
- but_store->py_dbg_fn,
- but_store->py_dbg_ln);
+ ret = editsource_text_edit(
+ C, op,
+ but_store->py_dbg_fn,
+ but_store->py_dbg_ln);
}
else {
BKE_report(op->reports, RPT_ERROR, "Active button is not from a script, cannot edit source");
@@ -1134,14 +1136,18 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL};
if (!BLI_is_dir(root)) {
- BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' 'Translation Branches "
- "Directory' path to a valid directory");
+ BKE_report(
+ op->reports, RPT_ERROR,
+ "Please set your User Preferences' 'Translation Branches "
+ "Directory' path to a valid directory");
return OPERATOR_CANCELLED;
}
ot = WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0);
if (ot == NULL) {
- BKE_reportf(op->reports, RPT_ERROR, "Could not find operator '%s'! Please enable ui_translate add-on "
- "in the User Preferences", EDTSRC_I18N_OP_NAME);
+ BKE_reportf(
+ op->reports, RPT_ERROR,
+ "Could not find operator '%s'! Please enable ui_translate add-on "
+ "in the User Preferences", EDTSRC_I18N_OP_NAME);
return OPERATOR_CANCELLED;
}
/* Try to find a valid po file for current language... */
@@ -1152,8 +1158,9 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- UI_but_string_info_get(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
- &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL);
+ UI_but_string_info_get(
+ C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
+ &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_string_set(&ptr, "lang", uilng);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 1e3a080c097..8107254f30b 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -558,8 +558,9 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
GPU_blend(false);
}
-static void immRectf_tris_color_ex(unsigned int pos, float x1, float y1, float x2, float y2,
- unsigned int col, const float color[3])
+static void immRectf_tris_color_ex(
+ unsigned int pos, float x1, float y1, float x2, float y2,
+ unsigned int col, const float color[3])
{
immAttrib4fv(col, color);
immVertex2f(pos, x1, y1);
@@ -604,10 +605,12 @@ static void ui_draw_panel_dragwidget(unsigned int pos, unsigned int col, const r
const int x_co = (x_min + x_ofs) + (i_x * (box_size + box_margin));
const int y_co = (y_min + y_ofs) + (i_y * (box_size + box_margin));
- immRectf_tris_color_ex(pos, x_co - box_size, y_co - px_zoom, x_co, (y_co + box_size) - px_zoom,
- col, col_dark);
- immRectf_tris_color_ex(pos, x_co - box_size, y_co, x_co, y_co + box_size,
- col, col_high);
+ immRectf_tris_color_ex(
+ pos, x_co - box_size, y_co - px_zoom, x_co, (y_co + box_size) - px_zoom,
+ col, col_dark);
+ immRectf_tris_color_ex(
+ pos, x_co - box_size, y_co, x_co, y_co + box_size,
+ col, col_high);
}
}
immEnd();
@@ -751,9 +754,10 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
#endif
{
GPU_blend(true);
- UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
- (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
- (block->aspect / UI_DPI_FAC), 1.0f);
+ UI_icon_draw_aspect(
+ headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
+ (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
+ (block->aspect / UI_DPI_FAC), 1.0f);
GPU_blend(false);
}
@@ -2004,19 +2008,22 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
if (is_active)
#endif
{
- ui_panel_category_draw_tab(true, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
- tab_curve_radius - px, roundboxtype, true, true, NULL,
- is_active ? theme_col_tab_active : theme_col_tab_inactive);
+ ui_panel_category_draw_tab(
+ true, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
+ tab_curve_radius - px, roundboxtype, true, true, NULL,
+ is_active ? theme_col_tab_active : theme_col_tab_inactive);
/* tab outline */
- ui_panel_category_draw_tab(false, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px,
- tab_curve_radius, roundboxtype, true, true, NULL, theme_col_tab_outline);
+ ui_panel_category_draw_tab(
+ false, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px,
+ tab_curve_radius, roundboxtype, true, true, NULL, theme_col_tab_outline);
/* tab highlight (3d look) */
- ui_panel_category_draw_tab(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
- tab_curve_radius, roundboxtype, true, false,
- is_active ? theme_col_back : theme_col_tab_inactive,
- is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive);
+ ui_panel_category_draw_tab(
+ false, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
+ tab_curve_radius, roundboxtype, true, false,
+ is_active ? theme_col_back : theme_col_tab_inactive,
+ is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive);
}
/* tab blackline */
@@ -2034,8 +2041,9 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
}
if (do_scaletabs) {
- category_draw_len = BLF_width_to_strlen(fontid, category_id_draw, category_draw_len,
- category_width, NULL);
+ category_draw_len = BLF_width_to_strlen(
+ fontid, category_id_draw, category_draw_len,
+ category_width, NULL);
}
BLF_position(fontid, rct->xmax - text_v_ofs, rct->ymin + tab_v_pad_text, 0.0f);
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c
index bdd2de05ab4..66f63fef82d 100644
--- a/source/blender/editors/interface/interface_query.c
+++ b/source/blender/editors/interface/interface_query.c
@@ -41,16 +41,18 @@
bool ui_but_is_editable(const uiBut *but)
{
- return !ELEM(but->type,
- UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE,
- UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR);
+ return !ELEM(
+ but->type,
+ UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE,
+ UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR);
}
bool ui_but_is_editable_as_text(const uiBut *but)
{
- return ELEM(but->type,
- UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER,
- UI_BTYPE_SEARCH_MENU);
+ return ELEM(
+ but->type,
+ UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER,
+ UI_BTYPE_SEARCH_MENU);
}
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index 257455be27e..9ca79a3dc63 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -423,8 +423,9 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
- ui_draw_preview_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
- (a == data->active) ? UI_ACTIVE : 0);
+ ui_draw_preview_item(
+ &data->fstyle, &rect, data->items.names[a], data->items.icons[a],
+ (a == data->active) ? UI_ACTIVE : 0);
}
/* indicate more */
@@ -448,8 +449,9 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
- ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
- (a == data->active) ? UI_ACTIVE : 0, data->use_sep);
+ ui_draw_menu_item(
+ &data->fstyle, &rect, data->items.names[a], data->items.icons[a],
+ (a == data->active) ? UI_ACTIVE : 0, data->use_sep);
}
/* indicate more */
@@ -724,8 +726,9 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe
}
rect_pre.xmax += 4; /* sneaky, avoid showing ugly margin */
- ui_draw_menu_item(&data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre),
- data->items.icons[a], state, false);
+ ui_draw_menu_item(
+ &data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre),
+ data->items.icons[a], state, false);
ui_draw_menu_item(&data->fstyle, &rect_post, data->items.names[a], 0, state, data->use_sep);
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index ec9d8eead43..e9ad2c7c88f 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -381,8 +381,8 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
}
return template_common_search_menu(
- C, ar, id_search_cb_p, &template_ui, template_ID_set_property_cb, active_item_ptr.data,
- template_ui.prv_rows, template_ui.prv_cols);
+ C, ar, id_search_cb_p, &template_ui, template_ID_set_property_cb, active_item_ptr.data,
+ template_ui.prv_rows, template_ui.prv_cols);
}
/************************ ID Template ***************************/
@@ -492,8 +492,9 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
break;
case UI_ID_ALONE:
if (id) {
- const bool do_scene_obj = (GS(id->name) == ID_OB) &&
- (template_ui->ptr.type == &RNA_SceneObjects);
+ const bool do_scene_obj = (
+ (GS(id->name) == ID_OB) &&
+ (template_ui->ptr.type == &RNA_SceneObjects));
/* make copy */
if (do_scene_obj) {
@@ -584,43 +585,49 @@ static uiBut *template_id_def_new_but(
const int but_type = use_tab_but ? UI_BTYPE_TAB : UI_BTYPE_BUT;
/* i18n markup, does nothing! */
- BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_DEFAULT,
- BLT_I18NCONTEXT_ID_SCENE,
- BLT_I18NCONTEXT_ID_OBJECT,
- BLT_I18NCONTEXT_ID_MESH,
- BLT_I18NCONTEXT_ID_CURVE,
- BLT_I18NCONTEXT_ID_METABALL,
- BLT_I18NCONTEXT_ID_MATERIAL,
- BLT_I18NCONTEXT_ID_TEXTURE,
- BLT_I18NCONTEXT_ID_IMAGE,
- BLT_I18NCONTEXT_ID_LATTICE,
- BLT_I18NCONTEXT_ID_LAMP,
- BLT_I18NCONTEXT_ID_CAMERA,
- BLT_I18NCONTEXT_ID_WORLD,
- BLT_I18NCONTEXT_ID_SCREEN,
- BLT_I18NCONTEXT_ID_TEXT,
+ BLT_I18N_MSGID_MULTI_CTXT(
+ "New",
+ BLT_I18NCONTEXT_DEFAULT,
+ BLT_I18NCONTEXT_ID_SCENE,
+ BLT_I18NCONTEXT_ID_OBJECT,
+ BLT_I18NCONTEXT_ID_MESH,
+ BLT_I18NCONTEXT_ID_CURVE,
+ BLT_I18NCONTEXT_ID_METABALL,
+ BLT_I18NCONTEXT_ID_MATERIAL,
+ BLT_I18NCONTEXT_ID_TEXTURE,
+ BLT_I18NCONTEXT_ID_IMAGE,
+ BLT_I18NCONTEXT_ID_LATTICE,
+ BLT_I18NCONTEXT_ID_LAMP,
+ BLT_I18NCONTEXT_ID_CAMERA,
+ BLT_I18NCONTEXT_ID_WORLD,
+ BLT_I18NCONTEXT_ID_SCREEN,
+ BLT_I18NCONTEXT_ID_TEXT,
);
- BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_ID_SPEAKER,
- BLT_I18NCONTEXT_ID_SOUND,
- BLT_I18NCONTEXT_ID_ARMATURE,
- BLT_I18NCONTEXT_ID_ACTION,
- BLT_I18NCONTEXT_ID_NODETREE,
- BLT_I18NCONTEXT_ID_BRUSH,
- BLT_I18NCONTEXT_ID_PARTICLESETTINGS,
- BLT_I18NCONTEXT_ID_GPENCIL,
- BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE,
- BLT_I18NCONTEXT_ID_WORKSPACE,
- BLT_I18NCONTEXT_ID_LIGHTPROBE,
+ BLT_I18N_MSGID_MULTI_CTXT(
+ "New",
+ BLT_I18NCONTEXT_ID_SPEAKER,
+ BLT_I18NCONTEXT_ID_SOUND,
+ BLT_I18NCONTEXT_ID_ARMATURE,
+ BLT_I18NCONTEXT_ID_ACTION,
+ BLT_I18NCONTEXT_ID_NODETREE,
+ BLT_I18NCONTEXT_ID_BRUSH,
+ BLT_I18NCONTEXT_ID_PARTICLESETTINGS,
+ BLT_I18NCONTEXT_ID_GPENCIL,
+ BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE,
+ BLT_I18NCONTEXT_ID_WORKSPACE,
+ BLT_I18NCONTEXT_ID_LIGHTPROBE,
);
if (newop) {
- but = uiDefIconTextButO(block, but_type, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
- (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, but_height, NULL);
+ but = uiDefIconTextButO(
+ block, but_type, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
+ (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, but_height, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
else {
- but = uiDefIconTextBut(block, but_type, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"),
- 0, 0, w, but_height, NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(
+ block, but_type, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"),
+ 0, 0, w, but_height, NULL, 0, 0, 0, 0, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
@@ -680,17 +687,20 @@ static void template_ID(
if (id->lib) {
if (id->tag & LIB_TAG_INDIRECT) {
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change"));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change"));
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
else {
- const bool disabled = (!id_make_local(CTX_data_main(C), id, true /* test */, false) ||
- (idfrom && idfrom->lib));
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0, 0, 0, 0,
- TIP_("Direct linked library data-block, click to make local, "
- "Shift + Click to create a static override"));
+ const bool disabled = (
+ !id_make_local(CTX_data_main(C), id, true /* test */, false) ||
+ (idfrom && idfrom->lib));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Direct linked library data-block, click to make local, "
+ "Shift + Click to create a static override"));
if (disabled) {
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
@@ -700,9 +710,10 @@ static void template_ID(
}
}
else if (ID_IS_STATIC_OVERRIDE(id)) {
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_OVERRIDE, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0, 0, 0, 0,
- TIP_("Static override of linked library data-block, click to make fully local"));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_OVERRIDE, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Static override of linked library data-block, click to make fully local"));
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OVERRIDE));
}
@@ -712,9 +723,10 @@ static void template_ID(
numstr_len = BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
- but = uiDefBut(block, UI_BTYPE_BUT, 0, numstr, 0, 0,
- numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Display number of users of this data (click to make a single-user copy)"));
+ but = uiDefBut(
+ block, UI_BTYPE_BUT, 0, numstr, 0, 0,
+ numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ TIP_("Display number of users of this data (click to make a single-user copy)"));
but->flag |= UI_BUT_UNDO;
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ALONE));
@@ -743,8 +755,9 @@ static void template_ID(
/* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack.
* Only for images, sound and fonts */
if (id && BKE_pack_check(id)) {
- but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
- UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));
+ but = uiDefIconButO(
+ block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
+ UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));
UI_but_operator_ptr_get(but);
RNA_string_set(but->opptr, "id_name", id->name + 2);
@@ -755,13 +768,15 @@ static void template_ID(
int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
if (openop) {
- but = uiDefIconTextButO(block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
- 0, 0, w, UI_UNIT_Y, NULL);
+ but = uiDefIconTextButO(
+ block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
+ 0, 0, w, UI_UNIT_Y, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
}
else {
- but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
}
@@ -782,9 +797,10 @@ static void template_ID(
}
else {
if ((RNA_property_flag(template_ui->prop) & PROP_NEVER_UNLINK) == 0) {
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Unlink data-block "
- "(Shift + Click to set users to zero, data will then not be saved)"));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ TIP_("Unlink data-block "
+ "(Shift + Click to set users to zero, data will then not be saved)"));
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_DELETE));
if (RNA_property_flag(template_ui->prop) & PROP_NEVER_NULL) {
@@ -822,8 +838,9 @@ static void template_ID_tabs(
for (ID *id = template->idlb->first; id; id = id->next) {
wmOperatorType *unlink_ot = WM_operatortype_find(unlinkop, false);
const bool is_active = active_ptr.data == id;
- const unsigned int but_width = UI_fontstyle_string_width(&style->widgetlabel, id->name + 2) + UI_UNIT_X +
- (is_active ? ICON_DEFAULT_WIDTH_SCALE : 0);
+ const unsigned int but_width = (
+ UI_fontstyle_string_width(&style->widgetlabel, id->name + 2) + UI_UNIT_X +
+ (is_active ? ICON_DEFAULT_WIDTH_SCALE : 0));
uiButTab *tab;
tab = (uiButTab *)uiDefButR_prop(
@@ -1047,13 +1064,14 @@ static uiBlock *template_search_menu(bContext *C, ARegion *region, void *arg_tem
/* arg_template is malloced, can be freed by parent button */
template_search = *((TemplateSearch *)arg_template);
- active_ptr = RNA_property_pointer_get(&template_search.search_data.target_ptr,
- template_search.search_data.target_prop);
+ active_ptr = RNA_property_pointer_get(
+ &template_search.search_data.target_ptr,
+ template_search.search_data.target_prop);
return template_common_search_menu(
- C, region, ui_rna_collection_search_cb, &template_search,
- template_search_handle_cb, active_ptr.data,
- template_search.preview_rows, template_search.preview_cols);
+ C, region, ui_rna_collection_search_cb, &template_search,
+ template_search_handle_cb, active_ptr.data,
+ template_search.preview_rows, template_search.preview_cols);
}
static void template_search_add_button_searchmenu(
@@ -1232,8 +1250,9 @@ void uiTemplateSearchPreview(
* - propname: property identifier for property that path gets stored to
* - root_ptr: struct that path gets built from
*/
-void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
- const char *text)
+void uiTemplatePathBuilder(
+ uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
+ const char *text)
{
PropertyRNA *propPath;
uiLayout *row;
@@ -1338,8 +1357,9 @@ static uiLayout *draw_modifier(
BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name);
uiDefBut(block, UI_BTYPE_LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name"));
- but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
- TIP_("Convert virtual modifier to a real modifier"));
+ but = uiDefBut(
+ block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
+ TIP_("Convert virtual modifier to a real modifier"));
UI_but_func_set(but, modifiers_convertToReal, ob, md);
}
else {
@@ -1394,9 +1414,10 @@ static uiLayout *draw_modifier(
if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
/* add disabled pre-tessellated button, so users could have
* message for this modifiers */
- but = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
- UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
- TIP_("This modifier can only be applied on splines' points"));
+ but = uiDefIconButBitI(
+ block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
+ UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+ TIP_("This modifier can only be applied on splines' points"));
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
else if (mti->type != eModifierTypeType_Constructive) {
@@ -1454,13 +1475,15 @@ static uiLayout *draw_modifier(
}
else {
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
- uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
- 0, "apply_as", MODIFIER_APPLY_DATA);
+ uiItemEnumO(
+ row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
+ 0, "apply_as", MODIFIER_APPLY_DATA);
if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
- uiItemEnumO(row, "OBJECT_OT_modifier_apply",
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
- 0, "apply_as", MODIFIER_APPLY_SHAPE);
+ uiItemEnumO(
+ row, "OBJECT_OT_modifier_apply",
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
+ 0, "apply_as", MODIFIER_APPLY_SHAPE);
}
}
@@ -1918,8 +1941,9 @@ void uiTemplatePreview(
UI_but_func_drawextra_set(block, ED_preview_draw, pparent, slot);
UI_block_func_handle_set(block, do_preview_buttons, NULL);
- uiDefIconButS(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height,
- UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, "");
+ uiDefIconButS(
+ block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height,
+ UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, "");
/* add buttons */
if (pid && show_buttons) {
@@ -2067,17 +2091,20 @@ static void colorband_buttons_layout(
UI_block_align_begin(block);
row = uiLayoutRow(split, false);
- bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL,
- 0, 0, 0, 0, TIP_("Add a new color stop to the colorband"));
+ bt = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL,
+ 0, 0, 0, 0, TIP_("Add a new color stop to the colorband"));
UI_but_funcN_set(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
- bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, TIP_("Delete the active position"));
+ bt = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Delete the active position"));
UI_but_funcN_set(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
- bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
+ bt = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
UI_but_funcN_set(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
bt = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_colorband", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, xs + 6.0f * unit, ys + UI_UNIT_Y, UI_UNIT_X, UI_UNIT_Y, NULL);
@@ -2498,8 +2525,9 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, UI_BTYPE_LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- bt = uiDefButBitI(block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
- 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
+ bt = uiDefButBitI(
+ block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
+ 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
UI_but_func_set(bt, curvemap_buttons_setclip, cumap, NULL);
UI_block_align_begin(block);
@@ -2758,11 +2786,13 @@ static void curvemap_buttons_layout(
if (brush)
bt = uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
else if (neg_slope)
- bt = uiDefIconBlockBut(block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER,
- 0, 0, dx, dx, TIP_("Tools"));
+ bt = uiDefIconBlockBut(
+ block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER,
+ 0, 0, dx, dx, TIP_("Tools"));
else
- bt = uiDefIconBlockBut(block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER,
- 0, 0, dx, dx, TIP_("Tools"));
+ bt = uiDefIconBlockBut(
+ block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER,
+ 0, 0, dx, dx, TIP_("Tools"));
UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -2892,24 +2922,28 @@ void uiTemplateColorPicker(
switch (U.color_picker_type) {
case USER_CP_SQUARE_SV:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
break;
case USER_CP_SQUARE_HS:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
break;
case USER_CP_SQUARE_HV:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
break;
/* user default */
case USER_CP_CIRCLE_HSV:
case USER_CP_CIRCLE_HSL:
default:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, 0, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, 0, 0, "");
break;
}
@@ -2935,31 +2969,36 @@ void uiTemplateColorPicker(
switch (U.color_picker_type) {
case USER_CP_CIRCLE_HSL:
uiItemS(row);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
- -1, softmin, softmax, UI_GRAD_L_ALT, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_L_ALT, 0, "");
break;
case USER_CP_SQUARE_SV:
uiItemS(col);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
- -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
break;
case USER_CP_SQUARE_HS:
uiItemS(col);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
- -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
break;
case USER_CP_SQUARE_HV:
uiItemS(col);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
- -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
break;
/* user default */
case USER_CP_CIRCLE_HSV:
default:
uiItemS(row);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
- -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
break;
}
@@ -3010,8 +3049,9 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname,
}
RNA_pointer_create(&palette->id, &RNA_PaletteColor, color, &color_ptr);
- uiDefButR(block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0,
- UI_PALETTE_COLOR, col_id, "");
+ uiDefButR(
+ block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0,
+ UI_PALETTE_COLOR, col_id, "");
row_cols++;
col_id++;
}
@@ -3172,8 +3212,9 @@ static int cmpstringp(const void *p1, const void *p2)
return BLI_strcasecmp(((StringCmp *) p1)->name, ((StringCmp *) p2)->name);
}
-static void uilist_filter_items_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr,
- const char *propname)
+static void uilist_filter_items_default(
+ struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr,
+ const char *propname)
{
uiListDyn *dyn_data = ui_list->dyn_data;
PropertyRNA *prop = RNA_struct_find_property(dataptr, propname);
@@ -3615,9 +3656,10 @@ void uiTemplateList(
/* list item behind label & other buttons */
sub = uiLayoutRow(overlap, false);
- but = uiDefButR_prop(subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
- active_dataptr, activeprop, 0, 0, org_i, 0, 0,
- TIP_("Double click to rename"));
+ but = uiDefButR_prop(
+ subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ active_dataptr, activeprop, 0, 0, org_i, 0, 0,
+ TIP_("Double click to rename"));
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr, item_dyntip_propname))) {
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data);
}
@@ -3673,8 +3715,9 @@ void uiTemplateList(
/* next/prev button */
BLI_snprintf(numstr, sizeof(numstr), "%d :", dyn_data->items_shown);
- but = uiDefIconTextButR_prop(block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
- active_dataptr, activeprop, 0, 0, 0, 0, 0, "");
+ but = uiDefIconTextButR_prop(
+ block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
+ active_dataptr, activeprop, 0, 0, 0, 0, 0, "");
if (dyn_data->items_shown == 0)
UI_but_flag_enable(but, UI_BUT_DISABLED);
break;
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index e049416ce07..d080397c488 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -409,8 +409,9 @@ int UI_calc_float_precision(int prec, double value)
bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
{
if (but->rnapoin.id.data && but->rnapoin.data && but->rnaprop) {
- BLI_snprintf(r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type),
- RNA_property_identifier(but->rnaprop));
+ BLI_snprintf(
+ r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type),
+ RNA_property_identifier(but->rnaprop));
return true;
}
else if (but->optype) {
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index b81825eba6e..dbd65ade307 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -674,13 +674,16 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re
float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize;
- const int hnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
- (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
- const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
- (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
+ const int hnum = (
+ (roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
+ (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
+ const int vnum = (
+ (roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
+ (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
- minsize = min_ii(BLI_rcti_size_x(rect) * hnum,
- BLI_rcti_size_y(rect) * vnum);
+ minsize = min_ii(
+ BLI_rcti_size_x(rect) * hnum,
+ BLI_rcti_size_y(rect) * vnum);
if (2.0f * rad > minsize)
rad = 0.5f * minsize;
@@ -1662,8 +1665,9 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
/* once the label's gone, chop off the least significant digits */
if (but->strwidth > okwidth) {
float strwidth;
- drawstr_len = BLF_width_to_strlen(fstyle->uifont_id, but->drawstr + but->ofs,
- drawstr_len - but->ofs, okwidth, &strwidth) + but->ofs;
+ drawstr_len = BLF_width_to_strlen(
+ fstyle->uifont_id, but->drawstr + but->ofs,
+ drawstr_len - but->ofs, okwidth, &strwidth) + but->ofs;
but->strwidth = strwidth;
but->drawstr[drawstr_len] = 0;
}
@@ -1690,8 +1694,9 @@ static void widget_draw_text_ime_underline(
ofs_x = 0;
}
- width = BLF_width(fstyle->uifont_id, drawstr + but->ofs,
- ime_data->composite_len + but->pos - but->ofs);
+ width = BLF_width(
+ fstyle->uifont_id, drawstr + but->ofs,
+ ime_data->composite_len + but->pos - but->ofs);
rgba_uchar_to_float(fcol, wcol->text);
UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 1, fcol);
@@ -1708,8 +1713,9 @@ static void widget_draw_text_ime_underline(
ofs_x = 0;
}
- width = BLF_width(fstyle->uifont_id, drawstr + but->ofs,
- sel_end + sel_start - but->ofs);
+ width = BLF_width(
+ fstyle->uifont_id, drawstr + but->ofs,
+ sel_end + sel_start - but->ofs);
UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 2, fcol);
}
@@ -1762,9 +1768,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
if (ime_data && ime_data->composite_len) {
/* insert composite string into cursor pos */
- BLI_snprintf((char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s",
- but->editstr, ime_data->str_composite,
- but->editstr + but->pos);
+ BLI_snprintf(
+ (char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s",
+ but->editstr, ime_data->str_composite,
+ but->editstr + but->pos);
}
else
#endif
@@ -2443,8 +2450,9 @@ static void ui_hsv_cursor(float x, float y)
immUnbindProgram();
}
-void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect,
- const float mx, const float my)
+void ui_hsvcircle_vals_from_pos(
+ float *val_rad, float *val_dist, const rcti *rect,
+ const float mx, const float my)
{
/* duplication of code... well, simple is better now */
const float centx = BLI_rcti_cent_x_fl(rect);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 4e9d1fad6e0..fc282e50ce2 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1755,9 +1755,10 @@ View2DScrollers *UI_view2d_scrollers_calc(
scrollers->yclamp = yclamp;
scrollers->yunits = yunits;
- scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d,
- xunits, xclamp, yunits, yclamp,
- BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert));
+ scrollers->grid = UI_view2d_grid_calc(
+ CTX_data_scene(C), v2d,
+ xunits, xclamp, yunits, yclamp,
+ BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert));
}
/* return scrollers */
@@ -2132,12 +2133,14 @@ void UI_view2d_listview_visible_cells(
/* using 'cur' rect coordinates, call the cell-getting function to get the cells for this */
if (v2d) {
/* min */
- UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty,
- v2d->cur.xmin, v2d->cur.ymin, column_min, row_min);
+ UI_view2d_listview_view_to_cell(
+ v2d, columnwidth, rowheight, startx, starty,
+ v2d->cur.xmin, v2d->cur.ymin, column_min, row_min);
/* max*/
- UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty,
- v2d->cur.xmax, v2d->cur.ymax, column_max, row_max);
+ UI_view2d_listview_view_to_cell(
+ v2d, columnwidth, rowheight, startx, starty,
+ v2d->cur.xmax, v2d->cur.ymax, column_max, row_max);
}
}
@@ -2547,8 +2550,9 @@ void UI_view2d_text_cache_draw(ARegion *ar)
}
if (v2s->rect.xmin >= v2s->rect.xmax)
- BLF_draw_default((float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0,
- v2s->str, BLF_DRAW_STR_DUMMY_MAX);
+ BLF_draw_default(
+ (float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0,
+ v2s->str, BLF_DRAW_STR_DUMMY_MAX);
else {
BLF_enable(font_id, BLF_CLIPPING);
BLF_clipping(font_id, v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index defb7391bdf..23f8b4c9bc4 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -183,9 +183,10 @@ static void view_pan_apply(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd = op->customdata;
- view_pan_apply_ex(C, vpd,
- RNA_int_get(op->ptr, "deltax"),
- RNA_int_get(op->ptr, "deltay"));
+ view_pan_apply_ex(
+ C, vpd,
+ RNA_int_get(op->ptr, "deltax"),
+ RNA_int_get(op->ptr, "deltay"));
}
@@ -736,9 +737,10 @@ static void view_zoomstep_apply_ex(
static void view_zoomstep_apply(bContext *C, wmOperator *op)
{
v2dViewZoomData *vzd = op->customdata;
- view_zoomstep_apply_ex(C, vzd, true,
- RNA_float_get(op->ptr, "zoomfacx"),
- RNA_float_get(op->ptr, "zoomfacy"));
+ view_zoomstep_apply_ex(
+ C, vzd, true,
+ RNA_float_get(op->ptr, "zoomfacx"),
+ RNA_float_get(op->ptr, "zoomfacy"));
}
/* --------------- Individual Operators ------------------- */
@@ -791,9 +793,10 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d,
- event->mval[0], event->mval[1],
- &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &ar->v2d,
+ event->mval[0], event->mval[1],
+ &vzd->mx_2d, &vzd->my_2d);
}
return view_zoomin_exec(C, op);
@@ -856,9 +859,10 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d,
- event->mval[0], event->mval[1],
- &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &ar->v2d,
+ event->mval[0], event->mval[1],
+ &vzd->mx_2d, &vzd->my_2d);
}
return view_zoomout_exec(C, op);
@@ -1066,9 +1070,10 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d,
- event->mval[0], event->mval[1],
- &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &ar->v2d,
+ event->mval[0], event->mval[1],
+ &vzd->mx_2d, &vzd->my_2d);
}
if (v2d->keepofs & V2D_LOCKOFS_X)
@@ -1355,9 +1360,10 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
vzd = op->customdata;
- view_zoomstep_apply_ex(C, vzd, false,
- do_zoom_xy[0] ? zoom_factor : 0.0f,
- do_zoom_xy[1] ? zoom_factor : 0.0f);
+ view_zoomstep_apply_ex(
+ C, vzd, false,
+ do_zoom_xy[0] ? zoom_factor : 0.0f,
+ do_zoom_xy[1] ? zoom_factor : 0.0f);
view_zoomstep_exit(op);
}
@@ -1402,14 +1408,18 @@ struct SmoothView2DStore {
*/
static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
{
- const float size_a[2] = {BLI_rctf_size_x(rect_a),
- BLI_rctf_size_y(rect_a)};
- const float size_b[2] = {BLI_rctf_size_x(rect_b),
- BLI_rctf_size_y(rect_b)};
- const float cent_a[2] = {BLI_rctf_cent_x(rect_a),
- BLI_rctf_cent_y(rect_a)};
- const float cent_b[2] = {BLI_rctf_cent_x(rect_b),
- BLI_rctf_cent_y(rect_b)};
+ const float size_a[2] = {
+ BLI_rctf_size_x(rect_a),
+ BLI_rctf_size_y(rect_a)};
+ const float size_b[2] = {
+ BLI_rctf_size_x(rect_b),
+ BLI_rctf_size_y(rect_b)};
+ const float cent_a[2] = {
+ BLI_rctf_cent_x(rect_a),
+ BLI_rctf_cent_y(rect_a)};
+ const float cent_b[2] = {
+ BLI_rctf_cent_x(rect_b),
+ BLI_rctf_cent_y(rect_b)};
float fac_max = 0.0f;
float tfac;
@@ -1724,9 +1734,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
- vsm->zone = mouse_in_scroller_handle(event->mval[0],
- v2d->hor.xmin, v2d->hor.xmax,
- scrollers->hor_min, scrollers->hor_max);
+ vsm->zone = mouse_in_scroller_handle(
+ event->mval[0],
+ v2d->hor.xmin, v2d->hor.xmax,
+ scrollers->hor_min, scrollers->hor_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
@@ -1745,9 +1756,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
- vsm->zone = mouse_in_scroller_handle(event->mval[1],
- v2d->vert.ymin, v2d->vert.ymax,
- scrollers->vert_min, scrollers->vert_max);
+ vsm->zone = mouse_in_scroller_handle(
+ event->mval[1],
+ v2d->vert.ymin, v2d->vert.ymax,
+ scrollers->vert_min, scrollers->vert_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */