diff options
author | Siddhartha Jejurkar <f20180617@goa.bits-pilani.ac.in> | 2021-12-17 16:01:32 +0300 |
---|---|---|
committer | Siddhartha Jejurkar <f20180617@goa.bits-pilani.ac.in> | 2021-12-17 16:01:32 +0300 |
commit | dbc41b30f88b96f7d8c6e995b17f5930eb55cc77 (patch) | |
tree | c6c495328443ea3621e5df2ef483b0e0dd504496 /source/blender/blenkernel/intern/screen.c | |
parent | 99a2af76d10e05a18987be5d554ada197b1ca086 (diff) | |
parent | 7c9e4099854a4fc8eab4db97173c1aacd25f9e08 (diff) |
Merge branch 'master' into soc-2021-uv-edge-select-supportsoc-2021-uv-edge-select-support
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 75 |
1 files changed, 21 insertions, 54 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 6352e08ec4b..cd8493ee559 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -45,6 +45,7 @@ #include "DNA_view3d_types.h" #include "DNA_workspace_types.h" +#include "BLI_ghash.h" #include "BLI_listbase.h" #include "BLI_math_vector.h" #include "BLI_mempool.h" @@ -97,10 +98,6 @@ static void screen_foreach_id_dopesheet(LibraryForeachIDData *data, bDopeSheet * } } -/** - * Callback used by lib_query to walk over all ID usages (mimics `foreach_id` callback of - * `IDTypeInfo` structure). - */ void BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area) { BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, area->full, IDWALK_CB_NOP); @@ -258,7 +255,6 @@ static void screen_blend_write(BlendWriter *writer, ID *id, const void *id_addre BKE_screen_area_map_blend_write(writer, AREAMAP_FROM_SCREEN(screen)); } -/* Cannot use IDTypeInfo callback yet, because of the return value. */ bool BKE_screen_blend_read_data(BlendDataReader *reader, bScreen *screen) { bool success = true; @@ -304,6 +300,7 @@ IDTypeInfo IDType_ID_SCR = { .name_plural = "screens", .translation_context = BLT_I18NCONTEXT_ID_SCREEN, .flags = IDTYPE_FLAGS_NO_COPY | IDTYPE_FLAGS_ONLY_APPEND | IDTYPE_FLAGS_NO_ANIMDATA, + .asset_type_info = NULL, .init_data = NULL, .copy_data = NULL, @@ -311,6 +308,7 @@ IDTypeInfo IDType_ID_SCR = { .make_local = NULL, .foreach_id = screen_foreach_id, .foreach_cache = NULL, + .foreach_path = NULL, .owner_get = NULL, .blend_write = screen_blend_write, @@ -502,39 +500,35 @@ ARegion *BKE_area_region_copy(const SpaceType *st, const ARegion *region) return newar; } -/* from lb2 to lb1, lb1 is supposed to be freed */ -static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) +/* from lb_src to lb_dst, lb_dst is supposed to be freed */ +static void region_copylist(SpaceType *st, ListBase *lb_dst, ListBase *lb_src) { /* to be sure */ - BLI_listbase_clear(lb1); + BLI_listbase_clear(lb_dst); - LISTBASE_FOREACH (ARegion *, region, lb2) { + LISTBASE_FOREACH (ARegion *, region, lb_src) { ARegion *region_new = BKE_area_region_copy(st, region); - BLI_addtail(lb1, region_new); + BLI_addtail(lb_dst, region_new); } } -/* lb1 should be empty */ -void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2) +void BKE_spacedata_copylist(ListBase *lb_dst, ListBase *lb_src) { - BLI_listbase_clear(lb1); /* to be sure */ + BLI_listbase_clear(lb_dst); /* to be sure */ - LISTBASE_FOREACH (SpaceLink *, sl, lb2) { + LISTBASE_FOREACH (SpaceLink *, sl, lb_src) { SpaceType *st = BKE_spacetype_from_id(sl->spacetype); if (st && st->duplicate) { SpaceLink *slnew = st->duplicate(sl); - BLI_addtail(lb1, slnew); + BLI_addtail(lb_dst, slnew); region_copylist(st, &slnew->regionbase, &sl->regionbase); } } } -/* facility to set locks for drawing to survive (render) threads accessing drawing data */ -/* lock can become bitflag too */ -/* should be replaced in future by better local data handling for threads */ void BKE_spacedata_draw_locks(bool set) { LISTBASE_FOREACH (SpaceType *, st, &spacetypes) { @@ -549,10 +543,6 @@ void BKE_spacedata_draw_locks(bool set) } } -/** - * Version of #BKE_area_find_region_type that also works if \a slink - * is not the active space of \a area. - */ ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, const ScrArea *area, int region_type) @@ -586,7 +576,6 @@ void BKE_spacedata_callback_id_remap_set(void (*func)(ScrArea *area, SpaceLink * spacedata_id_remap_cb = func; } -/* UNUSED!!! */ void BKE_spacedata_id_unref(struct ScrArea *area, struct SpaceLink *sl, struct ID *id) { if (spacedata_id_remap_cb) { @@ -650,7 +639,6 @@ void BKE_area_region_panels_free(ListBase *panels) BLI_listbase_clear(panels); } -/* not region itself */ void BKE_area_region_free(SpaceType *st, ARegion *region) { if (st) { @@ -684,13 +672,17 @@ void BKE_area_region_free(SpaceType *st, ARegion *region) region_free_gizmomap_callback(region->gizmo_map); } + if (region->runtime.block_name_map != NULL) { + BLI_ghash_free(region->runtime.block_name_map, NULL, NULL); + region->runtime.block_name_map = NULL; + } + BLI_freelistN(®ion->ui_lists); BLI_freelistN(®ion->ui_previews); BLI_freelistN(®ion->panels_category); BLI_freelistN(®ion->panels_category_active); } -/* not area itself */ void BKE_screen_area_free(ScrArea *area) { SpaceType *st = BKE_spacetype_from_id(area->spacetype); @@ -718,7 +710,6 @@ void BKE_screen_area_map_free(ScrAreaMap *area_map) BLI_freelistN(&area_map->areabase); } -/** Free (or release) any data used by this screen (does not free the screen itself). */ void BKE_screen_free_data(bScreen *screen) { screen_free_data(&screen->id); @@ -881,12 +872,6 @@ void BKE_screen_remove_unused_scrverts(bScreen *screen) /* ***************** Utilities ********************** */ -/** - * Find a region of type \a region_type in the currently active space of \a area. - * - * \note This does _not_ work if the region to look up is not in the active - * space. Use #BKE_spacedata_find_region_type if that may be the case. - */ ARegion *BKE_area_find_region_type(const ScrArea *area, int region_type) { if (area) { @@ -931,9 +916,6 @@ ARegion *BKE_area_find_region_xy(ScrArea *area, const int regiontype, int x, int return NULL; } -/** - * \note This is only for screen level regions (typically menus/popups). - */ ARegion *BKE_screen_find_region_xy(bScreen *screen, const int regiontype, int x, int y) { LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { @@ -946,10 +928,6 @@ ARegion *BKE_screen_find_region_xy(bScreen *screen, const int regiontype, int x, return NULL; } -/** - * \note Ideally we can get the area from the context, - * there are a few places however where this isn't practical. - */ ScrArea *BKE_screen_find_area_from_space(struct bScreen *screen, SpaceLink *sl) { LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { @@ -961,10 +939,6 @@ ScrArea *BKE_screen_find_area_from_space(struct bScreen *screen, SpaceLink *sl) return NULL; } -/** - * \note Using this function is generally a last resort, you really want to be - * using the context when you can - campbell - */ ScrArea *BKE_screen_find_big_area(bScreen *screen, const int spacetype, const short min) { ScrArea *big = NULL; @@ -1054,14 +1028,11 @@ ARegion *BKE_screen_find_main_region_at_xy(bScreen *screen, return BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, x, y); } -/* magic zoom calculation, no idea what - * it signifies, if you find out, tell me! -zr - */ +/* Magic zoom calculation, no idea what it signifies, if you find out, tell me! -zr + * + * Simple, its magic dude! Well, to be honest, + * this gives a natural feeling zooming with multiple keypad presses (ton). */ -/* simple, its magic dude! - * well, to be honest, this gives a natural feeling zooming - * with multiple keypad presses (ton) - */ float BKE_screen_view3d_zoom_to_fac(float camzoom) { return powf(((float)M_SQRT2 + camzoom / 50.0f), 2.0f) / 4.0f; @@ -1476,7 +1447,6 @@ static void direct_link_region(BlendDataReader *reader, ARegion *region, int spa } /* for the saved 2.50 files without regiondata */ -/* and as patch for 2.48 and older */ void BKE_screen_view3d_do_versions_250(View3D *v3d, ListBase *regions) { LISTBASE_FOREACH (ARegion *, region, regions) { @@ -1783,9 +1753,6 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) BLO_read_data_address(reader, &area->v4); } -/** - * \return false on error. - */ bool BKE_screen_area_map_blend_read_data(BlendDataReader *reader, ScrAreaMap *area_map) { BLO_read_list(reader, &area_map->vertbase); |