diff options
9 files changed, 157 insertions, 153 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 9799ab85cfb..40b6a4e5b2b 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -43,7 +43,7 @@ #include "DNA_view3d_types.h" #include "DNA_gpencil_modifier_types.h" - /* If builtin shaders are needed */ +/* If builtin shaders are needed */ #include "GPU_shader.h" #include "GPU_texture.h" @@ -66,10 +66,10 @@ #define GP_SET_SRC_GPS(src_gps) if (src_gps) src_gps = src_gps->next /* Get number of vertex for using in GPU VBOs */ -void gpencil_calc_vertex( - GPENCIL_StorageList *stl, tGPencilObjectCache *cache_ob, - GpencilBatchCache *cache, bGPdata *gpd, - int cfra_eval) +static void gpencil_calc_vertex( + GPENCIL_StorageList *stl, tGPencilObjectCache *cache_ob, + GpencilBatchCache *cache, bGPdata *gpd, + int cfra_eval) { Object *ob = cache_ob->ob; const DRWContextState *draw_ctx = DRW_context_state_get(); @@ -88,14 +88,14 @@ void gpencil_calc_vertex( /* verify time modifiers */ if ((time_remap) && (!stl->storage->simplify_modif)) { int remap_cfra = BKE_gpencil_time_modifier( - draw_ctx->depsgraph, draw_ctx->scene, ob, gpl, cfra_eval, - stl->storage->is_render); + draw_ctx->depsgraph, draw_ctx->scene, ob, gpl, cfra_eval, + stl->storage->is_render); gpf = BKE_gpencil_layer_getframe(gpl, remap_cfra, GP_GETFRAME_USE_PREV); } else { gpf = gpl->actframe; } - + if (gpf == NULL) { continue; } @@ -581,9 +581,9 @@ static void gpencil_add_fill_vertexdata( /* add to list of groups */ if (old_len < cache->b_fill.vbo_len) { cache->grp_cache = gpencil_group_cache_add( - cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Fill, onion, - cache->b_fill.vbo_len, - &cache->grp_size, &cache->grp_used); + cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Fill, onion, + cache->b_fill.vbo_len, + &cache->grp_size, &cache->grp_used); } } } @@ -591,10 +591,11 @@ static void gpencil_add_fill_vertexdata( } /* add stroke vertex info */ -static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache, - Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, - const float opacity, const float tintcolor[4], const bool onion, - const bool custonion) +static void gpencil_add_stroke_vertexdata( + GpencilBatchCache *cache, + Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, + const float opacity, const float tintcolor[4], const bool onion, + const bool custonion) { float tcolor[4]; float ink[4]; @@ -632,13 +633,13 @@ static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache, /* create vertex data */ const int old_len = cache->b_stroke.vbo_len; DRW_gpencil_get_stroke_geom(&cache->b_stroke, gps, sthickness, ink); - + /* add to list of groups */ if (old_len < cache->b_stroke.vbo_len) { cache->grp_cache = gpencil_group_cache_add( - cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Stroke, onion, - cache->b_stroke.vbo_len, - &cache->grp_size, &cache->grp_used); + cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Stroke, onion, + cache->b_stroke.vbo_len, + &cache->grp_size, &cache->grp_used); } } else { @@ -649,9 +650,9 @@ static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache, /* add to list of groups */ if (old_len < cache->b_point.vbo_len) { cache->grp_cache = gpencil_group_cache_add( - cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Point, onion, - cache->b_point.vbo_len, - &cache->grp_size, &cache->grp_used); + cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Point, onion, + cache->b_point.vbo_len, + &cache->grp_size, &cache->grp_used); } } } @@ -659,7 +660,7 @@ static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache, /* add edit points vertex info */ static void gpencil_add_editpoints_vertexdata( - GPENCIL_StorageList *stl, GpencilBatchCache *cache, ToolSettings *UNUSED(ts), Object *ob, + GPENCIL_StorageList *UNUSED(stl), GpencilBatchCache *cache, ToolSettings *UNUSED(ts), Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps) { const DRWContextState *draw_ctx = DRW_context_state_get(); @@ -678,17 +679,17 @@ static void gpencil_add_editpoints_vertexdata( if (cache->is_dirty) { if ((obact == ob) && - ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) && - (v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES)) + ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) && + (v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES)) { /* line of the original stroke */ DRW_gpencil_get_edlin_geom(&cache->b_edlin, gps, edit_alpha, gpd->flag); /* add to list of groups */ cache->grp_cache = gpencil_group_cache_add( - cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Edlin, false, - cache->b_edlin.vbo_len, - &cache->grp_size, &cache->grp_used); + cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Edlin, false, + cache->b_edlin.vbo_len, + &cache->grp_size, &cache->grp_used); } /* edit points */ if ((gps->flag & GP_STROKE_SELECT) || (is_weight_paint)) { @@ -698,9 +699,9 @@ static void gpencil_add_editpoints_vertexdata( /* add to list of groups */ cache->grp_cache = gpencil_group_cache_add( - cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Edit, false, - cache->b_edit.vbo_len, - &cache->grp_size, &cache->grp_used); + cache->grp_cache, gpl, gpf, gps, eGpencilBatchGroupType_Edit, false, + cache->b_edit.vbo_len, + &cache->grp_size, &cache->grp_used); } } } @@ -799,7 +800,7 @@ static void gpencil_draw_strokes( /* fill */ if ((gp_style->flag & GP_STYLE_FILL_SHOW) && - (!stl->storage->simplify_fill)) + (!stl->storage->simplify_fill)) { gpencil_add_fill_vertexdata( cache, ob, gpl, derived_gpf, gps, @@ -807,11 +808,11 @@ static void gpencil_draw_strokes( } /* stroke */ if ((gp_style->flag & GP_STYLE_STROKE_SHOW) && - (gp_style->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH)) + (gp_style->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH)) { gpencil_add_stroke_vertexdata( - cache, ob, gpl, derived_gpf, gps, - opacity, tintcolor, false, custonion); + cache, ob, gpl, derived_gpf, gps, + opacity, tintcolor, false, custonion); } } @@ -856,9 +857,9 @@ static void gpencil_get_onion_alpha(float color[4], bGPdata *gpd) /* function to draw strokes for onion only */ static void gpencil_draw_onion_strokes( - GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, Object *ob, - bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, - const float opacity, const float tintcolor[4], const bool custonion) + GpencilBatchCache *cache, GPENCIL_e_data *UNUSED(e_data), void *vedata, Object *ob, + bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, + const float opacity, const float tintcolor[4], const bool custonion) { GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl; Depsgraph *depsgraph = DRW_context_state_get()->depsgraph; @@ -886,7 +887,7 @@ static void gpencil_draw_onion_strokes( /* stroke */ gpencil_add_stroke_vertexdata( - cache, ob, gpl, gpf, gps, opacity, tintcolor, true, custonion); + cache, ob, gpl, gpf, gps, opacity, tintcolor, true, custonion); stl->storage->shgroup_id++; } @@ -894,8 +895,8 @@ static void gpencil_draw_onion_strokes( /* draw onion-skinning for a layer */ static void gpencil_draw_onionskins( - GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, - Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf) + GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, + Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf) { const float default_color[3] = { UNPACK3(U.gpencil_new_layer_col) }; @@ -1029,8 +1030,8 @@ static void gpencil_draw_onionskins( if ((last == gpf->framenum) || (gpf->next == NULL)) { gpencil_get_onion_alpha(color, gpd); gpencil_draw_onion_strokes( - cache, e_data, vedata, ob, gpd, gpl, - gpf_loop, color[3], color, colflag); + cache, e_data, vedata, ob, gpd, gpl, + gpf_loop, color[3], color, colflag); } } } @@ -1165,11 +1166,11 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T if (gpd->runtime.sbuffer_size > 1) { if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) { stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_stroke_create( - e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL, gpd, gp_style, -1, false); + e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL, gpd, gp_style, -1, false); } else { stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_point_create( - e_data, vedata, psl->drawing_pass, e_data->gpencil_point_sh, NULL, gpd, gp_style, -1, false); + e_data, vedata, psl->drawing_pass, e_data->gpencil_point_sh, NULL, gpd, gp_style, -1, false); } /* clean previous version of the batch */ @@ -1182,32 +1183,32 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T /* use unit matrix because the buffer is in screen space and does not need conversion */ if (gpd->runtime.mode == GP_STYLE_MODE_LINE) { e_data->batch_buffer_stroke = DRW_gpencil_get_buffer_stroke_geom( - gpd, lthick); + gpd, lthick); } else { e_data->batch_buffer_stroke = DRW_gpencil_get_buffer_point_geom( - gpd, lthick); + gpd, lthick); } if (gp_style->flag & GP_STYLE_STROKE_SHOW) { DRW_shgroup_call_add( - stl->g_data->shgrps_drawing_stroke, - e_data->batch_buffer_stroke, - stl->storage->unit_matrix); + stl->g_data->shgrps_drawing_stroke, + e_data->batch_buffer_stroke, + stl->storage->unit_matrix); } if ((gpd->runtime.sbuffer_size >= 3) && - (gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) && - ((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0) && - ((brush->gpencil_settings->flag & GP_BRUSH_DISSABLE_LASSO) == 0) && - (gp_style->flag & GP_STYLE_FILL_SHOW)) + (gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) && + ((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0) && + ((brush->gpencil_settings->flag & GP_BRUSH_DISSABLE_LASSO) == 0) && + (gp_style->flag & GP_STYLE_FILL_SHOW)) { /* if not solid, fill is simulated with solid color */ if (gpd->runtime.bfill_style > 0) { gpd->runtime.sfill[3] = 0.5f; } stl->g_data->shgrps_drawing_fill = DRW_shgroup_create( - e_data->gpencil_drawing_fill_sh, psl->drawing_pass); + e_data->gpencil_drawing_fill_sh, psl->drawing_pass); /* clean previous version of the batch */ if (stl->storage->buffer_fill) { @@ -1218,9 +1219,9 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T e_data->batch_buffer_fill = DRW_gpencil_get_buffer_fill_geom(gpd); DRW_shgroup_call_add( - stl->g_data->shgrps_drawing_fill, - e_data->batch_buffer_fill, - stl->storage->unit_matrix); + stl->g_data->shgrps_drawing_fill, + e_data->batch_buffer_fill, + stl->storage->unit_matrix); stl->storage->buffer_fill = true; } stl->storage->buffer_stroke = true; @@ -1251,9 +1252,9 @@ static void DRW_gpencil_create_batches(GpencilBatchCache *cache) /* create all shading groups */ static void DRW_gpencil_shgroups_create( - GPENCIL_e_data *e_data, void *vedata, - Object *ob, bGPdata *gpd, - GpencilBatchCache *cache, tGPencilObjectCache *cache_ob) + GPENCIL_e_data *e_data, void *vedata, + Object *ob, bGPdata *gpd, + GpencilBatchCache *cache, tGPencilObjectCache *cache_ob) { GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl; GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl; @@ -1286,13 +1287,13 @@ static void DRW_gpencil_shgroups_create( const int len = elm->vertex_idx - start_stroke; shgrp = DRW_gpencil_shgroup_stroke_create( - e_data, vedata, psl->stroke_pass, e_data->gpencil_stroke_sh, - ob, gpd, gp_style, stl->storage->shgroup_id, elm->onion); + e_data, vedata, psl->stroke_pass, e_data->gpencil_stroke_sh, + ob, gpd, gp_style, stl->storage->shgroup_id, elm->onion); DRW_shgroup_call_range_add( - shgrp, cache->b_stroke.batch, - (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, - start_stroke, len); + shgrp, cache->b_stroke.batch, + (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, + start_stroke, len); stl->storage->shgroup_id++; start_stroke = elm->vertex_idx; @@ -1303,13 +1304,13 @@ static void DRW_gpencil_shgroups_create( const int len = elm->vertex_idx - start_point; shgrp = DRW_gpencil_shgroup_point_create( - e_data, vedata, psl->stroke_pass, e_data->gpencil_point_sh, - ob, gpd, gp_style, stl->storage->shgroup_id, elm->onion); + e_data, vedata, psl->stroke_pass, e_data->gpencil_point_sh, + ob, gpd, gp_style, stl->storage->shgroup_id, elm->onion); DRW_shgroup_call_range_add( - shgrp, cache->b_point.batch, - (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, - start_point, len); + shgrp, cache->b_point.batch, + (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, + start_point, len); stl->storage->shgroup_id++; start_point = elm->vertex_idx; @@ -1320,13 +1321,13 @@ static void DRW_gpencil_shgroups_create( const int len = elm->vertex_idx - start_fill; shgrp = DRW_gpencil_shgroup_fill_create( - e_data, vedata, psl->stroke_pass, e_data->gpencil_fill_sh, - gpd, gpl, gp_style, stl->storage->shgroup_id); + e_data, vedata, psl->stroke_pass, e_data->gpencil_fill_sh, + gpd, gpl, gp_style, stl->storage->shgroup_id); DRW_shgroup_call_range_add( - shgrp, cache->b_fill.batch, - (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, - start_fill, len); + shgrp, cache->b_fill.batch, + (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, + start_fill, len); stl->storage->shgroup_id++; start_fill = elm->vertex_idx; @@ -1337,10 +1338,10 @@ static void DRW_gpencil_shgroups_create( const int len = elm->vertex_idx - start_edit; /* use always the same group */ DRW_shgroup_call_range_add( - stl->g_data->shgrps_edit_point, - cache->b_edit.batch, - (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, - start_edit, len); + stl->g_data->shgrps_edit_point, + cache->b_edit.batch, + (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, + start_edit, len); start_edit = elm->vertex_idx; break; @@ -1350,10 +1351,10 @@ static void DRW_gpencil_shgroups_create( const int len = elm->vertex_idx - start_edlin; /* use always the same group */ DRW_shgroup_call_range_add( - stl->g_data->shgrps_edit_line, - cache->b_edlin.batch, - (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, - start_edlin, len); + stl->g_data->shgrps_edit_line, + cache->b_edlin.batch, + (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, + start_edlin, len); start_edlin = elm->vertex_idx; break; @@ -1494,8 +1495,8 @@ void DRW_gpencil_populate_datablock( int remap_cfra = cfra_eval; if ((time_remap) && (!stl->storage->simplify_modif)) { remap_cfra = BKE_gpencil_time_modifier( - draw_ctx->depsgraph, scene, ob, gpl, cfra_eval, - stl->storage->is_render); + draw_ctx->depsgraph, scene, ob, gpl, cfra_eval, + stl->storage->is_render); } gpf = BKE_gpencil_layer_getframe(gpl, remap_cfra, GP_GETFRAME_USE_PREV); @@ -1548,8 +1549,8 @@ void DRW_gpencil_populate_datablock( } /* draw normal strokes */ gpencil_draw_strokes( - cache, e_data, vedata, ts, ob, gpd, gpl, gpf, derived_gpf, - opacity, gpl->tintcolor, false, cache_ob); + cache, e_data, vedata, ts, ob, gpd, gpl, gpf, derived_gpf, + opacity, gpl->tintcolor, false, cache_ob); } /* clear any lattice data */ diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 5078d071dd8..a0c31b64666 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1845,7 +1845,7 @@ void ED_gpencil_calc_stroke_uv(Object *ob, bGPDstroke *gps) /* if image, use texture width */ if ((gp_style) && (gp_style->stroke_style == GP_STYLE_STROKE_STYLE_TEXTURE) && - (gp_style->sima)) + (gp_style->sima)) { factor = gp_style->sima->gen_x; } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 0ad7a18b5ac..950d156d4ed 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -988,8 +988,8 @@ static bool ui_but_event_operator_string_from_menu( IDP_AddToGroup(prop_menu, IDP_NewString(mt->idname, "name", sizeof(mt->idname))); if (WM_key_event_operator_string( - C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, true, - buf, buf_len)) + C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, true, + buf, buf_len)) { found = true; } @@ -1151,8 +1151,8 @@ static bool ui_but_event_property_operator_string( /* check each until one works... */ for (i = 0; (i < num_ops) && (ctx_toggle_opnames[i]); i++) { if (WM_key_event_operator_string( - C, ctx_toggle_opnames[i], WM_OP_INVOKE_REGION_WIN, prop_path, false, - buf, buf_len)) + C, ctx_toggle_opnames[i], WM_OP_INVOKE_REGION_WIN, prop_path, false, + buf, buf_len)) { found = true; break; @@ -1510,10 +1510,10 @@ static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlo if (but->rnapoin.type && but->rnaprop) { /* quick check to avoid adding buttons representing a vector, multiple times. */ if ((but_prev && - (but_prev->rnaprop == but->rnaprop) && - (but_prev->rnapoin.type == but->rnapoin.type) && - (but_prev->rnapoin.data == but->rnapoin.data) && - (but_prev->rnapoin.id.data == but->rnapoin.id.data)) == false) + (but_prev->rnaprop == but->rnaprop) && + (but_prev->rnapoin.type == but->rnapoin.type) && + (but_prev->rnapoin.data == but->rnapoin.data) && + (but_prev->rnapoin.id.data == but->rnapoin.id.data)) == false) { /* TODO: could make this into utility function. */ WM_msg_subscribe_rna( @@ -3019,8 +3019,8 @@ void ui_but_update_ex(uiBut *but, const bool validate) EnumPropertyItem item; if (RNA_property_enum_item_from_value_gettexted( - but->block->evil_C, - &but->rnapoin, but->rnaprop, value_enum, &item)) + but->block->evil_C, + &but->rnapoin, but->rnaprop, value_enum, &item)) { size_t slen = strlen(item.name); ui_but_string_free_internal(but); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 2f84045a73f..ef20d1a1063 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2174,8 +2174,8 @@ static bool ui_but_has_array_value(uiBut *but) { return (but->rnapoin.data && but->rnaprop && ELEM(RNA_property_subtype(but->rnaprop), PROP_COLOR, PROP_TRANSLATION, PROP_DIRECTION, - PROP_VELOCITY, PROP_ACCELERATION, PROP_MATRIX, PROP_EULER, PROP_QUATERNION, PROP_AXISANGLE, - PROP_XYZ, PROP_XYZ_LENGTH, PROP_COLOR_GAMMA, PROP_COORDS)); + PROP_VELOCITY, PROP_ACCELERATION, PROP_MATRIX, PROP_EULER, PROP_QUATERNION, PROP_AXISANGLE, + PROP_XYZ, PROP_XYZ_LENGTH, PROP_COLOR_GAMMA, PROP_COORDS)); } static void ui_but_paste_normalized_vector(bContext *C, uiBut *but, char *buf_paste) @@ -8063,38 +8063,38 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) break; } case MOUSEMOVE: - { - /* deselect the button when moving the mouse away */ - /* also de-activate for buttons that only show highlights */ - if (ui_but_contains_point_px(ar, but, event->x, event->y)) { - - /* Drag on a hold button (used in the toolbar) now opens it immediately. */ - if (data->hold_action_timer) { - if (but->flag & UI_SELECT) { - if ((abs(event->x - event->prevx)) > 2 || - (abs(event->y - event->prevy)) > 2) - { - WM_event_remove_timer(data->wm, data->window, data->hold_action_timer); - data->hold_action_timer = WM_event_add_timer(data->wm, data->window, TIMER, 0.0f); - } + { + /* deselect the button when moving the mouse away */ + /* also de-activate for buttons that only show highlights */ + if (ui_but_contains_point_px(ar, but, event->x, event->y)) { + + /* Drag on a hold button (used in the toolbar) now opens it immediately. */ + if (data->hold_action_timer) { + if (but->flag & UI_SELECT) { + if ((abs(event->x - event->prevx)) > 2 || + (abs(event->y - event->prevy)) > 2) + { + WM_event_remove_timer(data->wm, data->window, data->hold_action_timer); + data->hold_action_timer = WM_event_add_timer(data->wm, data->window, TIMER, 0.0f); } } + } - if (!(but->flag & UI_SELECT)) { - but->flag |= (UI_SELECT | UI_ACTIVE); - data->cancel = false; - ED_region_tag_redraw(data->region); - } + if (!(but->flag & UI_SELECT)) { + but->flag |= (UI_SELECT | UI_ACTIVE); + data->cancel = false; + ED_region_tag_redraw(data->region); } - else { - if (but->flag & UI_SELECT) { - but->flag &= ~(UI_SELECT | UI_ACTIVE); - data->cancel = true; - ED_region_tag_redraw(data->region); - } + } + else { + if (but->flag & UI_SELECT) { + but->flag &= ~(UI_SELECT | UI_ACTIVE); + data->cancel = true; + ED_region_tag_redraw(data->region); } } break; + } default: /* otherwise catch mouse release event */ ui_do_button(C, block, but, event); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 424f5004bf0..b36f83b1ccf 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -268,7 +268,7 @@ static int ui_item_fit(int item, int pos, int all, int available, bool is_last, static int ui_layout_vary_direction(uiLayout *layout) { return ((ELEM(layout->root->type, UI_LAYOUT_HEADER, UI_LAYOUT_PIEMENU) || - (layout->alignment != UI_LAYOUT_ALIGN_EXPAND)) ? + (layout->alignment != UI_LAYOUT_ALIGN_EXPAND)) ? UI_ITEM_VARY_X : UI_ITEM_VARY_Y); } @@ -2533,8 +2533,8 @@ void uiItemMenuEnumO_ptr( { char keybuf[128]; if (WM_key_event_operator_string( - C, ot->idname, layout->root->opcontext, NULL, false, - keybuf, sizeof(keybuf))) + C, ot->idname, layout->root->opcontext, NULL, false, + keybuf, sizeof(keybuf))) { ui_but_add_shortcut(but, keybuf, false); } diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c index afa3486cf6c..a99bcb2b73c 100644 --- a/source/blender/editors/interface/interface_region_color_picker.c +++ b/source/blender/editors/interface/interface_region_color_picker.c @@ -549,8 +549,8 @@ static void ui_block_colorpicker( UI_but_func_set(bt, ui_colorpicker_hex_rna_cb, bt, hexcol); bt->custom_data = cpicker; uiDefBut( - block, UI_BTYPE_LABEL, 0, IFACE_("(Gamma Corrected)"), 0, yco - UI_UNIT_Y, - butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + block, UI_BTYPE_LABEL, 0, IFACE_("(Gamma Corrected)"), 0, yco - UI_UNIT_Y, + butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); ui_rgb_to_color_picker_v(rgb_gamma, hsv); diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index b7fc1055154..44effc8c097 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -105,7 +105,7 @@ static float ui_pie_menu_title_width(const char *name, int icon) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; return (UI_fontstyle_string_width(fstyle, name) + - (UI_UNIT_X * (1.50f + (icon ? 0.25f : 0.0f)))); + (UI_UNIT_X * (1.50f + (icon ? 0.25f : 0.0f)))); } uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, const wmEvent *event) diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 738da4184b7..d4f6933693e 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -318,7 +318,8 @@ void UI_fontstyle_draw_simple_backdrop( float color[4] = { col_bg[0], col_bg[1], col_bg[2], 0.5f }; UI_draw_roundbox_corner_set(UI_CNR_ALL); - UI_draw_roundbox_aa(true, + UI_draw_roundbox_aa( + true, x - margin, (y + decent) - margin, x + width + margin, @@ -529,10 +530,11 @@ void uiStyleInit(void) /* Set default flags based on UI preferences (not render fonts) */ { - int flag_disable = BLF_MONOCHROME | - BLF_HINTING_NONE | - BLF_HINTING_SLIGHT | - BLF_HINTING_FULL; + int flag_disable = ( + BLF_MONOCHROME | + BLF_HINTING_NONE | + BLF_HINTING_SLIGHT | + BLF_HINTING_FULL); int flag_enable = 0; if (U.text_render & USER_TEXT_HINTING_NONE) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 45a3ef9690e..5b9f9b1faf3 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -993,14 +993,14 @@ void uiTemplateIDPreview( } void uiTemplateGpencilColorPreview( - uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, - int rows, int cols, float scale, int filter) + uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, + int rows, int cols, float scale, int filter) { ui_template_id( - layout, C, ptr, propname, - NULL, NULL, NULL, - UI_ID_BROWSE | UI_ID_PREVIEWS | UI_ID_DELETE, - rows, cols, filter, false, scale < 0.5f ? 0.5f : scale, false, false); + layout, C, ptr, propname, + NULL, NULL, NULL, + UI_ID_BROWSE | UI_ID_PREVIEWS | UI_ID_DELETE, + rows, cols, filter, false, scale < 0.5f ? 0.5f : scale, false, false); } /** @@ -1355,7 +1355,7 @@ static int modifier_is_simulation(ModifierData *md) { /* Physic Tab */ if (ELEM(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, - eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint)) + eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint)) { return 1; } @@ -1533,7 +1533,7 @@ static uiLayout *draw_modifier( UI_block_lock_set(block, ob && ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE); if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, - eModifierType_Cloth, eModifierType_Smoke)) + eModifierType_Cloth, eModifierType_Smoke)) { uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE, "OBJECT_OT_modifier_copy"); @@ -1636,8 +1636,8 @@ static uiLayout *gpencil_draw_modifier( /* mode enabling buttons */ UI_block_align_begin(block); - uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE); - uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE); + uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE); + uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE); if (mti->flags & eGpencilModifierTypeFlag_SupportsEditmode) { sub = uiLayoutRow(row, true); @@ -1675,7 +1675,7 @@ static uiLayout *gpencil_draw_modifier( uiItemEnumO(sub, "OBJECT_OT_gpencil_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), 0, "apply_as", MODIFIER_APPLY_DATA); uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE, - "OBJECT_OT_gpencil_modifier_copy"); + "OBJECT_OT_gpencil_modifier_copy"); /* result is the layout block inside the box, that we return so that modifier settings can be drawn */ result = uiLayoutColumn(box, false); @@ -1726,8 +1726,9 @@ uiLayout *uiTemplateGpencilModifier(uiLayout *layout, bContext *UNUSED(C), Point /************************ Shader FX Template *************************/ -static uiLayout *gpencil_draw_shaderfx(uiLayout *layout, Object *ob, - ShaderFxData *md) +static uiLayout *gpencil_draw_shaderfx( + uiLayout *layout, Object *ob, + ShaderFxData *md) { const ShaderFxTypeInfo *mti = BKE_shaderfxType_getInfo(md->type); PointerRNA ptr; @@ -3583,7 +3584,7 @@ static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext * subrow = uiLayoutRow(row, true); uiItemR(subrow, &listptr, "use_filter_sort_alpha", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE); uiItemR(subrow, &listptr, "use_filter_sort_reverse", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", - (ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) ? ICON_SORT_DESC : ICON_SORT_ASC); + (ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) ? ICON_SORT_DESC : ICON_SORT_ASC); } } @@ -4300,8 +4301,8 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char /* check for hotkey */ if (len < sizeof(name) - 6) { if (WM_key_event_operator_string( - C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, true, - &name[len + 1], sizeof(name) - len - 1)) + C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, true, + &name[len + 1], sizeof(name) - len - 1)) { name[len] = UI_SEP_CHAR; } |