diff options
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 18 | ||||
-rw-r--r-- | source/blender/editors/screen/area_query.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/glutil.c | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 26 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 6 |
6 files changed, 46 insertions, 16 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 175efc5387b..c351ade9954 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -161,6 +161,12 @@ void ED_region_do_listen(wmRegionListenerParams *params) if (region->type && region->type->listener) { region->type->listener(params); } + + LISTBASE_FOREACH (uiList *, list, ®ion->ui_lists) { + if (list->type && list->type->listener) { + list->type->listener(list, params); + } + } } /* only exported for WM */ @@ -1539,8 +1545,8 @@ static void region_rect_recursive( region->winx = BLI_rcti_size_x(®ion->winrct) + 1; region->winy = BLI_rcti_size_y(®ion->winrct) + 1; - /* if region opened normally, we store this for hide/reveal usage */ - /* prevent rounding errors for UI_DPI_FAC mult and divide */ + /* If region opened normally, we store this for hide/reveal usage. */ + /* Prevent rounding errors for UI_DPI_FAC multiply and divide. */ if (region->winx > 1) { region->sizex = (region->winx + 0.5f) / UI_DPI_FAC; } @@ -1680,7 +1686,7 @@ static void ed_default_handlers( { BLI_assert(region ? (®ion->handlers == handlers) : (&area->handlers == handlers)); - /* note, add-handler checks if it already exists */ + /* NOTE: add-handler checks if it already exists. */ /* XXX it would be good to have boundbox checks for some of these... */ if (flag & ED_KEYMAP_UI) { @@ -2081,7 +2087,7 @@ void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free) } BKE_spacedata_copylist(&area_dst->spacedata, &area_src->spacedata); - /* Note; SPACE_EMPTY is possible on new screens */ + /* NOTE: SPACE_EMPTY is possible on new screens. */ /* regions */ if (do_free) { @@ -3018,6 +3024,8 @@ void ED_region_panels_layout_ex(const bContext *C, y = -y; } + UI_blocklist_update_view_for_buttons(C, ®ion->uiblocks); + if (update_tot_size) { /* this also changes the 'cur' */ UI_view2d_totRect_set(v2d, x, y); @@ -3672,7 +3680,7 @@ static void region_visible_rect_calc(ARegion *region, rcti *rect) /* Skip floating. */ } else { - BLI_assert(!"Region overlap with unknown alignment"); + BLI_assert_msg(0, "Region overlap with unknown alignment"); } } } diff --git a/source/blender/editors/screen/area_query.c b/source/blender/editors/screen/area_query.c index d569e56e11b..fd4f3964398 100644 --- a/source/blender/editors/screen/area_query.c +++ b/source/blender/editors/screen/area_query.c @@ -88,7 +88,7 @@ bool ED_region_panel_category_gutter_calc_rect(const ARegion *region, rcti *r_re r_region_gutter->xmin = r_region_gutter->xmax - category_tabs_width; } else { - BLI_assert(!"Unsupported alignment"); + BLI_assert_msg(0, "Unsupported alignment"); } return true; } diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index e366760a55d..f651fd4fb61 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -126,7 +126,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, components = 1; } else { - BLI_assert(!"Incompatible format passed to immDrawPixels"); + BLI_assert_msg(0, "Incompatible format passed to immDrawPixels"); return; } @@ -426,7 +426,7 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf, format = GPU_RGBA16F; } else { - BLI_assert(!"Incompatible number of channels for GLSL display"); + BLI_assert_msg(0, "Incompatible number of channels for GLSL display"); } if (format != 0) { diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 45cf1775ccb..3ce2f326dca 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -36,6 +36,7 @@ #include "DNA_sequence_types.h" #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" +#include "DNA_workspace_types.h" #include "BLI_ghash.h" #include "BLI_listbase.h" @@ -111,6 +112,8 @@ const char *screen_context_dir[] = { "selected_editable_fcurves", "active_editable_fcurve", "selected_editable_keyframes", + "ui_list", + "asset_library", NULL, }; @@ -896,11 +899,11 @@ static eContextResult screen_ctx_active_operator(const bContext *C, bContextData /* do nothing */ } else { - /* note, this checks poll, could be a problem, but this also + /* NOTE: this checks poll, could be a problem, but this also * happens for the toolbar */ op = WM_operator_last_redo(C); } - /* TODO, get the operator from popup's */ + /* TODO: get the operator from popup's. */ if (op && op->ptr) { CTX_data_pointer_set(result, NULL, &RNA_Operator, op); @@ -1024,6 +1027,23 @@ static eContextResult screen_ctx_selected_editable_keyframes(const bContext *C, return CTX_RESULT_NO_DATA; } +static eContextResult screen_ctx_asset_library(const bContext *C, bContextDataResult *result) +{ + WorkSpace *workspace = CTX_wm_workspace(C); + CTX_data_pointer_set( + result, &workspace->id, &RNA_AssetLibraryReference, &workspace->active_asset_library); + return CTX_RESULT_OK; +} + +static eContextResult screen_ctx_ui_list(const bContext *C, bContextDataResult *result) +{ + wmWindow *win = CTX_wm_window(C); + ARegion *region = CTX_wm_region(C); + uiList *list = UI_list_find_mouse_over(region, win->eventstate); + CTX_data_pointer_set(result, NULL, &RNA_UIList, list); + return CTX_RESULT_OK; +} + /* Registry of context callback functions. */ typedef eContextResult (*context_callback)(const bContext *C, bContextDataResult *result); @@ -1098,6 +1118,8 @@ static void ensure_ed_screen_context_functions(void) register_context_function("selected_visible_fcurves", screen_ctx_selected_visible_fcurves); register_context_function("active_editable_fcurve", screen_ctx_active_editable_fcurve); register_context_function("selected_editable_keyframes", screen_ctx_selected_editable_keyframes); + register_context_function("asset_library", screen_ctx_asset_library); + register_context_function("ui_list", screen_ctx_ui_list); } /* Entry point for the screen context. */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index e2d95035ba8..2a81fcfde8f 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -125,9 +125,9 @@ ScrArea *area_split(const wmWindow *win, return NULL; } - /* note regarding (fac > 0.5f) checks below. + /* NOTE(campbell): regarding (fac > 0.5f) checks below. * normally it shouldn't matter which is used since the copy should match the original - * however with viewport rendering and python console this isn't the case. - campbell */ + * however with viewport rendering and python console this isn't the case. */ if (dir_axis == SCREEN_AXIS_H) { /* new vertices */ @@ -1683,7 +1683,7 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable) sad->region = CTX_wm_region(C); /* If start-frame is larger than current frame, we put current-frame on start-frame. - * note: first frame then is not drawn! (ton) */ + * NOTE(ton): first frame then is not drawn! */ if (PRVRANGEON) { if (scene->r.psfra > scene->r.cfra) { sad->sfra = scene->r.cfra; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 159b649ec71..ffeaf514642 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2792,9 +2792,9 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) } CLAMP(rmd->region->sizey, 0, rmd->maxsize); - /* note, 'UI_UNIT_Y/4' means you need to drag the footer and execute region + /* NOTE: `UI_UNIT_Y / 4` means you need to drag the footer and execute region * almost all the way down for it to become hidden, this is done - * otherwise its too easy to do this by accident */ + * otherwise its too easy to do this by accident. */ if (size_no_snap < (UI_UNIT_Y / 4) / aspect) { rmd->region->sizey = rmd->origval; if (!(rmd->region->flag & RGN_FLAG_HIDDEN)) { @@ -5219,7 +5219,7 @@ static void SCREEN_OT_delete(wmOperatorType *ot) /* -------------------------------------------------------------------- */ /** \name Region Alpha Blending Operator * - * Implementation note: a disappearing region needs at least 1 last draw with + * Implementation NOTE: a disappearing region needs at least 1 last draw with * 100% back-buffer texture over it - then triple buffer will clear it entirely. * This because flag #RGN_FLAG_HIDDEN is set in end - region doesn't draw at all then. * |