Refactor: Move region runtime to separate C++ runtime struct
This allows using C++ types in the region runtime data, which will make it easier to move the remaining runtime data out of the `ARegion` DNA type and improve code readability in these areas. Pull Request: https://projects.blender.org/blender/blender/pulls/130196
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "RNA_types.hh"
|
||||
@@ -31,6 +32,7 @@ struct AssetShelfType;
|
||||
struct BlendDataReader;
|
||||
struct BlendLibReader;
|
||||
struct BlendWriter;
|
||||
struct GHash;
|
||||
struct Header;
|
||||
struct ID;
|
||||
struct LayoutPanelState;
|
||||
@@ -417,6 +419,32 @@ struct Panel_Runtime {
|
||||
LayoutPanels layout_panels;
|
||||
};
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
struct ARegionRuntime {
|
||||
/** Panel category to use between 'layout' and 'draw'. */
|
||||
const char *category = nullptr;
|
||||
|
||||
/**
|
||||
* The visible part of the region, use with region overlap not to draw
|
||||
* on top of the overlapping regions.
|
||||
*
|
||||
* Lazy initialize, zero'd when unset, relative to #ARegion.winrct x/y min. */
|
||||
rcti visible_rect = {};
|
||||
|
||||
/* The offset needed to not overlap with window scroll-bars. Only used by HUD regions for now. */
|
||||
int offset_x = 0;
|
||||
int offset_y = 0;
|
||||
|
||||
/** Maps #uiBlock::name to uiBlock for faster lookups. */
|
||||
GHash *block_name_map = nullptr;
|
||||
|
||||
/* Dummy panel used in popups so they can support layout panels. */
|
||||
Panel *popup_block_panel = nullptr;
|
||||
};
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
/* #uiList types. */
|
||||
|
||||
/** Draw an item in the `ui_list`. */
|
||||
@@ -613,6 +641,9 @@ void BKE_spacedata_id_unref(ScrArea *area, SpaceLink *sl, ID *id);
|
||||
/* Area/regions. */
|
||||
|
||||
ARegion *BKE_area_region_copy(const SpaceType *st, const ARegion *region);
|
||||
|
||||
ARegion *BKE_area_region_new();
|
||||
|
||||
/**
|
||||
* Doesn't free the region itself.
|
||||
*/
|
||||
|
||||
@@ -336,7 +336,7 @@ ARegion *BKE_area_region_copy(const SpaceType *st, const ARegion *region)
|
||||
{
|
||||
ARegion *newar = static_cast<ARegion *>(MEM_dupallocN(region));
|
||||
|
||||
memset(&newar->runtime, 0x0, sizeof(newar->runtime));
|
||||
newar->runtime = MEM_new<blender::bke::ARegionRuntime>(__func__);
|
||||
|
||||
newar->prev = newar->next = nullptr;
|
||||
BLI_listbase_clear(&newar->handlers);
|
||||
@@ -373,6 +373,13 @@ ARegion *BKE_area_region_copy(const SpaceType *st, const ARegion *region)
|
||||
return newar;
|
||||
}
|
||||
|
||||
ARegion *BKE_area_region_new()
|
||||
{
|
||||
ARegion *region = MEM_cnew<ARegion>(__func__);
|
||||
region->runtime = MEM_new<blender::bke::ARegionRuntime>(__func__);
|
||||
return region;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
@@ -593,11 +600,12 @@ void BKE_area_region_free(SpaceType *st, ARegion *region)
|
||||
region_free_gizmomap_callback(region->gizmo_map);
|
||||
}
|
||||
|
||||
if (region->runtime.block_name_map != nullptr) {
|
||||
BLI_ghash_free(region->runtime.block_name_map, nullptr, nullptr);
|
||||
region->runtime.block_name_map = nullptr;
|
||||
if (region->runtime->block_name_map != nullptr) {
|
||||
BLI_ghash_free(region->runtime->block_name_map, nullptr, nullptr);
|
||||
region->runtime->block_name_map = nullptr;
|
||||
}
|
||||
|
||||
MEM_delete(region->runtime);
|
||||
BLI_freelistN(®ion->ui_lists);
|
||||
BLI_freelistN(®ion->ui_previews);
|
||||
BLI_freelistN(®ion->panels_category);
|
||||
@@ -1186,8 +1194,6 @@ static void direct_link_panel_list(BlendDataReader *reader, ListBase *lb)
|
||||
|
||||
static void direct_link_region(BlendDataReader *reader, ARegion *region, int spacetype)
|
||||
{
|
||||
memset(®ion->runtime, 0x0, sizeof(region->runtime));
|
||||
|
||||
direct_link_panel_list(reader, ®ion->panels);
|
||||
|
||||
BLO_read_struct_list(reader, PanelCategoryStack, ®ion->panels_category_active);
|
||||
@@ -1247,6 +1253,7 @@ static void direct_link_region(BlendDataReader *reader, ARegion *region, int spa
|
||||
}
|
||||
}
|
||||
|
||||
region->runtime = MEM_new<blender::bke::ARegionRuntime>(__func__);
|
||||
region->v2d.sms = nullptr;
|
||||
region->v2d.alpha_hor = region->v2d.alpha_vert = 255; /* visible by default */
|
||||
BLI_listbase_clear(®ion->panels_category);
|
||||
|
||||
@@ -80,8 +80,7 @@
|
||||
/* 2.50 patch */
|
||||
static void area_add_header_region(ScrArea *area, ListBase *lb)
|
||||
{
|
||||
ARegion *region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "area region from do_versions"));
|
||||
ARegion *region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
@@ -132,16 +131,14 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
/* first channels for ipo action nla... */
|
||||
switch (sl->spacetype) {
|
||||
case SPACE_GRAPH:
|
||||
region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "area region from do_versions"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
|
||||
/* for some reason, this doesn't seem to go auto like for NLA... */
|
||||
region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "area region from do_versions"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
@@ -150,8 +147,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
break;
|
||||
|
||||
case SPACE_ACTION:
|
||||
region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "area region from do_versions"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
@@ -160,8 +156,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
break;
|
||||
|
||||
case SPACE_NLA:
|
||||
region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "area region from do_versions"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
@@ -169,8 +164,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
|
||||
/* for some reason, some files still don't get this auto */
|
||||
region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "area region from do_versions"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
@@ -179,7 +173,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
break;
|
||||
|
||||
case SPACE_NODE:
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "nodetree area for node"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
@@ -189,12 +183,12 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
break;
|
||||
case SPACE_FILE:
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "nodetree area for node"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "ui area for file"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
@@ -207,15 +201,14 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
break;
|
||||
}
|
||||
}
|
||||
region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "preview area for sequencer"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_insertlinkbefore(lb, region_main, region);
|
||||
sequencer_init_preview_region(region);
|
||||
break;
|
||||
}
|
||||
case SPACE_VIEW3D:
|
||||
/* toolbar */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "toolbar for view3d"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
@@ -223,8 +216,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* tool properties */
|
||||
region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "tool properties for view3d"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_TOOL_PROPS;
|
||||
@@ -232,7 +224,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* buttons/list view */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "buttons for view3d"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
@@ -241,7 +233,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
#if 0
|
||||
case SPACE_PROPERTIES:
|
||||
/* context UI region */
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
@@ -252,7 +244,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
||||
}
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "area region from do_versions"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(lb, region);
|
||||
region->winrct = area->totrct;
|
||||
@@ -1212,8 +1204,7 @@ void blo_do_versions_250(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ARegion *region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "preview area for sequencer"));
|
||||
ARegion *region = BKE_area_region_new();
|
||||
BLI_insertlinkbefore(regionbase, region_main, region);
|
||||
sequencer_init_preview_region(region);
|
||||
}
|
||||
|
||||
@@ -2637,7 +2637,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
continue;
|
||||
}
|
||||
|
||||
ARegion *arnew = MEM_cnew<ARegion>("node tools");
|
||||
ARegion *arnew = BKE_area_region_new();
|
||||
|
||||
BLI_insertlinkafter(&area->regionbase, region, arnew);
|
||||
arnew->regiontype = RGN_TYPE_TOOLS;
|
||||
|
||||
@@ -234,8 +234,7 @@ static void do_version_action_editor_properties_region(ListBase *regionbase)
|
||||
}
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
/* add new region here */
|
||||
ARegion *region_new = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "buttons for action"));
|
||||
ARegion *region_new = BKE_area_region_new();
|
||||
|
||||
BLI_insertlinkbefore(regionbase, region, region_new);
|
||||
|
||||
|
||||
@@ -452,6 +452,7 @@ static void do_versions_fix_annotations(bGPdata *gpd)
|
||||
|
||||
static void do_versions_remove_region(ListBase *regionbase, ARegion *region)
|
||||
{
|
||||
MEM_delete(region->runtime);
|
||||
BLI_freelinkN(regionbase, region);
|
||||
}
|
||||
|
||||
@@ -4241,8 +4242,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
if (sl->spacetype == SPACE_PROPERTIES) {
|
||||
ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
|
||||
&sl->regionbase;
|
||||
ARegion *region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "navigation bar for properties"));
|
||||
ARegion *region = BKE_area_region_new();
|
||||
ARegion *region_header = nullptr;
|
||||
|
||||
for (region_header = static_cast<ARegion *>(regionbase->first);
|
||||
@@ -4471,8 +4471,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
ListBase *regionbase = (slink == area->spacedata.first) ? &area->regionbase :
|
||||
&slink->regionbase;
|
||||
|
||||
navigation_region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "userpref navigation-region do_versions"));
|
||||
navigation_region = BKE_area_region_new();
|
||||
|
||||
/* Order matters, addhead not addtail! */
|
||||
BLI_insertlinkbefore(regionbase, main_region, navigation_region);
|
||||
@@ -4743,8 +4742,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
&sl->regionbase;
|
||||
ARegion *region_navbar = BKE_spacedata_find_region_type(sl, area, RGN_TYPE_NAV_BAR);
|
||||
|
||||
execute_region = static_cast<ARegion *>(
|
||||
MEM_callocN(sizeof(ARegion), "execute region for properties"));
|
||||
execute_region = BKE_area_region_new();
|
||||
|
||||
BLI_assert(region_navbar);
|
||||
|
||||
|
||||
@@ -4007,6 +4007,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
ARegion *channels_region = BKE_region_find_in_listbase_by_type(regionbase,
|
||||
RGN_TYPE_CHANNELS);
|
||||
if (channels_region) {
|
||||
MEM_delete(channels_region->runtime);
|
||||
BLI_freelinkN(regionbase, channels_region);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.hh"
|
||||
#include "BKE_screen.hh"
|
||||
|
||||
#include "NOD_socket.hh"
|
||||
|
||||
@@ -60,7 +61,7 @@ short do_versions_new_to_old_idcode_get(const short id_code_new)
|
||||
|
||||
ARegion *do_versions_add_region_if_not_found(ListBase *regionbase,
|
||||
int region_type,
|
||||
const char *allocname,
|
||||
const char * /*allocname*/,
|
||||
int link_after_region_type)
|
||||
{
|
||||
ARegion *link_after_region = nullptr;
|
||||
@@ -73,7 +74,7 @@ ARegion *do_versions_add_region_if_not_found(ListBase *regionbase,
|
||||
}
|
||||
}
|
||||
|
||||
ARegion *new_region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), allocname));
|
||||
ARegion *new_region = BKE_area_region_new();
|
||||
new_region->regiontype = region_type;
|
||||
BLI_insertlinkafter(regionbase, link_after_region, new_region);
|
||||
return new_region;
|
||||
@@ -81,7 +82,7 @@ ARegion *do_versions_add_region_if_not_found(ListBase *regionbase,
|
||||
|
||||
ARegion *do_versions_ensure_region(ListBase *regionbase,
|
||||
int region_type,
|
||||
const char *allocname,
|
||||
const char * /*allocname*/,
|
||||
int link_after_region_type)
|
||||
{
|
||||
ARegion *link_after_region = nullptr;
|
||||
@@ -94,7 +95,7 @@ ARegion *do_versions_ensure_region(ListBase *regionbase,
|
||||
}
|
||||
}
|
||||
|
||||
ARegion *new_region = MEM_cnew<ARegion>(allocname);
|
||||
ARegion *new_region = BKE_area_region_new();
|
||||
new_region->regiontype = region_type;
|
||||
BLI_insertlinkafter(regionbase, link_after_region, new_region);
|
||||
return new_region;
|
||||
@@ -364,9 +365,9 @@ void version_socket_update_is_used(bNodeTree *ntree)
|
||||
}
|
||||
}
|
||||
|
||||
ARegion *do_versions_add_region(int regiontype, const char *name)
|
||||
ARegion *do_versions_add_region(int regiontype, const char * /*name*/)
|
||||
{
|
||||
ARegion *region = (ARegion *)MEM_callocN(sizeof(ARegion), name);
|
||||
ARegion *region = BKE_area_region_new();
|
||||
region->regiontype = regiontype;
|
||||
return region;
|
||||
}
|
||||
|
||||
@@ -3736,9 +3736,9 @@ void UI_blocklist_free(const bContext *C, ARegion *region)
|
||||
while (uiBlock *block = static_cast<uiBlock *>(BLI_pophead(lb))) {
|
||||
UI_block_free(C, block);
|
||||
}
|
||||
if (region->runtime.block_name_map != nullptr) {
|
||||
BLI_ghash_free(region->runtime.block_name_map, nullptr, nullptr);
|
||||
region->runtime.block_name_map = nullptr;
|
||||
if (region->runtime->block_name_map != nullptr) {
|
||||
BLI_ghash_free(region->runtime->block_name_map, nullptr, nullptr);
|
||||
region->runtime->block_name_map = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3752,11 +3752,11 @@ void UI_blocklist_free_inactive(const bContext *C, ARegion *region)
|
||||
block->active = false;
|
||||
}
|
||||
else {
|
||||
if (region->runtime.block_name_map != nullptr) {
|
||||
if (region->runtime->block_name_map != nullptr) {
|
||||
uiBlock *b = static_cast<uiBlock *>(
|
||||
BLI_ghash_lookup(region->runtime.block_name_map, block->name.c_str()));
|
||||
BLI_ghash_lookup(region->runtime->block_name_map, block->name.c_str()));
|
||||
if (b == block) {
|
||||
BLI_ghash_remove(region->runtime.block_name_map, b->name.c_str(), nullptr, nullptr);
|
||||
BLI_ghash_remove(region->runtime->block_name_map, b->name.c_str(), nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
BLI_remlink(lb, block);
|
||||
@@ -3774,10 +3774,10 @@ void UI_block_region_set(uiBlock *block, ARegion *region)
|
||||
/* each listbase only has one block with this name, free block
|
||||
* if is already there so it can be rebuilt from scratch */
|
||||
if (lb) {
|
||||
if (region->runtime.block_name_map == nullptr) {
|
||||
region->runtime.block_name_map = BLI_ghash_str_new(__func__);
|
||||
if (region->runtime->block_name_map == nullptr) {
|
||||
region->runtime->block_name_map = BLI_ghash_str_new(__func__);
|
||||
}
|
||||
oldblock = (uiBlock *)BLI_ghash_lookup(region->runtime.block_name_map, block->name.c_str());
|
||||
oldblock = (uiBlock *)BLI_ghash_lookup(region->runtime->block_name_map, block->name.c_str());
|
||||
|
||||
if (oldblock) {
|
||||
oldblock->active = false;
|
||||
@@ -3787,7 +3787,7 @@ void UI_block_region_set(uiBlock *block, ARegion *region)
|
||||
|
||||
/* at the beginning of the list! for dynamical menus/blocks */
|
||||
BLI_addhead(lb, block);
|
||||
BLI_ghash_reinsert(region->runtime.block_name_map,
|
||||
BLI_ghash_reinsert(region->runtime->block_name_map,
|
||||
const_cast<char *>(block->name.c_str()),
|
||||
block,
|
||||
nullptr,
|
||||
|
||||
@@ -240,7 +240,7 @@ ARegionType *ED_area_type_hud(int space_type)
|
||||
|
||||
static ARegion *hud_region_add(ScrArea *area)
|
||||
{
|
||||
ARegion *region = MEM_cnew<ARegion>(__func__);
|
||||
ARegion *region = BKE_area_region_new();
|
||||
ARegion *region_win = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
|
||||
if (region_win) {
|
||||
BLI_insertlinkbefore(&area->regionbase, region_win, region);
|
||||
@@ -354,8 +354,8 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *area)
|
||||
float x, y;
|
||||
|
||||
UI_view2d_scroller_size_get(®ion_win->v2d, true, &x, &y);
|
||||
region->runtime.offset_x = x;
|
||||
region->runtime.offset_y = y;
|
||||
region->runtime->offset_x = x;
|
||||
region->runtime->offset_y = y;
|
||||
}
|
||||
|
||||
/* Reset zoom level (not well supported). */
|
||||
|
||||
@@ -610,7 +610,7 @@ void ui_layout_panel_popup_scroll_apply(Panel *panel, const float dy)
|
||||
|
||||
void UI_popup_dummy_panel_set(ARegion *region, uiBlock *block)
|
||||
{
|
||||
Panel *&panel = region->runtime.popup_block_panel;
|
||||
Panel *&panel = region->runtime->popup_block_panel;
|
||||
if (!panel) {
|
||||
/* Dummy popup panel type. */
|
||||
static PanelType panel_type = []() {
|
||||
@@ -996,8 +996,8 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
|
||||
handle->popup_create_vars.arg_free(handle->popup_create_vars.arg);
|
||||
}
|
||||
|
||||
if (handle->region->runtime.popup_block_panel) {
|
||||
BKE_panel_free(handle->region->runtime.popup_block_panel);
|
||||
if (handle->region->runtime->popup_block_panel) {
|
||||
BKE_panel_free(handle->region->runtime->popup_block_panel);
|
||||
}
|
||||
|
||||
ui_popup_block_remove(C, handle);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
ARegion *ui_region_temp_add(bScreen *screen)
|
||||
{
|
||||
ARegion *region = MEM_cnew<ARegion>(__func__);
|
||||
ARegion *region = BKE_area_region_new();
|
||||
BLI_addtail(&screen->regionbase, region);
|
||||
|
||||
region->regiontype = RGN_TYPE_TEMPORARY;
|
||||
|
||||
@@ -800,14 +800,14 @@ static MenuSearch_Data *menu_items_from_ui_create(bContext *C,
|
||||
|
||||
if (region) {
|
||||
BLI_ghash_remove(
|
||||
region->runtime.block_name_map, sub_block->name.c_str(), nullptr, nullptr);
|
||||
region->runtime->block_name_map, sub_block->name.c_str(), nullptr, nullptr);
|
||||
BLI_remlink(®ion->uiblocks, sub_block);
|
||||
}
|
||||
UI_block_free(nullptr, sub_block);
|
||||
}
|
||||
}
|
||||
if (region) {
|
||||
BLI_ghash_remove(region->runtime.block_name_map, block->name.c_str(), nullptr, nullptr);
|
||||
BLI_ghash_remove(region->runtime->block_name_map, block->name.c_str(), nullptr, nullptr);
|
||||
BLI_remlink(®ion->uiblocks, block);
|
||||
}
|
||||
UI_block_free(nullptr, block);
|
||||
|
||||
@@ -1545,8 +1545,8 @@ static void region_rect_recursive(
|
||||
BLI_rcti_resize(&overlap_remainder_margin,
|
||||
max_ii(0, BLI_rcti_size_x(overlap_remainder) - UI_UNIT_X / 2),
|
||||
max_ii(0, BLI_rcti_size_y(overlap_remainder) - UI_UNIT_Y / 2));
|
||||
region->winrct.xmin = overlap_remainder_margin.xmin + region->runtime.offset_x;
|
||||
region->winrct.ymin = overlap_remainder_margin.ymin + region->runtime.offset_y;
|
||||
region->winrct.xmin = overlap_remainder_margin.xmin + region->runtime->offset_x;
|
||||
region->winrct.ymin = overlap_remainder_margin.ymin + region->runtime->offset_y;
|
||||
region->winrct.xmax = region->winrct.xmin + prefsizex - 1;
|
||||
region->winrct.ymax = region->winrct.ymin + prefsizey - 1;
|
||||
|
||||
@@ -1786,7 +1786,7 @@ static void region_rect_recursive(
|
||||
}
|
||||
|
||||
/* Clear, initialize on demand. */
|
||||
memset(®ion->runtime.visible_rect, 0, sizeof(region->runtime.visible_rect));
|
||||
memset(®ion->runtime->visible_rect, 0, sizeof(region->runtime->visible_rect));
|
||||
}
|
||||
|
||||
static void area_calc_totrct(ScrArea *area, const rcti *window_rect)
|
||||
@@ -3105,7 +3105,7 @@ void ED_region_panels_layout_ex(const bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
region->runtime.category = nullptr;
|
||||
region->runtime->category = nullptr;
|
||||
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
@@ -3257,7 +3257,7 @@ void ED_region_panels_layout_ex(const bContext *C,
|
||||
}
|
||||
|
||||
if (use_category_tabs) {
|
||||
region->runtime.category = category;
|
||||
region->runtime->category = category;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3292,14 +3292,14 @@ void ED_region_panels_draw(const bContext *C, ARegion *region)
|
||||
UI_view2d_view_restore(C);
|
||||
|
||||
/* Set in layout. */
|
||||
if (region->runtime.category) {
|
||||
UI_panel_category_draw_all(region, region->runtime.category);
|
||||
if (region->runtime->category) {
|
||||
UI_panel_category_draw_all(region, region->runtime->category);
|
||||
}
|
||||
|
||||
/* scrollers */
|
||||
bool use_mask = false;
|
||||
rcti mask;
|
||||
if (region->runtime.category &&
|
||||
if (region->runtime->category &&
|
||||
(RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_RIGHT) &&
|
||||
UI_panel_category_is_visible(region))
|
||||
{
|
||||
@@ -4002,7 +4002,7 @@ static void region_visible_rect_calc(ARegion *region, rcti *rect)
|
||||
|
||||
const rcti *ED_region_visible_rect(ARegion *region)
|
||||
{
|
||||
rcti *rect = ®ion->runtime.visible_rect;
|
||||
rcti *rect = ®ion->runtime->visible_rect;
|
||||
if (rect->xmin == 0 && rect->ymin == 0 && rect->xmax == 0 && rect->ymax == 0) {
|
||||
region_visible_rect_calc(region, rect);
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
|
||||
TIME_CACHE_RIGIDBODY | TIME_CACHE_SIMULATION_NODES;
|
||||
|
||||
/* header */
|
||||
region = MEM_cnew<ARegion>("header for action");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* channel list region */
|
||||
region = MEM_cnew<ARegion>("channel region for action");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
@@ -88,14 +88,14 @@ static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
|
||||
/* ui buttons */
|
||||
region = MEM_cnew<ARegion>("buttons region for action");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
|
||||
/* main region */
|
||||
region = MEM_cnew<ARegion>("main region for action");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -55,14 +55,14 @@ static SpaceLink *buttons_create(const ScrArea * /*area*/, const Scene * /*scene
|
||||
sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for buts"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sbuts->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* navigation bar */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "navigation bar for buts"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sbuts->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_NAV_BAR;
|
||||
@@ -70,14 +70,14 @@ static SpaceLink *buttons_create(const ScrArea * /*area*/, const Scene * /*scene
|
||||
|
||||
#if 0
|
||||
/* context region */
|
||||
region = MEM_callocN(sizeof(ARegion), "context region for buts");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sbuts->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
#endif
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for buts"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sbuts->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -162,28 +162,28 @@ static SpaceLink *clip_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
sc = DNA_struct_default_alloc(SpaceClip);
|
||||
|
||||
/* header */
|
||||
region = MEM_cnew<ARegion>("header for clip");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* tools view */
|
||||
region = MEM_cnew<ARegion>("tools for clip");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
|
||||
/* properties view */
|
||||
region = MEM_cnew<ARegion>("properties for clip");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
|
||||
/* channels view */
|
||||
region = MEM_cnew<ARegion>("channels for clip");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
@@ -193,13 +193,13 @@ static SpaceLink *clip_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
|
||||
/* preview view */
|
||||
region = MEM_cnew<ARegion>("preview for clip");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_PREVIEW;
|
||||
|
||||
/* main region */
|
||||
region = MEM_cnew<ARegion>("main region for clip");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -46,14 +46,14 @@ static SpaceLink *console_create(const ScrArea * /*area*/, const Scene * /*scene
|
||||
sconsole->lheight = 14;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for console"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sconsole->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for text"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sconsole->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -59,41 +59,41 @@ static SpaceLink *file_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
sfile->spacetype = SPACE_FILE;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for file"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sfile->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
/* Ignore user preference "USER_HEADER_BOTTOM" here (always show top for new types). */
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
|
||||
/* Tools region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "tools region for file"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sfile->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
|
||||
/* ui list region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "ui region for file"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sfile->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
region->flag = RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE;
|
||||
|
||||
/* execute region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "execute region for file"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sfile->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_EXECUTE;
|
||||
region->alignment = RGN_ALIGN_BOTTOM;
|
||||
region->flag = RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE;
|
||||
|
||||
/* tools props region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "tool props for file"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sfile->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOL_PROPS;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for file"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sfile->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
|
||||
@@ -70,14 +70,14 @@ static SpaceLink *graph_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
sipo->flag |= SIPO_SHOW_MARKERS;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for graphedit"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sipo->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* channels */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "channels region for graphedit"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sipo->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
@@ -86,14 +86,14 @@ static SpaceLink *graph_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
|
||||
/* ui buttons */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "buttons region for graphedit"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sipo->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for graphedit"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sipo->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -120,27 +120,27 @@ static SpaceLink *image_create(const ScrArea * /*area*/, const Scene * /*scene*/
|
||||
simage->mask_info = *DNA_struct_default_get(MaskSpaceInfo);
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for image"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* asset shelf */
|
||||
region = MEM_cnew<ARegion>("asset shelf for view3d");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_ASSET_SHELF;
|
||||
region->alignment = RGN_ALIGN_BOTTOM;
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
|
||||
/* asset shelf header */
|
||||
region = MEM_cnew<ARegion>("asset shelf header for view3d");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_ASSET_SHELF_HEADER;
|
||||
region->alignment = RGN_ALIGN_BOTTOM | RGN_ALIGN_HIDE_WITH_PREV;
|
||||
|
||||
/* tool header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "tool header for image"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOL_HEADER;
|
||||
@@ -148,7 +148,7 @@ static SpaceLink *image_create(const ScrArea * /*area*/, const Scene * /*scene*/
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* buttons/list view */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "buttons for image"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
@@ -156,7 +156,7 @@ static SpaceLink *image_create(const ScrArea * /*area*/, const Scene * /*scene*/
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* scopes/uv sculpt/paint */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "buttons for image"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
@@ -164,7 +164,7 @@ static SpaceLink *image_create(const ScrArea * /*area*/, const Scene * /*scene*/
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* main area */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main area for image"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -44,14 +44,14 @@ static SpaceLink *info_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
sinfo->rpt_mask = INFO_RPT_OP;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for info"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sinfo->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for info"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sinfo->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -61,14 +61,14 @@ static SpaceLink *nla_create(const ScrArea *area, const Scene *scene)
|
||||
snla->flag = SNLA_SHOW_MARKERS;
|
||||
|
||||
/* header */
|
||||
region = MEM_cnew<ARegion>("header for nla");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&snla->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* track list region */
|
||||
region = MEM_cnew<ARegion>("track list for nla");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&snla->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
@@ -78,14 +78,14 @@ static SpaceLink *nla_create(const ScrArea *area, const Scene *scene)
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
|
||||
/* ui buttons */
|
||||
region = MEM_cnew<ARegion>("buttons region for nla");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&snla->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
|
||||
/* main region */
|
||||
region = MEM_cnew<ARegion>("main region for nla");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&snla->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -409,21 +409,21 @@ static SpaceLink *node_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
NODE_TREE_TYPES_END;
|
||||
|
||||
/* header */
|
||||
ARegion *region = MEM_cnew<ARegion>("header for node");
|
||||
ARegion *region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&snode->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* buttons/list view */
|
||||
region = MEM_cnew<ARegion>("buttons for node");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&snode->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
|
||||
/* toolbar */
|
||||
region = MEM_cnew<ARegion>("node tools");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&snode->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
@@ -432,7 +432,7 @@ static SpaceLink *node_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* main region */
|
||||
region = MEM_cnew<ARegion>("main region for node");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&snode->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -382,14 +382,14 @@ static SpaceLink *outliner_create(const ScrArea * /*area*/, const Scene * /*scen
|
||||
space_outliner->filter = SO_FILTER_NO_VIEW_LAYERS;
|
||||
|
||||
/* header */
|
||||
region = MEM_cnew<ARegion>("header for outliner");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&space_outliner->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* main region */
|
||||
region = MEM_cnew<ARegion>("main region for outliner");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&space_outliner->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -43,14 +43,14 @@ static SpaceLink *script_create(const ScrArea * /*area*/, const Scene * /*scene*
|
||||
sscript->spacetype = SPACE_SCRIPT;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for script"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sscript->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for script"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sscript->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -104,14 +104,14 @@ static SpaceLink *sequencer_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
sseq->draw_flag |= SEQ_DRAW_TRANSFORM_PREVIEW;
|
||||
|
||||
/* Header. */
|
||||
region = MEM_cnew<ARegion>("header for sequencer");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sseq->regionbase, static_cast<void *>(region));
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* Tool header. */
|
||||
region = MEM_cnew<ARegion>("tool header for sequencer");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sseq->regionbase, static_cast<void *>(region));
|
||||
region->regiontype = RGN_TYPE_TOOL_HEADER;
|
||||
@@ -119,7 +119,7 @@ static SpaceLink *sequencer_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* Buttons/list view. */
|
||||
region = MEM_cnew<ARegion>("buttons for sequencer");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sseq->regionbase, static_cast<void *>(region));
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
@@ -127,14 +127,14 @@ static SpaceLink *sequencer_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* Toolbar. */
|
||||
region = MEM_cnew<ARegion>("tools for sequencer");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sseq->regionbase, static_cast<void *>(region));
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
|
||||
/* Channels. */
|
||||
region = MEM_cnew<ARegion>("channels for sequencer");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sseq->regionbase, static_cast<void *>(region));
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
@@ -143,7 +143,7 @@ static SpaceLink *sequencer_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
|
||||
/* Preview region. */
|
||||
/* NOTE: if you change values here, also change them in sequencer_init_preview_region. */
|
||||
region = MEM_cnew<ARegion>("preview region for sequencer");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sseq->regionbase, static_cast<void *>(region));
|
||||
region->regiontype = RGN_TYPE_PREVIEW;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
@@ -164,7 +164,7 @@ static SpaceLink *sequencer_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->v2d.keeptot = V2D_KEEPTOT_FREE;
|
||||
|
||||
/* Main region. */
|
||||
region = MEM_cnew<ARegion>("main region for sequencer");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&sseq->regionbase, static_cast<void *>(region));
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -54,7 +54,7 @@ static SpaceLink *spreadsheet_create(const ScrArea * /*area*/, const Scene * /*s
|
||||
|
||||
{
|
||||
/* Header. */
|
||||
ARegion *region = MEM_cnew<ARegion>("spreadsheet header");
|
||||
ARegion *region = BKE_area_region_new();
|
||||
BLI_addtail(&spreadsheet_space->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
@@ -62,7 +62,7 @@ static SpaceLink *spreadsheet_create(const ScrArea * /*area*/, const Scene * /*s
|
||||
|
||||
{
|
||||
/* Footer. */
|
||||
ARegion *region = MEM_cnew<ARegion>("spreadsheet footer region");
|
||||
ARegion *region = BKE_area_region_new();
|
||||
BLI_addtail(&spreadsheet_space->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_FOOTER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
|
||||
@@ -70,7 +70,7 @@ static SpaceLink *spreadsheet_create(const ScrArea * /*area*/, const Scene * /*s
|
||||
|
||||
{
|
||||
/* Dataset Region */
|
||||
ARegion *region = MEM_cnew<ARegion>("spreadsheet dataset region");
|
||||
ARegion *region = BKE_area_region_new();
|
||||
BLI_addtail(&spreadsheet_space->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
@@ -78,7 +78,7 @@ static SpaceLink *spreadsheet_create(const ScrArea * /*area*/, const Scene * /*s
|
||||
|
||||
{
|
||||
/* Properties region. */
|
||||
ARegion *region = MEM_cnew<ARegion>("spreadsheet right region");
|
||||
ARegion *region = BKE_area_region_new();
|
||||
BLI_addtail(&spreadsheet_space->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
@@ -87,7 +87,7 @@ static SpaceLink *spreadsheet_create(const ScrArea * /*area*/, const Scene * /*s
|
||||
|
||||
{
|
||||
/* Main window. */
|
||||
ARegion *region = MEM_cnew<ARegion>("spreadsheet main region");
|
||||
ARegion *region = BKE_area_region_new();
|
||||
BLI_addtail(&spreadsheet_space->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ static SpaceLink *statusbar_create(const ScrArea * /*area*/, const Scene * /*sce
|
||||
sstatusbar->spacetype = SPACE_STATUSBAR;
|
||||
|
||||
/* header region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(*region), "header for statusbar"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&sstatusbar->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = RGN_ALIGN_NONE;
|
||||
|
||||
@@ -57,20 +57,20 @@ static SpaceLink *text_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
stext->runtime = MEM_new<SpaceText_Runtime>(__func__);
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for text"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&stext->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* footer */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "footer for text"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&stext->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_FOOTER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
|
||||
|
||||
/* properties region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "properties region for text"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&stext->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
@@ -78,7 +78,7 @@ static SpaceLink *text_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for text"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&stext->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -46,7 +46,7 @@ static ARegion *text_has_properties_region(ScrArea *area)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
arnew = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "properties region"));
|
||||
arnew = BKE_area_region_new();
|
||||
|
||||
BLI_insertlinkafter(&area->regionbase, region, arnew);
|
||||
arnew->regiontype = RGN_TYPE_UI;
|
||||
|
||||
@@ -46,17 +46,17 @@ static SpaceLink *topbar_create(const ScrArea * /*area*/, const Scene * /*scene*
|
||||
stopbar->spacetype = SPACE_TOPBAR;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "left aligned header for topbar"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&stopbar->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "right aligned header for topbar"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&stopbar->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = RGN_ALIGN_RIGHT | RGN_SPLIT_PREV;
|
||||
|
||||
/* main regions */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region of topbar"));
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&stopbar->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ static SpaceLink *userpref_create(const ScrArea *area, const Scene * /*scene*/)
|
||||
spref->spacetype = SPACE_USERPREF;
|
||||
|
||||
/* header */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "header for userpref"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&spref->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
@@ -48,7 +48,7 @@ static SpaceLink *userpref_create(const ScrArea *area, const Scene * /*scene*/)
|
||||
region->alignment = RGN_ALIGN_BOTTOM;
|
||||
|
||||
/* navigation region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "navigation region for userpref"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&spref->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_NAV_BAR;
|
||||
@@ -60,7 +60,7 @@ static SpaceLink *userpref_create(const ScrArea *area, const Scene * /*scene*/)
|
||||
}
|
||||
|
||||
/* execution region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "execution region for userpref"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&spref->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_EXECUTE;
|
||||
@@ -68,7 +68,7 @@ static SpaceLink *userpref_create(const ScrArea *area, const Scene * /*scene*/)
|
||||
region->flag |= RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE;
|
||||
|
||||
/* main region */
|
||||
region = static_cast<ARegion *>(MEM_callocN(sizeof(ARegion), "main region for userpref"));
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&spref->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -208,14 +208,14 @@ static SpaceLink *view3d_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
}
|
||||
|
||||
/* header */
|
||||
region = MEM_cnew<ARegion>("header for view3d");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* tool header */
|
||||
region = MEM_cnew<ARegion>("tool header for view3d");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOL_HEADER;
|
||||
@@ -223,7 +223,7 @@ static SpaceLink *view3d_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* asset shelf */
|
||||
region = MEM_cnew<ARegion>("asset shelf for view3d");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_ASSET_SHELF;
|
||||
@@ -231,13 +231,13 @@ static SpaceLink *view3d_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
|
||||
/* asset shelf header */
|
||||
region = MEM_cnew<ARegion>("asset shelf header for view3d");
|
||||
region = BKE_area_region_new();
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_ASSET_SHELF_HEADER;
|
||||
region->alignment = RGN_ALIGN_BOTTOM | RGN_ALIGN_HIDE_WITH_PREV;
|
||||
|
||||
/* tool shelf */
|
||||
region = MEM_cnew<ARegion>("toolshelf for view3d");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
@@ -245,7 +245,7 @@ static SpaceLink *view3d_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* buttons/list view */
|
||||
region = MEM_cnew<ARegion>("buttons for view3d");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
@@ -253,7 +253,7 @@ static SpaceLink *view3d_create(const ScrArea * /*area*/, const Scene *scene)
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* main region */
|
||||
region = MEM_cnew<ARegion>("main region for view3d");
|
||||
region = BKE_area_region_new();
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
@@ -35,10 +35,13 @@ struct wmTooltipState;
|
||||
struct Panel_Runtime;
|
||||
#ifdef __cplusplus
|
||||
namespace blender::bke {
|
||||
struct ARegionRuntime;
|
||||
struct FileHandlerType;
|
||||
}
|
||||
} // namespace blender::bke
|
||||
using ARegionRuntimeHandle = blender::bke::ARegionRuntime;
|
||||
using FileHandlerTypeHandle = blender::bke::FileHandlerType;
|
||||
#else
|
||||
typedef struct ARegionRuntimeHandle ARegionRuntimeHandle;
|
||||
typedef struct FileHandlerTypeHandle FileHandlerTypeHandle;
|
||||
#endif
|
||||
|
||||
@@ -450,27 +453,6 @@ typedef struct ScrArea {
|
||||
ScrArea_Runtime runtime;
|
||||
} ScrArea;
|
||||
|
||||
typedef struct ARegion_Runtime {
|
||||
/** Panel category to use between 'layout' and 'draw'. */
|
||||
const char *category;
|
||||
|
||||
/**
|
||||
* The visible part of the region, use with region overlap not to draw
|
||||
* on top of the overlapping regions.
|
||||
*
|
||||
* Lazy initialize, zero'd when unset, relative to #ARegion.winrct x/y min. */
|
||||
rcti visible_rect;
|
||||
|
||||
/* The offset needed to not overlap with window scroll-bars. Only used by HUD regions for now. */
|
||||
int offset_x, offset_y;
|
||||
|
||||
/** Maps #uiBlock::name to uiBlock for faster lookups. */
|
||||
struct GHash *block_name_map;
|
||||
|
||||
/* Dummy panel used in popups so they can support layout panels. */
|
||||
Panel *popup_block_panel;
|
||||
} ARegion_Runtime;
|
||||
|
||||
typedef struct ARegion {
|
||||
struct ARegion *next, *prev;
|
||||
|
||||
@@ -542,7 +524,7 @@ typedef struct ARegion {
|
||||
/** XXX 2.50, need spacedata equivalent? */
|
||||
void *regiondata;
|
||||
|
||||
ARegion_Runtime runtime;
|
||||
ARegionRuntimeHandle *runtime;
|
||||
} ARegion;
|
||||
|
||||
/** #ScrArea.flag */
|
||||
|
||||
Reference in New Issue
Block a user