Cleanup: Rename ARegion variables from ar to region
The old convention was easy to confuse with ScrArea. Part of https://developer.blender.org/T74432. This is mostly a batch rename with some manual fixing. Only single word variable names are changed, no prefixed/suffixed names. Brecht van Lommel and Campbell Barton both gave me a green light for this convention change. Also ran clan clang format on affected files.
This commit is contained in:
@@ -198,7 +198,7 @@ typedef struct bNodeType {
|
||||
|
||||
/* Main draw function for the node */
|
||||
void (*draw_nodetype)(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct SpaceNode *snode,
|
||||
struct bNodeTree *ntree,
|
||||
struct bNode *node,
|
||||
|
||||
@@ -133,19 +133,19 @@ typedef struct ARegionType {
|
||||
int regionid; /* unique identifier within this space, defines RGN_TYPE_xxxx */
|
||||
|
||||
/* add handlers, stuff you only do once or on area/region type/size changes */
|
||||
void (*init)(struct wmWindowManager *wm, struct ARegion *ar);
|
||||
void (*init)(struct wmWindowManager *wm, struct ARegion *region);
|
||||
/* exit is called when the region is hidden or removed */
|
||||
void (*exit)(struct wmWindowManager *wm, struct ARegion *ar);
|
||||
void (*exit)(struct wmWindowManager *wm, struct ARegion *region);
|
||||
/* draw entirely, view changes should be handled here */
|
||||
void (*draw)(const struct bContext *C, struct ARegion *ar);
|
||||
void (*draw)(const struct bContext *C, struct ARegion *region);
|
||||
/* optional, compute button layout before drawing for dynamic size */
|
||||
void (*layout)(const struct bContext *C, struct ARegion *ar);
|
||||
void (*layout)(const struct bContext *C, struct ARegion *region);
|
||||
/* snap the size of the region (can be NULL for no snapping). */
|
||||
int (*snap_size)(const struct ARegion *ar, int size, int axis);
|
||||
int (*snap_size)(const struct ARegion *region, int size, int axis);
|
||||
/* contextual changes should be handled here */
|
||||
void (*listener)(struct wmWindow *win,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct wmNotifier *wmn,
|
||||
const struct Scene *scene);
|
||||
/* Optional callback to generate subscriptions. */
|
||||
@@ -154,7 +154,7 @@ typedef struct ARegionType {
|
||||
struct Scene *scene,
|
||||
struct bScreen *sc,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct wmMsgBus *mbus);
|
||||
|
||||
void (*free)(struct ARegion *);
|
||||
@@ -167,7 +167,7 @@ typedef struct ARegionType {
|
||||
/* add own items to keymap */
|
||||
void (*keymap)(struct wmKeyConfig *keyconf);
|
||||
/* allows default cursor per region */
|
||||
void (*cursor)(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar);
|
||||
void (*cursor)(struct wmWindow *win, struct ScrArea *sa, struct ARegion *region);
|
||||
|
||||
/* return context data */
|
||||
int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result);
|
||||
@@ -340,8 +340,8 @@ void BKE_spacedata_callback_id_remap_set(
|
||||
void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID *id);
|
||||
|
||||
/* area/regions */
|
||||
struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar);
|
||||
void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
|
||||
struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *region);
|
||||
void BKE_area_region_free(struct SpaceType *st, struct ARegion *region);
|
||||
void BKE_area_region_panels_free(struct ListBase *panels);
|
||||
void BKE_screen_area_free(struct ScrArea *sa);
|
||||
/* Gizmo-maps of a region need to be freed with the region.
|
||||
|
||||
@@ -280,7 +280,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
|
||||
{
|
||||
bScreen *sc;
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
int done = 0, recursion = C->data.recursion;
|
||||
int ret = 0;
|
||||
|
||||
@@ -318,10 +318,10 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
if (done != 1 && recursion < 2 && (ar = CTX_wm_region(C))) {
|
||||
if (done != 1 && recursion < 2 && (region = CTX_wm_region(C))) {
|
||||
C->data.recursion = 2;
|
||||
if (ar->type && ar->type->context) {
|
||||
ret = ar->type->context(C, member, result);
|
||||
if (region->type && region->type->context) {
|
||||
ret = region->type->context(C, member, result);
|
||||
if (ret) {
|
||||
done = -(-ret | -done);
|
||||
}
|
||||
@@ -545,7 +545,7 @@ ListBase CTX_data_dir_get_ex(const bContext *C,
|
||||
ListBase lb;
|
||||
bScreen *sc;
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
int a;
|
||||
|
||||
memset(&lb, 0, sizeof(lb));
|
||||
@@ -578,9 +578,9 @@ ListBase CTX_data_dir_get_ex(const bContext *C,
|
||||
data_dir_add(&lb, entry->name, use_all);
|
||||
}
|
||||
}
|
||||
if ((ar = CTX_wm_region(C)) && ar->type && ar->type->context) {
|
||||
if ((region = CTX_wm_region(C)) && region->type && region->type->context) {
|
||||
memset(&result, 0, sizeof(result));
|
||||
ar->type->context(C, "", &result);
|
||||
region->type->context(C, "", &result);
|
||||
|
||||
if (result.dir) {
|
||||
for (a = 0; result.dir[a]; a++) {
|
||||
@@ -727,8 +727,8 @@ ARegion *CTX_wm_region(const bContext *C)
|
||||
|
||||
void *CTX_wm_region_data(const bContext *C)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
return (ar) ? ar->regiondata : NULL;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
return (region) ? region->regiondata : NULL;
|
||||
}
|
||||
|
||||
struct ARegion *CTX_wm_menu(const bContext *C)
|
||||
@@ -767,11 +767,11 @@ View3D *CTX_wm_view3d(const bContext *C)
|
||||
RegionView3D *CTX_wm_region_view3d(const bContext *C)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
if (sa && sa->spacetype == SPACE_VIEW3D) {
|
||||
if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
return ar->regiondata;
|
||||
if (region && region->regiontype == RGN_TYPE_WINDOW) {
|
||||
return region->regiondata;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -54,12 +54,12 @@
|
||||
static void screen_free_data(ID *id)
|
||||
{
|
||||
bScreen *screen = (bScreen *)id;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
/* No animdata here. */
|
||||
|
||||
for (ar = screen->regionbase.first; ar; ar = ar->next) {
|
||||
BKE_area_region_free(NULL, ar);
|
||||
for (region = screen->regionbase.first; region; region = region->next) {
|
||||
BKE_area_region_free(NULL, region);
|
||||
}
|
||||
|
||||
BLI_freelistN(&screen->regionbase);
|
||||
@@ -204,14 +204,14 @@ bool BKE_spacetype_exists(int spaceid)
|
||||
void BKE_spacedata_freelist(ListBase *lb)
|
||||
{
|
||||
SpaceLink *sl;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
for (sl = lb->first; sl; sl = sl->next) {
|
||||
SpaceType *st = BKE_spacetype_from_id(sl->spacetype);
|
||||
|
||||
/* free regions for pushed spaces */
|
||||
for (ar = sl->regionbase.first; ar; ar = ar->next) {
|
||||
BKE_area_region_free(st, ar);
|
||||
for (region = sl->regionbase.first; region; region = region->next) {
|
||||
BKE_area_region_free(st, region);
|
||||
}
|
||||
|
||||
BLI_freelistN(&sl->regionbase);
|
||||
@@ -238,9 +238,9 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb)
|
||||
}
|
||||
}
|
||||
|
||||
ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
|
||||
ARegion *BKE_area_region_copy(SpaceType *st, ARegion *region)
|
||||
{
|
||||
ARegion *newar = MEM_dupallocN(ar);
|
||||
ARegion *newar = MEM_dupallocN(region);
|
||||
|
||||
newar->prev = newar->next = NULL;
|
||||
BLI_listbase_clear(&newar->handlers);
|
||||
@@ -255,28 +255,28 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
|
||||
newar->draw_buffer = NULL;
|
||||
|
||||
/* use optional regiondata callback */
|
||||
if (ar->regiondata) {
|
||||
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
|
||||
if (region->regiondata) {
|
||||
ARegionType *art = BKE_regiontype_from_id(st, region->regiontype);
|
||||
|
||||
if (art && art->duplicate) {
|
||||
newar->regiondata = art->duplicate(ar->regiondata);
|
||||
newar->regiondata = art->duplicate(region->regiondata);
|
||||
}
|
||||
else if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||
else if (region->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||
newar->regiondata = NULL;
|
||||
}
|
||||
else {
|
||||
newar->regiondata = MEM_dupallocN(ar->regiondata);
|
||||
newar->regiondata = MEM_dupallocN(region->regiondata);
|
||||
}
|
||||
}
|
||||
|
||||
if (ar->v2d.tab_offset) {
|
||||
newar->v2d.tab_offset = MEM_dupallocN(ar->v2d.tab_offset);
|
||||
if (region->v2d.tab_offset) {
|
||||
newar->v2d.tab_offset = MEM_dupallocN(region->v2d.tab_offset);
|
||||
}
|
||||
|
||||
panel_list_copy(&newar->panels, &ar->panels);
|
||||
panel_list_copy(&newar->panels, ®ion->panels);
|
||||
|
||||
BLI_listbase_clear(&newar->ui_previews);
|
||||
BLI_duplicatelist(&newar->ui_previews, &ar->ui_previews);
|
||||
BLI_duplicatelist(&newar->ui_previews, ®ion->ui_previews);
|
||||
|
||||
return newar;
|
||||
}
|
||||
@@ -284,13 +284,13 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
|
||||
/* from lb2 to lb1, lb1 is supposed to be freed */
|
||||
static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
|
||||
{
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
/* to be sure */
|
||||
BLI_listbase_clear(lb1);
|
||||
|
||||
for (ar = lb2->first; ar; ar = ar->next) {
|
||||
ARegion *arnew = BKE_area_region_copy(st, ar);
|
||||
for (region = lb2->first; region; region = region->next) {
|
||||
ARegion *arnew = BKE_area_region_copy(st, region);
|
||||
BLI_addtail(lb1, arnew);
|
||||
}
|
||||
}
|
||||
@@ -344,19 +344,19 @@ ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, const ScrArea *s
|
||||
{
|
||||
const bool is_slink_active = slink == sa->spacedata.first;
|
||||
const ListBase *regionbase = (is_slink_active) ? &sa->regionbase : &slink->regionbase;
|
||||
ARegion *ar = NULL;
|
||||
ARegion *region = NULL;
|
||||
|
||||
BLI_assert(BLI_findindex(&sa->spacedata, slink) != -1);
|
||||
for (ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == region_type) {
|
||||
for (region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == region_type) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Should really unit test this instead. */
|
||||
BLI_assert(!is_slink_active || ar == BKE_area_find_region_type(sa, region_type));
|
||||
BLI_assert(!is_slink_active || region == BKE_area_find_region_type(sa, region_type));
|
||||
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
static void (*spacedata_id_remap_cb)(struct ScrArea *sa,
|
||||
@@ -394,11 +394,11 @@ void BKE_screen_gizmo_tag_refresh(struct bScreen *sc)
|
||||
}
|
||||
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->gizmo_map != NULL) {
|
||||
region_refresh_tag_gizmomap_callback(ar->gizmo_map);
|
||||
for (region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->gizmo_map != NULL) {
|
||||
region_refresh_tag_gizmomap_callback(region->gizmo_map);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,33 +429,33 @@ void BKE_area_region_panels_free(ListBase *lb)
|
||||
}
|
||||
|
||||
/* not region itself */
|
||||
void BKE_area_region_free(SpaceType *st, ARegion *ar)
|
||||
void BKE_area_region_free(SpaceType *st, ARegion *region)
|
||||
{
|
||||
uiList *uilst;
|
||||
|
||||
if (st) {
|
||||
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
|
||||
ARegionType *art = BKE_regiontype_from_id(st, region->regiontype);
|
||||
|
||||
if (art && art->free) {
|
||||
art->free(ar);
|
||||
art->free(region);
|
||||
}
|
||||
|
||||
if (ar->regiondata) {
|
||||
if (region->regiondata) {
|
||||
printf("regiondata free error\n");
|
||||
}
|
||||
}
|
||||
else if (ar->type && ar->type->free) {
|
||||
ar->type->free(ar);
|
||||
else if (region->type && region->type->free) {
|
||||
region->type->free(region);
|
||||
}
|
||||
|
||||
if (ar->v2d.tab_offset) {
|
||||
MEM_freeN(ar->v2d.tab_offset);
|
||||
ar->v2d.tab_offset = NULL;
|
||||
if (region->v2d.tab_offset) {
|
||||
MEM_freeN(region->v2d.tab_offset);
|
||||
region->v2d.tab_offset = NULL;
|
||||
}
|
||||
|
||||
BKE_area_region_panels_free(&ar->panels);
|
||||
BKE_area_region_panels_free(®ion->panels);
|
||||
|
||||
for (uilst = ar->ui_lists.first; uilst; uilst = uilst->next) {
|
||||
for (uilst = region->ui_lists.first; uilst; uilst = uilst->next) {
|
||||
if (uilst->dyn_data) {
|
||||
uiListDyn *dyn_data = uilst->dyn_data;
|
||||
if (dyn_data->items_filter_flags) {
|
||||
@@ -471,24 +471,24 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar)
|
||||
}
|
||||
}
|
||||
|
||||
if (ar->gizmo_map != NULL) {
|
||||
region_free_gizmomap_callback(ar->gizmo_map);
|
||||
if (region->gizmo_map != NULL) {
|
||||
region_free_gizmomap_callback(region->gizmo_map);
|
||||
}
|
||||
|
||||
BLI_freelistN(&ar->ui_lists);
|
||||
BLI_freelistN(&ar->ui_previews);
|
||||
BLI_freelistN(&ar->panels_category);
|
||||
BLI_freelistN(&ar->panels_category_active);
|
||||
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 *sa)
|
||||
{
|
||||
SpaceType *st = BKE_spacetype_from_id(sa->spacetype);
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
BKE_area_region_free(st, ar);
|
||||
for (region = sa->regionbase.first; region; region = region->next) {
|
||||
BKE_area_region_free(st, region);
|
||||
}
|
||||
|
||||
MEM_SAFE_FREE(sa->global);
|
||||
@@ -722,9 +722,9 @@ void BKE_screen_remove_unused_scrverts(bScreen *sc)
|
||||
ARegion *BKE_area_find_region_type(const ScrArea *sa, int region_type)
|
||||
{
|
||||
if (sa) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == region_type) {
|
||||
return ar;
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == region_type) {
|
||||
return region;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -735,9 +735,9 @@ ARegion *BKE_area_find_region_type(const ScrArea *sa, int region_type)
|
||||
ARegion *BKE_area_find_region_active_win(ScrArea *sa)
|
||||
{
|
||||
if (sa) {
|
||||
ARegion *ar = BLI_findlink(&sa->regionbase, sa->region_active_win);
|
||||
if (ar && (ar->regiontype == RGN_TYPE_WINDOW)) {
|
||||
return ar;
|
||||
ARegion *region = BLI_findlink(&sa->regionbase, sa->region_active_win);
|
||||
if (region && (region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
return region;
|
||||
}
|
||||
|
||||
/* fallback to any */
|
||||
@@ -750,11 +750,11 @@ ARegion *BKE_area_find_region_xy(ScrArea *sa, const int regiontype, int x, int y
|
||||
{
|
||||
ARegion *ar_found = NULL;
|
||||
if (sa) {
|
||||
ARegion *ar;
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if ((regiontype == RGN_TYPE_ANY) || (ar->regiontype == regiontype)) {
|
||||
if (BLI_rcti_isect_pt(&ar->winrct, x, y)) {
|
||||
ar_found = ar;
|
||||
ARegion *region;
|
||||
for (region = sa->regionbase.first; region; region = region->next) {
|
||||
if ((regiontype == RGN_TYPE_ANY) || (region->regiontype == regiontype)) {
|
||||
if (BLI_rcti_isect_pt(®ion->winrct, x, y)) {
|
||||
ar_found = region;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -769,10 +769,10 @@ ARegion *BKE_area_find_region_xy(ScrArea *sa, const int regiontype, int x, int y
|
||||
ARegion *BKE_screen_find_region_xy(bScreen *sc, const int regiontype, int x, int y)
|
||||
{
|
||||
ARegion *ar_found = NULL;
|
||||
for (ARegion *ar = sc->regionbase.first; ar; ar = ar->next) {
|
||||
if ((regiontype == RGN_TYPE_ANY) || (ar->regiontype == regiontype)) {
|
||||
if (BLI_rcti_isect_pt(&ar->winrct, x, y)) {
|
||||
ar_found = ar;
|
||||
for (ARegion *region = sc->regionbase.first; region; region = region->next) {
|
||||
if ((regiontype == RGN_TYPE_ANY) || (region->regiontype == regiontype)) {
|
||||
if (BLI_rcti_isect_pt(®ion->winrct, x, y)) {
|
||||
ar_found = region;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -847,11 +847,11 @@ void BKE_screen_view3d_sync(View3D *v3d, struct Scene *scene)
|
||||
v3d->camera = scene->camera;
|
||||
|
||||
if (v3d->camera == NULL) {
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
for (ar = v3d->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
for (region = v3d->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
if (rv3d->persp == RV3D_CAMOB) {
|
||||
rv3d->persp = RV3D_PERSP;
|
||||
}
|
||||
@@ -914,20 +914,20 @@ void BKE_screen_header_alignment_reset(bScreen *screen)
|
||||
{
|
||||
int alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) {
|
||||
ar->alignment = RGN_ALIGN_TOP;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
continue;
|
||||
}
|
||||
ar->alignment = alignment;
|
||||
region->alignment = alignment;
|
||||
}
|
||||
if (ar->regiontype == RGN_TYPE_FOOTER) {
|
||||
if (region->regiontype == RGN_TYPE_FOOTER) {
|
||||
if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) {
|
||||
ar->alignment = RGN_ALIGN_BOTTOM;
|
||||
region->alignment = RGN_ALIGN_BOTTOM;
|
||||
continue;
|
||||
}
|
||||
ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7001,38 +7001,38 @@ static void direct_link_panel_list(FileData *fd, ListBase *lb)
|
||||
}
|
||||
}
|
||||
|
||||
static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
|
||||
static void direct_link_region(FileData *fd, ARegion *region, int spacetype)
|
||||
{
|
||||
uiList *ui_list;
|
||||
|
||||
direct_link_panel_list(fd, &ar->panels);
|
||||
direct_link_panel_list(fd, ®ion->panels);
|
||||
|
||||
link_list(fd, &ar->panels_category_active);
|
||||
link_list(fd, ®ion->panels_category_active);
|
||||
|
||||
link_list(fd, &ar->ui_lists);
|
||||
link_list(fd, ®ion->ui_lists);
|
||||
|
||||
for (ui_list = ar->ui_lists.first; ui_list; ui_list = ui_list->next) {
|
||||
for (ui_list = region->ui_lists.first; ui_list; ui_list = ui_list->next) {
|
||||
ui_list->type = NULL;
|
||||
ui_list->dyn_data = NULL;
|
||||
ui_list->properties = newdataadr(fd, ui_list->properties);
|
||||
IDP_DirectLinkGroup_OrFree(&ui_list->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
|
||||
}
|
||||
|
||||
link_list(fd, &ar->ui_previews);
|
||||
link_list(fd, ®ion->ui_previews);
|
||||
|
||||
if (spacetype == SPACE_EMPTY) {
|
||||
/* unknown space type, don't leak regiondata */
|
||||
ar->regiondata = NULL;
|
||||
region->regiondata = NULL;
|
||||
}
|
||||
else if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||
else if (region->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||
/* Runtime data, don't use. */
|
||||
ar->regiondata = NULL;
|
||||
region->regiondata = NULL;
|
||||
}
|
||||
else {
|
||||
ar->regiondata = newdataadr(fd, ar->regiondata);
|
||||
if (ar->regiondata) {
|
||||
region->regiondata = newdataadr(fd, region->regiondata);
|
||||
if (region->regiondata) {
|
||||
if (spacetype == SPACE_VIEW3D) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
rv3d->localvd = newdataadr(fd, rv3d->localvd);
|
||||
rv3d->clipbb = newdataadr(fd, rv3d->clipbb);
|
||||
@@ -7047,28 +7047,28 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
|
||||
}
|
||||
}
|
||||
|
||||
ar->v2d.tab_offset = NULL;
|
||||
ar->v2d.tab_num = 0;
|
||||
ar->v2d.tab_cur = 0;
|
||||
ar->v2d.sms = NULL;
|
||||
ar->v2d.alpha_hor = ar->v2d.alpha_vert = 255; /* visible by default */
|
||||
BLI_listbase_clear(&ar->panels_category);
|
||||
BLI_listbase_clear(&ar->handlers);
|
||||
BLI_listbase_clear(&ar->uiblocks);
|
||||
ar->headerstr = NULL;
|
||||
ar->visible = 0;
|
||||
ar->type = NULL;
|
||||
ar->do_draw = 0;
|
||||
ar->gizmo_map = NULL;
|
||||
ar->regiontimer = NULL;
|
||||
ar->draw_buffer = NULL;
|
||||
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
|
||||
region->v2d.tab_offset = NULL;
|
||||
region->v2d.tab_num = 0;
|
||||
region->v2d.tab_cur = 0;
|
||||
region->v2d.sms = NULL;
|
||||
region->v2d.alpha_hor = region->v2d.alpha_vert = 255; /* visible by default */
|
||||
BLI_listbase_clear(®ion->panels_category);
|
||||
BLI_listbase_clear(®ion->handlers);
|
||||
BLI_listbase_clear(®ion->uiblocks);
|
||||
region->headerstr = NULL;
|
||||
region->visible = 0;
|
||||
region->type = NULL;
|
||||
region->do_draw = 0;
|
||||
region->gizmo_map = NULL;
|
||||
region->regiontimer = NULL;
|
||||
region->draw_buffer = NULL;
|
||||
memset(®ion->drawrct, 0, sizeof(region->drawrct));
|
||||
}
|
||||
|
||||
static void direct_link_area(FileData *fd, ScrArea *area)
|
||||
{
|
||||
SpaceLink *sl;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
link_list(fd, &(area->spacedata));
|
||||
link_list(fd, &(area->regionbase));
|
||||
@@ -7094,8 +7094,8 @@ static void direct_link_area(FileData *fd, ScrArea *area)
|
||||
area->spacetype = SPACE_EMPTY;
|
||||
}
|
||||
|
||||
for (ar = area->regionbase.first; ar; ar = ar->next) {
|
||||
direct_link_region(fd, ar, area->spacetype);
|
||||
for (region = area->regionbase.first; region; region = region->next) {
|
||||
direct_link_region(fd, region, area->spacetype);
|
||||
}
|
||||
|
||||
/* accident can happen when read/save new file with older version */
|
||||
@@ -7119,8 +7119,8 @@ static void direct_link_area(FileData *fd, ScrArea *area)
|
||||
sl->spacetype = SPACE_EMPTY;
|
||||
}
|
||||
|
||||
for (ar = sl->regionbase.first; ar; ar = ar->next) {
|
||||
direct_link_region(fd, ar, sl->spacetype);
|
||||
for (region = sl->regionbase.first; region; region = region->next) {
|
||||
direct_link_region(fd, region, sl->spacetype);
|
||||
}
|
||||
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
@@ -7800,9 +7800,9 @@ static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene, View
|
||||
/* Regionbase storage is different depending if the space is active. */
|
||||
ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
|
||||
&sl->regionbase;
|
||||
for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
for (ARegion *region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
if (rv3d->localvd) {
|
||||
MEM_freeN(rv3d->localvd);
|
||||
rv3d->localvd = NULL;
|
||||
@@ -7828,16 +7828,16 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map,
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = (View3D *)sl;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
v3d->camera = restore_pointer_by_name(id_map, (ID *)v3d->camera, USER_REAL);
|
||||
v3d->ob_centre = restore_pointer_by_name(id_map, (ID *)v3d->ob_centre, USER_REAL);
|
||||
|
||||
/* Free render engines for now. */
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
for (ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
for (region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
if (rv3d && rv3d->render_engine) {
|
||||
RE_engine_free(rv3d->render_engine);
|
||||
rv3d->render_engine = NULL;
|
||||
@@ -8115,13 +8115,13 @@ void blo_lib_link_restore(Main *oldmain,
|
||||
/* and as patch for 2.48 and older */
|
||||
void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions)
|
||||
{
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
for (ar = regions->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW && ar->regiondata == NULL) {
|
||||
for (region = regions->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW && region->regiondata == NULL) {
|
||||
RegionView3D *rv3d;
|
||||
|
||||
rv3d = ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch");
|
||||
rv3d = region->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch");
|
||||
rv3d->persp = (char)v3d->persp;
|
||||
rv3d->view = (char)v3d->view;
|
||||
rv3d->dist = v3d->dist;
|
||||
|
||||
@@ -90,119 +90,119 @@
|
||||
/* 2.50 patch */
|
||||
static void area_add_header_region(ScrArea *sa, ListBase *lb)
|
||||
{
|
||||
ARegion *ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
ARegion *region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_HEADER;
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
if (sa->headertype == 1) {
|
||||
ar->alignment = RGN_ALIGN_BOTTOM;
|
||||
region->alignment = RGN_ALIGN_BOTTOM;
|
||||
}
|
||||
else {
|
||||
ar->alignment = RGN_ALIGN_TOP;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
}
|
||||
|
||||
/* initialize view2d data for header region, to allow panning */
|
||||
/* is copy from ui_view2d.c */
|
||||
ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
|
||||
ar->v2d.keepofs = V2D_LOCKOFS_Y;
|
||||
ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
|
||||
ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y;
|
||||
ar->v2d.flag = (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
|
||||
region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
|
||||
region->v2d.keepofs = V2D_LOCKOFS_Y;
|
||||
region->v2d.keeptot = V2D_KEEPTOT_STRICT;
|
||||
region->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y;
|
||||
region->v2d.flag = (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
|
||||
}
|
||||
|
||||
static void sequencer_init_preview_region(ARegion *ar)
|
||||
static void sequencer_init_preview_region(ARegion *region)
|
||||
{
|
||||
// XXX a bit ugly still, copied from space_sequencer
|
||||
/* NOTE: if you change values here, also change them in space_sequencer.c, sequencer_new */
|
||||
ar->regiontype = RGN_TYPE_PREVIEW;
|
||||
ar->alignment = RGN_ALIGN_TOP;
|
||||
ar->flag |= RGN_FLAG_HIDDEN;
|
||||
ar->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM;
|
||||
ar->v2d.minzoom = 0.00001f;
|
||||
ar->v2d.maxzoom = 100000.0f;
|
||||
ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
|
||||
ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
|
||||
ar->v2d.tot.xmax = 960.0f;
|
||||
ar->v2d.tot.ymax = 540.0f;
|
||||
ar->v2d.min[0] = 0.0f;
|
||||
ar->v2d.min[1] = 0.0f;
|
||||
ar->v2d.max[0] = 12000.0f;
|
||||
ar->v2d.max[1] = 12000.0f;
|
||||
ar->v2d.cur = ar->v2d.tot;
|
||||
ar->v2d.align = V2D_ALIGN_FREE; // (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
|
||||
ar->v2d.keeptot = V2D_KEEPTOT_FREE;
|
||||
region->regiontype = RGN_TYPE_PREVIEW;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
region->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM;
|
||||
region->v2d.minzoom = 0.00001f;
|
||||
region->v2d.maxzoom = 100000.0f;
|
||||
region->v2d.tot.xmin = -960.0f; /* 1920 width centered */
|
||||
region->v2d.tot.ymin = -540.0f; /* 1080 height centered */
|
||||
region->v2d.tot.xmax = 960.0f;
|
||||
region->v2d.tot.ymax = 540.0f;
|
||||
region->v2d.min[0] = 0.0f;
|
||||
region->v2d.min[1] = 0.0f;
|
||||
region->v2d.max[0] = 12000.0f;
|
||||
region->v2d.max[1] = 12000.0f;
|
||||
region->v2d.cur = region->v2d.tot;
|
||||
region->v2d.align = V2D_ALIGN_FREE; // (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
|
||||
region->v2d.keeptot = V2D_KEEPTOT_FREE;
|
||||
}
|
||||
|
||||
static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
{
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
ARegion *ar_main;
|
||||
|
||||
if (sl) {
|
||||
/* first channels for ipo action nla... */
|
||||
switch (sl->spacetype) {
|
||||
case SPACE_GRAPH:
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_CHANNELS;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
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... */
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_UI;
|
||||
ar->alignment = RGN_ALIGN_RIGHT;
|
||||
ar->v2d.scroll = V2D_SCROLL_RIGHT;
|
||||
ar->v2d.flag = RGN_FLAG_HIDDEN;
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
region->v2d.scroll = V2D_SCROLL_RIGHT;
|
||||
region->v2d.flag = RGN_FLAG_HIDDEN;
|
||||
break;
|
||||
|
||||
case SPACE_ACTION:
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_CHANNELS;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
ar->v2d.scroll = V2D_SCROLL_BOTTOM;
|
||||
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->v2d.scroll = V2D_SCROLL_BOTTOM;
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
break;
|
||||
|
||||
case SPACE_NLA:
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_CHANNELS;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
ar->v2d.scroll = V2D_SCROLL_BOTTOM;
|
||||
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->v2d.scroll = V2D_SCROLL_BOTTOM;
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
|
||||
/* for some reason, some files still don't get this auto */
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_UI;
|
||||
ar->alignment = RGN_ALIGN_RIGHT;
|
||||
ar->v2d.scroll = V2D_SCROLL_RIGHT;
|
||||
ar->v2d.flag = RGN_FLAG_HIDDEN;
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
region->v2d.scroll = V2D_SCROLL_RIGHT;
|
||||
region->v2d.flag = RGN_FLAG_HIDDEN;
|
||||
break;
|
||||
|
||||
case SPACE_NODE:
|
||||
ar = MEM_callocN(sizeof(ARegion), "nodetree area for node");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_UI;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
region = MEM_callocN(sizeof(ARegion), "nodetree area for node");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
/* temporarily hide it */
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
break;
|
||||
case SPACE_FILE:
|
||||
ar = MEM_callocN(sizeof(ARegion), "nodetree area for node");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_CHANNELS;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
region = MEM_callocN(sizeof(ARegion), "nodetree area for node");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
|
||||
ar = MEM_callocN(sizeof(ARegion), "ui area for file");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_UI;
|
||||
ar->alignment = RGN_ALIGN_TOP;
|
||||
region = MEM_callocN(sizeof(ARegion), "ui area for file");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_TOP;
|
||||
break;
|
||||
case SPACE_SEQ:
|
||||
ar_main = (ARegion *)lb->first;
|
||||
@@ -211,41 +211,41 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
|
||||
BLI_insertlinkbefore(lb, ar_main, ar);
|
||||
sequencer_init_preview_region(ar);
|
||||
region = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
|
||||
BLI_insertlinkbefore(lb, ar_main, region);
|
||||
sequencer_init_preview_region(region);
|
||||
break;
|
||||
case SPACE_VIEW3D:
|
||||
/* toolbar */
|
||||
ar = MEM_callocN(sizeof(ARegion), "toolbar for view3d");
|
||||
region = MEM_callocN(sizeof(ARegion), "toolbar for view3d");
|
||||
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_TOOLS;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* tool properties */
|
||||
ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
|
||||
region = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
|
||||
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_TOOL_PROPS;
|
||||
ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_TOOL_PROPS;
|
||||
region->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
/* buttons/list view */
|
||||
ar = MEM_callocN(sizeof(ARegion), "buttons for view3d");
|
||||
region = MEM_callocN(sizeof(ARegion), "buttons for view3d");
|
||||
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_UI;
|
||||
ar->alignment = RGN_ALIGN_RIGHT;
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
region->flag = RGN_FLAG_HIDDEN;
|
||||
#if 0
|
||||
case SPACE_PROPERTIES:
|
||||
/* context UI region */
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype = RGN_TYPE_UI;
|
||||
ar->alignment = RGN_ALIGN_RIGHT;
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
BLI_addtail(lb, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
|
||||
break;
|
||||
#endif
|
||||
@@ -253,12 +253,12 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
}
|
||||
|
||||
/* main region */
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
|
||||
|
||||
BLI_addtail(lb, ar);
|
||||
ar->winrct = sa->totrct;
|
||||
BLI_addtail(lb, region);
|
||||
region->winrct = sa->totrct;
|
||||
|
||||
ar->regiontype = RGN_TYPE_WINDOW;
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
if (sl) {
|
||||
/* if active spacetype has view2d data, copy that over to main region */
|
||||
@@ -271,45 +271,45 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
case SPACE_OUTLINER: {
|
||||
SpaceOutliner *soops = (SpaceOutliner *)sl;
|
||||
|
||||
memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
|
||||
memcpy(®ion->v2d, &soops->v2d, sizeof(View2D));
|
||||
|
||||
ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
|
||||
ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
|
||||
ar->v2d.keepzoom |= (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_KEEPASPECT);
|
||||
ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
|
||||
ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
|
||||
// ar->v2d.flag |= V2D_IS_INITIALISED;
|
||||
region->v2d.scroll &= ~V2D_SCROLL_LEFT;
|
||||
region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
region->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
|
||||
region->v2d.keepzoom |= (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_KEEPASPECT);
|
||||
region->v2d.keeptot = V2D_KEEPTOT_STRICT;
|
||||
region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
|
||||
// region->v2d.flag |= V2D_IS_INITIALISED;
|
||||
break;
|
||||
}
|
||||
case SPACE_GRAPH: {
|
||||
SpaceGraph *sipo = (SpaceGraph *)sl;
|
||||
memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
|
||||
memcpy(®ion->v2d, &sipo->v2d, sizeof(View2D));
|
||||
|
||||
/* init mainarea view2d */
|
||||
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
|
||||
region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
region->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
|
||||
|
||||
ar->v2d.min[0] = FLT_MIN;
|
||||
ar->v2d.min[1] = FLT_MIN;
|
||||
region->v2d.min[0] = FLT_MIN;
|
||||
region->v2d.min[1] = FLT_MIN;
|
||||
|
||||
ar->v2d.max[0] = MAXFRAMEF;
|
||||
ar->v2d.max[1] = FLT_MAX;
|
||||
region->v2d.max[0] = MAXFRAMEF;
|
||||
region->v2d.max[1] = FLT_MAX;
|
||||
|
||||
// ar->v2d.flag |= V2D_IS_INITIALISED;
|
||||
// region->v2d.flag |= V2D_IS_INITIALISED;
|
||||
break;
|
||||
}
|
||||
case SPACE_NLA: {
|
||||
SpaceNla *snla = (SpaceNla *)sl;
|
||||
memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
|
||||
memcpy(®ion->v2d, &snla->v2d, sizeof(View2D));
|
||||
|
||||
ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
|
||||
ar->v2d.tot.ymax = 0.0f;
|
||||
region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
|
||||
region->v2d.tot.ymax = 0.0f;
|
||||
|
||||
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
|
||||
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
||||
ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
region->v2d.scroll |= (V2D_SCROLL_RIGHT);
|
||||
region->v2d.align = V2D_ALIGN_NO_POS_Y;
|
||||
region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
break;
|
||||
}
|
||||
case SPACE_ACTION: {
|
||||
@@ -317,26 +317,26 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
|
||||
/* We totally reinit the view for the Action Editor,
|
||||
* as some old instances had some weird cruft set. */
|
||||
ar->v2d.tot.xmin = -20.0f;
|
||||
ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
|
||||
ar->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120);
|
||||
ar->v2d.tot.ymax = 0.0f;
|
||||
region->v2d.tot.xmin = -20.0f;
|
||||
region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
|
||||
region->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120);
|
||||
region->v2d.tot.ymax = 0.0f;
|
||||
|
||||
ar->v2d.cur = ar->v2d.tot;
|
||||
region->v2d.cur = region->v2d.tot;
|
||||
|
||||
ar->v2d.min[0] = 0.0f;
|
||||
ar->v2d.min[1] = 0.0f;
|
||||
region->v2d.min[0] = 0.0f;
|
||||
region->v2d.min[1] = 0.0f;
|
||||
|
||||
ar->v2d.max[0] = MAXFRAMEF;
|
||||
ar->v2d.max[1] = FLT_MAX;
|
||||
region->v2d.max[0] = MAXFRAMEF;
|
||||
region->v2d.max[1] = FLT_MAX;
|
||||
|
||||
ar->v2d.minzoom = 0.01f;
|
||||
ar->v2d.maxzoom = 50;
|
||||
ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
|
||||
ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
||||
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
||||
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
region->v2d.minzoom = 0.01f;
|
||||
region->v2d.maxzoom = 50;
|
||||
region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
region->v2d.scroll |= (V2D_SCROLL_RIGHT);
|
||||
region->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
||||
region->v2d.align = V2D_ALIGN_NO_POS_Y;
|
||||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
|
||||
/* for old files with ShapeKey editors open + an action set, clear the action as
|
||||
* it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit
|
||||
@@ -349,39 +349,39 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
}
|
||||
case SPACE_SEQ: {
|
||||
SpaceSeq *sseq = (SpaceSeq *)sl;
|
||||
memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
|
||||
memcpy(®ion->v2d, &sseq->v2d, sizeof(View2D));
|
||||
|
||||
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
|
||||
ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
|
||||
ar->v2d.flag |= V2D_IS_INITIALISED;
|
||||
region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
|
||||
region->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
|
||||
region->v2d.align = V2D_ALIGN_NO_NEG_Y;
|
||||
region->v2d.flag |= V2D_IS_INITIALISED;
|
||||
break;
|
||||
}
|
||||
case SPACE_NODE: {
|
||||
SpaceNode *snode = (SpaceNode *)sl;
|
||||
memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
|
||||
memcpy(®ion->v2d, &snode->v2d, sizeof(View2D));
|
||||
|
||||
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
|
||||
region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
region->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
|
||||
break;
|
||||
}
|
||||
case SPACE_PROPERTIES: {
|
||||
SpaceProperties *sbuts = (SpaceProperties *)sl;
|
||||
memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
|
||||
memcpy(®ion->v2d, &sbuts->v2d, sizeof(View2D));
|
||||
|
||||
ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
break;
|
||||
}
|
||||
case SPACE_FILE: {
|
||||
// SpaceFile *sfile = (SpaceFile *)sl;
|
||||
ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0;
|
||||
ar->v2d.tot.xmax = ar->winx;
|
||||
ar->v2d.tot.ymax = ar->winy;
|
||||
ar->v2d.cur = ar->v2d.tot;
|
||||
ar->regiontype = RGN_TYPE_WINDOW;
|
||||
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
|
||||
ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
|
||||
region->v2d.tot.xmin = region->v2d.tot.ymin = 0;
|
||||
region->v2d.tot.xmax = region->winx;
|
||||
region->v2d.tot.ymax = region->winy;
|
||||
region->v2d.cur = region->v2d.tot;
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
region->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
|
||||
region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
|
||||
break;
|
||||
}
|
||||
case SPACE_TEXT: {
|
||||
@@ -389,7 +389,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
st->flags |= ST_FIND_WRAP;
|
||||
}
|
||||
// case SPACE_XXX: // FIXME... add other ones
|
||||
// memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
|
||||
// memcpy(®ion->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
|
||||
// break;
|
||||
}
|
||||
}
|
||||
@@ -1196,7 +1196,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype != SPACE_SEQ) {
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
ListBase *regionbase;
|
||||
|
||||
if (sl == sa->spacedata.first) {
|
||||
@@ -1206,16 +1206,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
regionbase = &sl->regionbase;
|
||||
}
|
||||
|
||||
for (ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_PREVIEW) {
|
||||
for (region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_PREVIEW) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) {
|
||||
if (region && (region->regiontype == RGN_TYPE_PREVIEW)) {
|
||||
SpaceType *st = BKE_spacetype_from_id(SPACE_SEQ);
|
||||
BKE_area_region_free(st, ar);
|
||||
BLI_freelinkN(regionbase, ar);
|
||||
BKE_area_region_free(st, region);
|
||||
BLI_freelinkN(regionbase, region);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1234,7 +1234,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
ARegion *ar_main;
|
||||
ListBase *regionbase;
|
||||
SpaceSeq *sseq = (SpaceSeq *)sl;
|
||||
@@ -1259,9 +1259,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
|
||||
BLI_insertlinkbefore(regionbase, ar_main, ar);
|
||||
sequencer_init_preview_region(ar);
|
||||
region = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
|
||||
BLI_insertlinkbefore(regionbase, ar_main, region);
|
||||
sequencer_init_preview_region(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1367,7 +1367,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
ListBase *regionbase;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
if (sl == sa->spacedata.first) {
|
||||
regionbase = &sa->regionbase;
|
||||
@@ -1377,10 +1377,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
}
|
||||
|
||||
if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
|
||||
for (ar = (ARegion *)regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f;
|
||||
ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
|
||||
for (region = (ARegion *)regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
region->v2d.cur.ymax = region->v2d.tot.ymax = 0.0f;
|
||||
region->v2d.cur.ymin = region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1582,7 +1582,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
if (sl->spacetype == SPACE_NODE) {
|
||||
SpaceNode *snode = (SpaceNode *)sl;
|
||||
ListBase *regionbase;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
if (sl == sa->spacedata.first) {
|
||||
regionbase = &sa->regionbase;
|
||||
@@ -1598,13 +1598,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
snode->v2d.maxzoom = 2.31f;
|
||||
}
|
||||
|
||||
for (ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (ar->v2d.minzoom > 0.09f) {
|
||||
ar->v2d.minzoom = 0.09f;
|
||||
for (region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (region->v2d.minzoom > 0.09f) {
|
||||
region->v2d.minzoom = 0.09f;
|
||||
}
|
||||
if (ar->v2d.maxzoom < 2.31f) {
|
||||
ar->v2d.maxzoom = 2.31f;
|
||||
if (region->v2d.maxzoom < 2.31f) {
|
||||
region->v2d.maxzoom = 2.31f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1857,19 +1857,20 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_INFO) {
|
||||
SpaceInfo *sinfo = (SpaceInfo *)sl;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
sinfo->rpt_mask = INFO_RPT_OP;
|
||||
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
ar->v2d.scroll = (V2D_SCROLL_RIGHT);
|
||||
ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
|
||||
ar->v2d.keepofs = V2D_LOCKOFS_X;
|
||||
ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM |
|
||||
V2D_KEEPASPECT);
|
||||
ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
|
||||
ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
|
||||
for (region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
region->v2d.scroll = (V2D_SCROLL_RIGHT);
|
||||
region->v2d.align = V2D_ALIGN_NO_NEG_X |
|
||||
V2D_ALIGN_NO_NEG_Y; /* align bottom left */
|
||||
region->v2d.keepofs = V2D_LOCKOFS_X;
|
||||
region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM |
|
||||
V2D_KEEPASPECT);
|
||||
region->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
|
||||
region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2121,10 +2122,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl = sa->spacedata.first;
|
||||
if (sl->spacetype == SPACE_IMAGE) {
|
||||
ARegion *ar;
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
View2D *v2d = &ar->v2d;
|
||||
ARegion *region;
|
||||
for (region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
View2D *v2d = ®ion->v2d;
|
||||
v2d->minzoom = v2d->maxzoom = v2d->scroll = v2d->keeptot = v2d->keepzoom =
|
||||
v2d->keepofs = v2d->align = 0;
|
||||
}
|
||||
@@ -2133,10 +2134,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_IMAGE) {
|
||||
ARegion *ar;
|
||||
for (ar = sl->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
View2D *v2d = &ar->v2d;
|
||||
ARegion *region;
|
||||
for (region = sl->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
View2D *v2d = ®ion->v2d;
|
||||
v2d->minzoom = v2d->maxzoom = v2d->scroll = v2d->keeptot = v2d->keepzoom =
|
||||
v2d->keepofs = v2d->align = 0;
|
||||
}
|
||||
@@ -2179,22 +2180,22 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl = sa->spacedata.first;
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
ARegion *ar;
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (ar->v2d.min[1] == 4.0f) {
|
||||
ar->v2d.min[1] = 0.5f;
|
||||
ARegion *region;
|
||||
for (region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (region->v2d.min[1] == 4.0f) {
|
||||
region->v2d.min[1] = 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
ARegion *ar;
|
||||
for (ar = sl->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (ar->v2d.min[1] == 4.0f) {
|
||||
ar->v2d.min[1] = 0.5f;
|
||||
ARegion *region;
|
||||
for (region = sl->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (region->v2d.min[1] == 4.0f) {
|
||||
region->v2d.min[1] = 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1198,15 +1198,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_CLIP) {
|
||||
SpaceClip *sclip = (SpaceClip *)sl;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
bool hide = false;
|
||||
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_PREVIEW) {
|
||||
if (ar->alignment != RGN_ALIGN_NONE) {
|
||||
ar->flag |= RGN_FLAG_HIDDEN;
|
||||
ar->v2d.flag &= ~V2D_IS_INITIALISED;
|
||||
ar->alignment = RGN_ALIGN_NONE;
|
||||
for (region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_PREVIEW) {
|
||||
if (region->alignment != RGN_ALIGN_NONE) {
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
region->v2d.flag &= ~V2D_IS_INITIALISED;
|
||||
region->alignment = RGN_ALIGN_NONE;
|
||||
|
||||
hide = true;
|
||||
}
|
||||
@@ -2263,26 +2263,26 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
/* add missing (+) expander in node editor */
|
||||
for (sc = bmain->screens.first; sc; sc = sc->id.next) {
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
ARegion *ar, *arnew;
|
||||
ARegion *region, *arnew;
|
||||
|
||||
if (sa->spacetype == SPACE_NODE) {
|
||||
ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
|
||||
region = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
|
||||
|
||||
if (ar) {
|
||||
if (region) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* add subdiv level; after header */
|
||||
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
|
||||
region = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
|
||||
|
||||
/* is error! */
|
||||
if (ar == NULL) {
|
||||
if (region == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
arnew = MEM_callocN(sizeof(ARegion), "node tools");
|
||||
|
||||
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
|
||||
BLI_insertlinkafter(&sa->regionbase, region, arnew);
|
||||
arnew->regiontype = RGN_TYPE_TOOLS;
|
||||
arnew->alignment = RGN_ALIGN_LEFT;
|
||||
|
||||
@@ -2551,7 +2551,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
|
||||
for (space_link = sa->spacedata.first; space_link; space_link = space_link->next) {
|
||||
if (space_link->spacetype == SPACE_IMAGE) {
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
ListBase *lb;
|
||||
|
||||
if (space_link == sa->spacedata.first) {
|
||||
@@ -2561,13 +2561,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
lb = &space_link->regionbase;
|
||||
}
|
||||
|
||||
for (ar = lb->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_PREVIEW) {
|
||||
ar->regiontype = RGN_TYPE_TOOLS;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
for (region = lb->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_PREVIEW) {
|
||||
region->regiontype = RGN_TYPE_TOOLS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
}
|
||||
else if (ar->regiontype == RGN_TYPE_UI) {
|
||||
ar->alignment = RGN_ALIGN_RIGHT;
|
||||
else if (region->regiontype == RGN_TYPE_UI) {
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,18 +233,18 @@ static void do_version_constraints_stretch_to_limits(ListBase *lb)
|
||||
|
||||
static void do_version_action_editor_properties_region(ListBase *regionbase)
|
||||
{
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
for (ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_UI) {
|
||||
for (region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_UI) {
|
||||
/* already exists */
|
||||
return;
|
||||
}
|
||||
else if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
else if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
/* add new region here */
|
||||
ARegion *arnew = MEM_callocN(sizeof(ARegion), "buttons for action");
|
||||
|
||||
BLI_insertlinkbefore(regionbase, ar, arnew);
|
||||
BLI_insertlinkbefore(regionbase, region, arnew);
|
||||
|
||||
arnew->regiontype = RGN_TYPE_UI;
|
||||
arnew->alignment = RGN_ALIGN_RIGHT;
|
||||
@@ -527,11 +527,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
SpaceLink *sl;
|
||||
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
|
||||
for (ar = lb->first; ar; ar = ar->next) {
|
||||
BLI_listbase_clear(&ar->ui_previews);
|
||||
for (region = lb->first; region; region = region->next) {
|
||||
BLI_listbase_clear(®ion->ui_previews);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -855,18 +855,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
bScreen *scr;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
/* Make sure sequencer preview area limits zoom */
|
||||
for (scr = bmain->screens.first; scr; scr = scr->id.next) {
|
||||
for (sa = scr->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
for (ar = sl->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_PREVIEW) {
|
||||
ar->v2d.keepzoom |= V2D_LIMITZOOM;
|
||||
ar->v2d.minzoom = 0.001f;
|
||||
ar->v2d.maxzoom = 1000.0f;
|
||||
for (region = sl->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_PREVIEW) {
|
||||
region->v2d.keepzoom |= V2D_LIMITZOOM;
|
||||
region->v2d.minzoom = 0.001f;
|
||||
region->v2d.maxzoom = 1000.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1069,12 +1069,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
SpaceLink *sl;
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
for (ar = lb->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (ar->regiondata) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
for (region = lb->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (region->regiondata) {
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
if (rv3d->view == RV3D_VIEW_PERSPORTHO) {
|
||||
rv3d->view = RV3D_VIEW_USER;
|
||||
}
|
||||
@@ -1256,11 +1256,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
SpaceSeq *sseq = (SpaceSeq *)sl;
|
||||
if (sseq->view == SEQ_VIEW_SEQUENCE) {
|
||||
for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
|
||||
for (ARegion *region = regionbase->first; region; region = region->next) {
|
||||
/* remove preview region for sequencer-only view! */
|
||||
if (ar->regiontype == RGN_TYPE_PREVIEW) {
|
||||
ar->flag |= RGN_FLAG_HIDDEN;
|
||||
ar->alignment = RGN_ALIGN_NONE;
|
||||
if (region->regiontype == RGN_TYPE_PREVIEW) {
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
region->alignment = RGN_ALIGN_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1268,11 +1268,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
/* Remove old deprecated region from filebrowsers */
|
||||
else if (sl->spacetype == SPACE_FILE) {
|
||||
for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_CHANNELS) {
|
||||
for (ARegion *region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_CHANNELS) {
|
||||
/* Free old deprecated 'channel' region... */
|
||||
BKE_area_region_free(NULL, ar);
|
||||
BLI_freelinkN(regionbase, ar);
|
||||
BKE_area_region_free(NULL, region);
|
||||
BLI_freelinkN(regionbase, region);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,27 +595,27 @@ static void do_versions_fix_annotations(bGPdata *gpd)
|
||||
}
|
||||
}
|
||||
|
||||
static void do_versions_remove_region(ListBase *regionbase, ARegion *ar)
|
||||
static void do_versions_remove_region(ListBase *regionbase, ARegion *region)
|
||||
{
|
||||
BLI_freelinkN(regionbase, ar);
|
||||
BLI_freelinkN(regionbase, region);
|
||||
}
|
||||
|
||||
static void do_versions_remove_regions_by_type(ListBase *regionbase, int regiontype)
|
||||
{
|
||||
ARegion *ar, *ar_next;
|
||||
for (ar = regionbase->first; ar; ar = ar_next) {
|
||||
ar_next = ar->next;
|
||||
if (ar->regiontype == regiontype) {
|
||||
do_versions_remove_region(regionbase, ar);
|
||||
ARegion *region, *ar_next;
|
||||
for (region = regionbase->first; region; region = ar_next) {
|
||||
ar_next = region->next;
|
||||
if (region->regiontype == regiontype) {
|
||||
do_versions_remove_region(regionbase, region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ARegion *do_versions_find_region_or_null(ListBase *regionbase, int regiontype)
|
||||
{
|
||||
for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == regiontype) {
|
||||
return ar;
|
||||
for (ARegion *region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == regiontype) {
|
||||
return region;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -623,18 +623,18 @@ static ARegion *do_versions_find_region_or_null(ListBase *regionbase, int region
|
||||
|
||||
static ARegion *do_versions_find_region(ListBase *regionbase, int regiontype)
|
||||
{
|
||||
ARegion *ar = do_versions_find_region_or_null(regionbase, regiontype);
|
||||
if (ar == NULL) {
|
||||
ARegion *region = do_versions_find_region_or_null(regionbase, regiontype);
|
||||
if (region == NULL) {
|
||||
BLI_assert(!"Did not find expected region in versioning");
|
||||
}
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
static ARegion *do_versions_add_region(int regiontype, const char *name)
|
||||
{
|
||||
ARegion *ar = MEM_callocN(sizeof(ARegion), name);
|
||||
ar->regiontype = regiontype;
|
||||
return ar;
|
||||
ARegion *region = MEM_callocN(sizeof(ARegion), name);
|
||||
region->regiontype = regiontype;
|
||||
return region;
|
||||
}
|
||||
|
||||
static void do_versions_area_ensure_tool_region(Main *bmain,
|
||||
@@ -646,13 +646,13 @@ static void do_versions_area_ensure_tool_region(Main *bmain,
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == space_type) {
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
|
||||
if (!ar) {
|
||||
ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
|
||||
if (!region) {
|
||||
ARegion *header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
|
||||
ar = do_versions_add_region(RGN_TYPE_TOOLS, "tools region");
|
||||
BLI_insertlinkafter(regionbase, header, ar);
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
ar->flag = region_flag;
|
||||
region = do_versions_add_region(RGN_TYPE_TOOLS, "tools region");
|
||||
BLI_insertlinkafter(regionbase, header, region);
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->flag = region_flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2899,9 +2899,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
* fine to always insert headers first. */
|
||||
BLI_assert(!do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER));
|
||||
|
||||
ARegion *ar = do_versions_add_region(RGN_TYPE_HEADER, "header 2.83.1 versioning");
|
||||
ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
BLI_addhead(regionbase, ar);
|
||||
ARegion *region = do_versions_add_region(RGN_TYPE_HEADER,
|
||||
"header 2.83.1 versioning");
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM :
|
||||
RGN_ALIGN_TOP;
|
||||
BLI_addhead(regionbase, region);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2913,7 +2915,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_PROPERTIES) {
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
ARegion *ar = MEM_callocN(sizeof(ARegion), "navigation bar for properties");
|
||||
ARegion *region = MEM_callocN(sizeof(ARegion), "navigation bar for properties");
|
||||
ARegion *ar_header = NULL;
|
||||
|
||||
for (ar_header = regionbase->first; ar_header; ar_header = ar_header->next) {
|
||||
@@ -2923,10 +2925,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
BLI_assert(ar_header);
|
||||
|
||||
BLI_insertlinkafter(regionbase, ar_header, ar);
|
||||
BLI_insertlinkafter(regionbase, ar_header, region);
|
||||
|
||||
ar->regiontype = RGN_TYPE_NAV_BAR;
|
||||
ar->alignment = RGN_ALIGN_LEFT;
|
||||
region->regiontype = RGN_TYPE_NAV_BAR;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3698,11 +3700,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
do_versions_remove_regions_by_type(regionbase, RGN_TYPE_FOOTER);
|
||||
|
||||
/* Add footer. */
|
||||
ARegion *ar = do_versions_add_region(RGN_TYPE_FOOTER, "footer for text");
|
||||
ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
|
||||
ARegion *region = do_versions_add_region(RGN_TYPE_FOOTER, "footer for text");
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
|
||||
|
||||
ARegion *ar_header = do_versions_find_region(regionbase, RGN_TYPE_HEADER);
|
||||
BLI_insertlinkafter(regionbase, ar_header, ar);
|
||||
BLI_insertlinkafter(regionbase, ar_header, region);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3788,20 +3790,22 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
/* All spaces that use tools must be eventually added. */
|
||||
ARegion *ar = NULL;
|
||||
ARegion *region = NULL;
|
||||
if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_SEQ) &&
|
||||
((ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER)) == NULL)) {
|
||||
((region = do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER)) ==
|
||||
NULL)) {
|
||||
/* Add tool header. */
|
||||
ar = do_versions_add_region(RGN_TYPE_TOOL_HEADER, "tool header");
|
||||
ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
region = do_versions_add_region(RGN_TYPE_TOOL_HEADER, "tool header");
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
ARegion *ar_header = do_versions_find_region(regionbase, RGN_TYPE_HEADER);
|
||||
BLI_insertlinkbefore(regionbase, ar_header, ar);
|
||||
BLI_insertlinkbefore(regionbase, ar_header, region);
|
||||
/* Hide by default, enable for painting workspaces (startup only). */
|
||||
ar->flag |= RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
region->flag |= RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
}
|
||||
if (ar != NULL) {
|
||||
SET_FLAG_FROM_TEST(ar->flag, ar->flag & RGN_FLAG_HIDDEN_BY_USER, RGN_FLAG_HIDDEN);
|
||||
if (region != NULL) {
|
||||
SET_FLAG_FROM_TEST(
|
||||
region->flag, region->flag & RGN_FLAG_HIDDEN_BY_USER, RGN_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3898,19 +3902,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
if (ELEM(sl->spacetype, SPACE_CLIP, SPACE_GRAPH, SPACE_SEQ)) {
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
|
||||
ARegion *ar = NULL;
|
||||
ARegion *region = NULL;
|
||||
if (sl->spacetype == SPACE_CLIP) {
|
||||
if (((SpaceClip *)sl)->view == SC_VIEW_GRAPH) {
|
||||
ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_PREVIEW);
|
||||
region = do_versions_find_region_or_null(regionbase, RGN_TYPE_PREVIEW);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_WINDOW);
|
||||
region = do_versions_find_region_or_null(regionbase, RGN_TYPE_WINDOW);
|
||||
}
|
||||
|
||||
if (ar != NULL) {
|
||||
ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
|
||||
ar->v2d.scroll |= V2D_SCROLL_RIGHT;
|
||||
if (region != NULL) {
|
||||
region->v2d.scroll &= ~V2D_SCROLL_LEFT;
|
||||
region->v2d.scroll |= V2D_SCROLL_RIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4049,9 +4053,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_TEXT) {
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
ARegion *ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_UI);
|
||||
if (ar) {
|
||||
ar->alignment = RGN_ALIGN_RIGHT;
|
||||
ARegion *region = do_versions_find_region_or_null(regionbase, RGN_TYPE_UI);
|
||||
if (region) {
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
}
|
||||
}
|
||||
/* Mark outliners as dirty for syncing and enable synced selection */
|
||||
|
||||
@@ -101,11 +101,11 @@ static void blo_update_defaults_screen(bScreen *screen,
|
||||
{
|
||||
/* For all app templates. */
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
/* Some toolbars have been saved as initialized,
|
||||
* we don't want them to have odd zoom-level or scrolling set, see: T47047 */
|
||||
if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
|
||||
ar->v2d.flag &= ~V2D_IS_INITIALISED;
|
||||
if (ELEM(region->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
|
||||
region->v2d.flag &= ~V2D_IS_INITIALISED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,15 +130,15 @@ static void blo_update_defaults_screen(bScreen *screen,
|
||||
}
|
||||
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
/* Remove all stored panels, we want to use defaults
|
||||
* (order, open/closed) as defined by UI code here! */
|
||||
BKE_area_region_panels_free(&ar->panels);
|
||||
BLI_freelistN(&ar->panels_category_active);
|
||||
BKE_area_region_panels_free(®ion->panels);
|
||||
BLI_freelistN(®ion->panels_category_active);
|
||||
|
||||
/* Reset size so it uses consistent defaults from the region types. */
|
||||
ar->sizex = 0;
|
||||
ar->sizey = 0;
|
||||
region->sizex = 0;
|
||||
region->sizey = 0;
|
||||
}
|
||||
|
||||
if (sa->spacetype == SPACE_IMAGE) {
|
||||
@@ -156,9 +156,9 @@ static void blo_update_defaults_screen(bScreen *screen,
|
||||
if (saction->mode == SACTCONT_TIMELINE) {
|
||||
saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
|
||||
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_CHANNELS) {
|
||||
ar->flag |= RGN_FLAG_HIDDEN;
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_CHANNELS) {
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,13 +213,13 @@ static void blo_update_defaults_screen(bScreen *screen,
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
|
||||
for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
|
||||
for (ARegion *region = regionbase->first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
|
||||
if ((sl->spacetype == SPACE_IMAGE) && hide_image_tool_header) {
|
||||
ar->flag |= RGN_FLAG_HIDDEN;
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
}
|
||||
else {
|
||||
ar->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
|
||||
region->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,7 @@ static void blo_update_defaults_screen(bScreen *screen,
|
||||
/* 2D animation template. */
|
||||
if (app_template && STREQ(app_template, "2D_Animation")) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
if (sa->spacetype == SPACE_ACTION) {
|
||||
SpaceAction *saction = sa->spacedata.first;
|
||||
/* Enable Sliders. */
|
||||
@@ -266,7 +266,7 @@ void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_templat
|
||||
bScreen *screen = layout->screen;
|
||||
if (screen) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
if (sa->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = sa->spacedata.first;
|
||||
v3d->shading.flag &= ~V3D_SHADING_CAVITY;
|
||||
|
||||
@@ -2756,19 +2756,19 @@ static void write_gpencil(WriteData *wd, bGPdata *gpd)
|
||||
}
|
||||
}
|
||||
|
||||
static void write_region(WriteData *wd, ARegion *ar, int spacetype)
|
||||
static void write_region(WriteData *wd, ARegion *region, int spacetype)
|
||||
{
|
||||
writestruct(wd, DATA, ARegion, 1, ar);
|
||||
writestruct(wd, DATA, ARegion, 1, region);
|
||||
|
||||
if (ar->regiondata) {
|
||||
if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||
if (region->regiondata) {
|
||||
if (region->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (spacetype) {
|
||||
case SPACE_VIEW3D:
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
writestruct(wd, DATA, RegionView3D, 1, rv3d);
|
||||
|
||||
if (rv3d->localvd) {
|
||||
|
||||
@@ -63,7 +63,7 @@ typedef struct DRWUpdateContext {
|
||||
struct Depsgraph *depsgraph;
|
||||
struct Scene *scene;
|
||||
struct ViewLayer *view_layer;
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
struct View3D *v3d;
|
||||
struct RenderEngineType *engine_type;
|
||||
} DRWUpdateContext;
|
||||
@@ -81,24 +81,24 @@ void DRW_draw_region_engine_info(int xoffset, int yoffset);
|
||||
|
||||
void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
|
||||
struct RenderEngineType *engine_type,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
struct GPUViewport *viewport,
|
||||
const struct bContext *evil_C);
|
||||
void DRW_draw_render_loop(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
struct GPUViewport *viewport);
|
||||
void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
|
||||
struct RenderEngineType *engine_type,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const bool draw_background,
|
||||
const bool do_color_management,
|
||||
struct GPUOffScreen *ofs,
|
||||
struct GPUViewport *viewport);
|
||||
void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
bool use_obedit_skip,
|
||||
bool draw_surface,
|
||||
@@ -109,20 +109,20 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
||||
DRW_ObjectFilterFn object_filter_fn,
|
||||
void *object_filter_user_data);
|
||||
void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
struct GPUViewport *viewport,
|
||||
bool use_opengl_context);
|
||||
void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
struct GPUViewport *viewport);
|
||||
void DRW_draw_depth_object(struct ARegion *ar,
|
||||
void DRW_draw_depth_object(struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
struct GPUViewport *viewport,
|
||||
struct Object *object);
|
||||
void DRW_draw_select_id(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const struct rcti *rect);
|
||||
|
||||
|
||||
@@ -90,34 +90,34 @@ uint DRW_select_buffer_context_offset_for_object_elem(struct Depsgraph *depsgrap
|
||||
struct Object *object,
|
||||
char elem_type);
|
||||
uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const rcti *rect,
|
||||
uint *r_buf_len);
|
||||
uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const struct rcti *rect,
|
||||
uint *r_bitmap_len);
|
||||
uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int center[2],
|
||||
const int radius,
|
||||
uint *r_bitmap_len);
|
||||
uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int poly[][2],
|
||||
const int poly_len,
|
||||
const struct rcti *rect,
|
||||
uint *r_bitmap_len);
|
||||
uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int center[2]);
|
||||
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int center[2],
|
||||
const uint id_min,
|
||||
|
||||
@@ -88,7 +88,7 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
|
||||
rect = &fallback_rect;
|
||||
}
|
||||
else {
|
||||
rect = ED_region_visible_rect(draw_ctx->ar);
|
||||
rect = ED_region_visible_rect(draw_ctx->region);
|
||||
}
|
||||
|
||||
/* Make the viewport width scale the lookdev spheres a bit.
|
||||
|
||||
@@ -48,7 +48,7 @@ static struct {
|
||||
extern char datatoc_effect_motion_blur_frag_glsl[];
|
||||
|
||||
static void eevee_motion_blur_camera_get_matrix_at_time(Scene *scene,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
RegionView3D *rv3d,
|
||||
View3D *v3d,
|
||||
Object *camera,
|
||||
@@ -83,7 +83,7 @@ static void eevee_motion_blur_camera_get_matrix_at_time(Scene *scene,
|
||||
|
||||
if (v3d != NULL) {
|
||||
BKE_camera_params_from_view3d(¶ms, draw_ctx->depsgraph, v3d, rv3d);
|
||||
BKE_camera_params_compute_viewplane(¶ms, ar->winx, ar->winy, 1.0f, 1.0f);
|
||||
BKE_camera_params_compute_viewplane(¶ms, region->winx, region->winy, 1.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
BKE_camera_params_from_object(¶ms, &cam_cpy);
|
||||
@@ -115,7 +115,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
|
||||
|
||||
View3D *v3d = draw_ctx->v3d;
|
||||
RegionView3D *rv3d = draw_ctx->rv3d;
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
|
||||
if (scene_eval->eevee.flag & SCE_EEVEE_MOTION_BLUR_ENABLED) {
|
||||
/* Update Motion Blur Matrices */
|
||||
@@ -151,7 +151,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
|
||||
/* Current matrix */
|
||||
if (effects->motion_blur_mat_cached == false) {
|
||||
eevee_motion_blur_camera_get_matrix_at_time(
|
||||
scene, ar, rv3d, v3d, ob_camera_eval, ctime, effects->current_world_to_ndc);
|
||||
scene, region, rv3d, v3d, ob_camera_eval, ctime, effects->current_world_to_ndc);
|
||||
}
|
||||
|
||||
/* Only continue if camera is not being keyed */
|
||||
@@ -160,12 +160,12 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
|
||||
/* Past matrix */
|
||||
if (effects->motion_blur_mat_cached == false) {
|
||||
eevee_motion_blur_camera_get_matrix_at_time(
|
||||
scene, ar, rv3d, v3d, ob_camera_eval, ctime - delta, effects->past_world_to_ndc);
|
||||
scene, region, rv3d, v3d, ob_camera_eval, ctime - delta, effects->past_world_to_ndc);
|
||||
|
||||
#if 0 /* for future high quality blur */
|
||||
/* Future matrix */
|
||||
eevee_motion_blur_camera_get_matrix_at_time(
|
||||
scene, ar, rv3d, v3d, ob_camera_eval, ctime + delta, effects->future_world_to_ndc);
|
||||
scene, region, rv3d, v3d, ob_camera_eval, ctime + delta, effects->future_world_to_ndc);
|
||||
#endif
|
||||
invert_m4_m4(effects->current_ndc_to_world, effects->current_world_to_ndc);
|
||||
}
|
||||
|
||||
+4
-4
@@ -100,7 +100,7 @@ static void external_engine_init(void *vedata)
|
||||
{
|
||||
EXTERNAL_StorageList *stl = ((EXTERNAL_Data *)vedata)->stl;
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
|
||||
/* Depth prepass */
|
||||
if (!e_data.depth_sh) {
|
||||
@@ -117,7 +117,7 @@ static void external_engine_init(void *vedata)
|
||||
|
||||
/* Progressive render samples are tagged with no rebuild, in that case we
|
||||
* can skip updating the depth buffer */
|
||||
if (ar && (ar->do_draw & RGN_DRAW_NO_REBUILD)) {
|
||||
if (region && (region->do_draw & RGN_DRAW_NO_REBUILD)) {
|
||||
stl->g_data->update_depth = false;
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ static void external_draw_scene_do(void *vedata)
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
Scene *scene = draw_ctx->scene;
|
||||
RegionView3D *rv3d = draw_ctx->rv3d;
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
RenderEngineType *type;
|
||||
|
||||
DRW_state_reset_ex(DRW_STATE_DEFAULT & ~DRW_STATE_DEPTH_LESS_EQUAL);
|
||||
@@ -205,7 +205,7 @@ static void external_draw_scene_do(void *vedata)
|
||||
/* Rendered draw. */
|
||||
GPU_matrix_push_projection();
|
||||
GPU_matrix_push();
|
||||
ED_region_pixelspace(ar);
|
||||
ED_region_pixelspace(region);
|
||||
|
||||
/* Render result draw. */
|
||||
type = rv3d->render_engine->type;
|
||||
|
||||
@@ -379,7 +379,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
Scene *scene = draw_ctx->scene;
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
RegionView3D *rv3d = draw_ctx->rv3d;
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
Object *ob = draw_ctx->obact;
|
||||
@@ -413,13 +413,13 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
|
||||
ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin);
|
||||
|
||||
for (int i = 0; i < totpoints; i++, tpt++) {
|
||||
ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
|
||||
ED_gpencil_tpoint_to_point(region, origin, tpt, &pt);
|
||||
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt);
|
||||
|
||||
/* first point for adjacency (not drawn) */
|
||||
if (i == 0) {
|
||||
if (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC && totpoints > 2) {
|
||||
ED_gpencil_tpoint_to_point(ar, origin, &points[totpoints - 1], &pt2);
|
||||
ED_gpencil_tpoint_to_point(region, origin, &points[totpoints - 1], &pt2);
|
||||
gpencil_set_stroke_point(vbo,
|
||||
&pt2,
|
||||
idx,
|
||||
@@ -432,7 +432,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
|
||||
idx++;
|
||||
}
|
||||
else {
|
||||
ED_gpencil_tpoint_to_point(ar, origin, &points[1], &pt2);
|
||||
ED_gpencil_tpoint_to_point(region, origin, &points[1], &pt2);
|
||||
gpencil_set_stroke_point(vbo,
|
||||
&pt2,
|
||||
idx,
|
||||
@@ -455,19 +455,19 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
|
||||
/* last adjacency point (not drawn) */
|
||||
if (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC && totpoints > 2) {
|
||||
/* draw line to first point to complete the cycle */
|
||||
ED_gpencil_tpoint_to_point(ar, origin, &points[0], &pt2);
|
||||
ED_gpencil_tpoint_to_point(region, origin, &points[0], &pt2);
|
||||
gpencil_set_stroke_point(
|
||||
vbo, &pt2, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
|
||||
idx++;
|
||||
/* now add adjacency point (not drawn) */
|
||||
ED_gpencil_tpoint_to_point(ar, origin, &points[1], &pt3);
|
||||
ED_gpencil_tpoint_to_point(region, origin, &points[1], &pt3);
|
||||
gpencil_set_stroke_point(
|
||||
vbo, &pt3, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
|
||||
idx++;
|
||||
}
|
||||
/* last adjacency point (not drawn) */
|
||||
else {
|
||||
ED_gpencil_tpoint_to_point(ar, origin, &points[totpoints - 2], &pt2);
|
||||
ED_gpencil_tpoint_to_point(region, origin, &points[totpoints - 2], &pt2);
|
||||
gpencil_set_stroke_point(
|
||||
vbo, &pt2, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
|
||||
idx++;
|
||||
@@ -481,7 +481,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
Scene *scene = draw_ctx->scene;
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
RegionView3D *rv3d = draw_ctx->rv3d;
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
Object *ob = draw_ctx->obact;
|
||||
@@ -513,7 +513,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
|
||||
ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin);
|
||||
|
||||
for (int i = 0; i < totpoints; i++, tpt++) {
|
||||
ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
|
||||
ED_gpencil_tpoint_to_point(region, origin, tpt, &pt);
|
||||
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt);
|
||||
|
||||
/* use previous point to determine stroke direction (drawing path) */
|
||||
@@ -524,7 +524,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
|
||||
if (totpoints > 1) {
|
||||
/* extrapolate a point before first point */
|
||||
tGPspoint *tpt2 = &points[1];
|
||||
ED_gpencil_tpoint_to_point(ar, origin, tpt2, &pt2);
|
||||
ED_gpencil_tpoint_to_point(region, origin, tpt2, &pt2);
|
||||
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt2);
|
||||
|
||||
interp_v3_v3v3(ref_pt, &pt2.x, &pt.x, 1.5f);
|
||||
@@ -535,7 +535,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
|
||||
}
|
||||
else {
|
||||
tGPspoint *tpt2 = &points[i - 1];
|
||||
ED_gpencil_tpoint_to_point(ar, origin, tpt2, &pt2);
|
||||
ED_gpencil_tpoint_to_point(region, origin, tpt2, &pt2);
|
||||
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt2);
|
||||
|
||||
copy_v3_v3(ref_pt, &pt2.x);
|
||||
@@ -638,7 +638,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
|
||||
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
Scene *scene = draw_ctx->scene;
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
Object *ob = draw_ctx->obact;
|
||||
|
||||
@@ -684,7 +684,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
|
||||
for (int i = 0; i < tot_triangles; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
tpt = &points[tmp_triangles[i][j]];
|
||||
ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
|
||||
ED_gpencil_tpoint_to_point(region, origin, tpt, &pt);
|
||||
GPU_vertbuf_attr_set(vbo, pos_id, idx, &pt.x);
|
||||
GPU_vertbuf_attr_set(vbo, color_id, idx, gpd->runtime.sfill);
|
||||
idx++;
|
||||
|
||||
@@ -739,7 +739,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
|
||||
|
||||
bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);
|
||||
if ((draw_ctx->obact == ob) &&
|
||||
((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->ar))) {
|
||||
((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->region))) {
|
||||
gpencil_populate_buffer_strokes(&e_data, vedata, ts, ob);
|
||||
}
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
|
||||
|
||||
if (DRW_state_show_text() && (pd->edit_mesh.flag & OVERLAY_EDIT_TEXT)) {
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
DRW_text_edit_mesh_measure_stats(draw_ctx->ar, draw_ctx->v3d, ob, &draw_ctx->scene->unit);
|
||||
DRW_text_edit_mesh_measure_stats(draw_ctx->region, draw_ctx->v3d, ob, &draw_ctx->scene->unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ static void select_engine_init(void *vedata)
|
||||
DRW_view_viewmat_get(view_default, viewmat, false);
|
||||
DRW_view_winmat_get(view_default, winmat, false);
|
||||
projmat_from_subregion(winmat,
|
||||
(int[2]){draw_ctx->ar->winx, draw_ctx->ar->winy},
|
||||
(int[2]){draw_ctx->region->winx, draw_ctx->region->winy},
|
||||
e_data.context.last_rect.xmin,
|
||||
e_data.context.last_rect.xmax,
|
||||
e_data.context.last_rect.ymin,
|
||||
|
||||
@@ -634,7 +634,7 @@ bool DRW_state_draw_background(void);
|
||||
/* Avoid too many lookups while drawing */
|
||||
typedef struct DRWContextState {
|
||||
|
||||
struct ARegion *ar; /* 'CTX_wm_region(C)' */
|
||||
struct ARegion *region; /* 'CTX_wm_region(C)' */
|
||||
struct RegionView3D *rv3d; /* 'CTX_wm_region_view3d(C)' */
|
||||
struct View3D *v3d; /* 'CTX_wm_view3d(C)' */
|
||||
|
||||
|
||||
@@ -1061,7 +1061,7 @@ static void drw_engines_draw_text(void)
|
||||
PROFILE_START(stime);
|
||||
|
||||
if (data->text_draw_cache) {
|
||||
DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar, DST.draw_ctx.v3d);
|
||||
DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.region, DST.draw_ctx.v3d);
|
||||
}
|
||||
|
||||
PROFILE_END_UPDATE(data->render_time, stime);
|
||||
@@ -1226,9 +1226,9 @@ static bool drw_gpencil_engine_needed(Depsgraph *depsgraph, View3D *v3d)
|
||||
void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
|
||||
{
|
||||
RenderEngineType *engine_type = update_ctx->engine_type;
|
||||
ARegion *ar = update_ctx->ar;
|
||||
ARegion *region = update_ctx->region;
|
||||
View3D *v3d = update_ctx->v3d;
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
Depsgraph *depsgraph = update_ctx->depsgraph;
|
||||
Scene *scene = update_ctx->scene;
|
||||
ViewLayer *view_layer = update_ctx->view_layer;
|
||||
@@ -1237,7 +1237,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
|
||||
|
||||
/* Separate update for each stereo view. */
|
||||
for (int view = 0; view < 2; view++) {
|
||||
GPUViewport *viewport = WM_draw_region_get_viewport(ar, view);
|
||||
GPUViewport *viewport = WM_draw_region_get_viewport(region, view);
|
||||
if (!viewport) {
|
||||
continue;
|
||||
}
|
||||
@@ -1252,7 +1252,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
|
||||
|
||||
DST.viewport = viewport;
|
||||
DST.draw_ctx = (DRWContextState){
|
||||
.ar = ar,
|
||||
.region = region,
|
||||
.rv3d = rv3d,
|
||||
.v3d = v3d,
|
||||
.scene = scene,
|
||||
@@ -1297,7 +1297,7 @@ void DRW_draw_callbacks_pre_scene(void)
|
||||
GPU_matrix_set(rv3d->viewmat);
|
||||
|
||||
if (DST.draw_ctx.evil_C) {
|
||||
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_PRE_VIEW);
|
||||
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_PRE_VIEW);
|
||||
DRW_state_reset();
|
||||
}
|
||||
}
|
||||
@@ -1305,7 +1305,7 @@ void DRW_draw_callbacks_pre_scene(void)
|
||||
void DRW_draw_callbacks_post_scene(void)
|
||||
{
|
||||
RegionView3D *rv3d = DST.draw_ctx.rv3d;
|
||||
ARegion *ar = DST.draw_ctx.ar;
|
||||
ARegion *region = DST.draw_ctx.region;
|
||||
View3D *v3d = DST.draw_ctx.v3d;
|
||||
Depsgraph *depsgraph = DST.draw_ctx.depsgraph;
|
||||
|
||||
@@ -1330,14 +1330,14 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
if (do_annotations) {
|
||||
GPU_depth_test(false);
|
||||
/* XXX: as scene->gpd is not copied for COW yet */
|
||||
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, true);
|
||||
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, true);
|
||||
GPU_depth_test(true);
|
||||
}
|
||||
|
||||
drw_debug_draw();
|
||||
|
||||
GPU_depth_test(false);
|
||||
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_POST_VIEW);
|
||||
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_POST_VIEW);
|
||||
|
||||
/* Callback can be nasty and do whatever they want with the state.
|
||||
* Don't trust them! */
|
||||
@@ -1359,7 +1359,7 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (do_annotations)) {
|
||||
GPU_depth_test(false);
|
||||
/* XXX: as scene->gpd is not copied for COW yet */
|
||||
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, false);
|
||||
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, false);
|
||||
}
|
||||
|
||||
if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
|
||||
@@ -1372,7 +1372,7 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
if (G.debug_value > 20 && G.debug_value < 30) {
|
||||
GPU_depth_test(false);
|
||||
/* local coordinate visible rect inside region, to accommodate overlapping ui */
|
||||
const rcti *rect = ED_region_visible_rect(DST.draw_ctx.ar);
|
||||
const rcti *rect = ED_region_visible_rect(DST.draw_ctx.region);
|
||||
DRW_stats_draw(rect);
|
||||
}
|
||||
|
||||
@@ -1401,11 +1401,11 @@ struct DRWTextStore *DRW_text_cache_ensure(void)
|
||||
void DRW_draw_view(const bContext *C)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
|
||||
GPUViewport *viewport = WM_draw_region_get_bound_viewport(ar);
|
||||
GPUViewport *viewport = WM_draw_region_get_bound_viewport(region);
|
||||
|
||||
/* Reset before using it. */
|
||||
drw_state_prepare_clean_for_draw(&DST);
|
||||
@@ -1414,7 +1414,7 @@ void DRW_draw_view(const bContext *C)
|
||||
DST.options.draw_background = (scene->r.alphamode == R_ADDSKY) ||
|
||||
(v3d->shading.type != OB_RENDER);
|
||||
DST.options.do_color_management = true;
|
||||
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C);
|
||||
DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, viewport, C);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1423,7 +1423,7 @@ void DRW_draw_view(const bContext *C)
|
||||
*/
|
||||
void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
|
||||
RenderEngineType *engine_type,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport,
|
||||
const bContext *evil_C)
|
||||
@@ -1431,14 +1431,14 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
|
||||
|
||||
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
DST.draw_ctx.evil_C = evil_C;
|
||||
DST.viewport = viewport;
|
||||
|
||||
/* Setup viewport */
|
||||
DST.draw_ctx = (DRWContextState){
|
||||
.ar = ar,
|
||||
.region = region,
|
||||
.rv3d = rv3d,
|
||||
.v3d = v3d,
|
||||
.scene = scene,
|
||||
@@ -1535,7 +1535,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
|
||||
|
||||
DRW_draw_callbacks_post_scene();
|
||||
|
||||
if (WM_draw_region_get_bound_viewport(ar)) {
|
||||
if (WM_draw_region_get_bound_viewport(region)) {
|
||||
/* Don't unbind the framebuffer yet in this case and let
|
||||
* GPU_viewport_unbind do it, so that we can still do further
|
||||
* drawing of action zones on top. */
|
||||
@@ -1556,7 +1556,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
|
||||
}
|
||||
|
||||
void DRW_draw_render_loop(struct Depsgraph *depsgraph,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport)
|
||||
{
|
||||
@@ -1566,7 +1566,7 @@ void DRW_draw_render_loop(struct Depsgraph *depsgraph,
|
||||
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
|
||||
|
||||
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, NULL);
|
||||
DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, viewport, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1574,7 +1574,7 @@ void DRW_draw_render_loop(struct Depsgraph *depsgraph,
|
||||
*/
|
||||
void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
|
||||
RenderEngineType *engine_type,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
const bool draw_background,
|
||||
const bool do_color_management,
|
||||
@@ -1594,7 +1594,7 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
|
||||
DST.options.is_image_render = true;
|
||||
DST.options.do_color_management = do_color_management;
|
||||
DST.options.draw_background = draw_background;
|
||||
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, render_viewport, NULL);
|
||||
DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, render_viewport, NULL);
|
||||
|
||||
if (draw_background) {
|
||||
/* HACK(fclem): In this case we need to make sure the final alpha is 1.
|
||||
@@ -2005,7 +2005,7 @@ void DRW_render_instance_buffer_finish(void)
|
||||
* object mode select-loop, see: ED_view3d_draw_select_loop (legacy drawing).
|
||||
*/
|
||||
void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
bool UNUSED(use_obedit_skip),
|
||||
bool draw_surface,
|
||||
@@ -2022,9 +2022,9 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
||||
Object *obact = OBACT(view_layer);
|
||||
Object *obedit = OBEDIT_FROM_OBACT(obact);
|
||||
#ifndef USE_GPU_SELECT
|
||||
UNUSED_VARS(scene, view_layer, v3d, ar, rect);
|
||||
UNUSED_VARS(scene, view_layer, v3d, region, rect);
|
||||
#else
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
/* Reset before using it. */
|
||||
drw_state_prepare_clean_for_draw(&DST);
|
||||
@@ -2102,7 +2102,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
||||
|
||||
/* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
|
||||
DST.draw_ctx = (DRWContextState){
|
||||
.ar = ar,
|
||||
.region = region,
|
||||
.rv3d = rv3d,
|
||||
.v3d = v3d,
|
||||
.scene = scene,
|
||||
@@ -2242,7 +2242,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
||||
* object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing).
|
||||
*/
|
||||
static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport,
|
||||
const bool use_opengl_context)
|
||||
@@ -2250,7 +2250,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
|
||||
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
|
||||
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
if (use_opengl_context) {
|
||||
DRW_opengl_context_enable();
|
||||
@@ -2261,7 +2261,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
|
||||
|
||||
/* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
|
||||
DST.draw_ctx = (DRWContextState){
|
||||
.ar = ar,
|
||||
.region = region,
|
||||
.rv3d = rv3d,
|
||||
.v3d = v3d,
|
||||
.scene = scene,
|
||||
@@ -2347,7 +2347,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
|
||||
* object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing).
|
||||
*/
|
||||
void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport,
|
||||
bool use_opengl_context)
|
||||
@@ -2366,14 +2366,14 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
|
||||
}
|
||||
}
|
||||
|
||||
drw_draw_depth_loop_imp(depsgraph, ar, v3d, viewport, use_opengl_context);
|
||||
drw_draw_depth_loop_imp(depsgraph, region, v3d, viewport, use_opengl_context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converted from ED_view3d_draw_depth_gpencil (legacy drawing).
|
||||
*/
|
||||
void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport)
|
||||
{
|
||||
@@ -2382,10 +2382,10 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
|
||||
|
||||
use_drw_engine(&draw_engine_gpencil_type);
|
||||
|
||||
drw_draw_depth_loop_imp(depsgraph, ar, v3d, viewport, true);
|
||||
drw_draw_depth_loop_imp(depsgraph, region, v3d, viewport, true);
|
||||
}
|
||||
|
||||
void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rcti *rect)
|
||||
void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect)
|
||||
{
|
||||
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
|
||||
@@ -2395,8 +2395,8 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rc
|
||||
|
||||
/* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
|
||||
DST.draw_ctx = (DRWContextState){
|
||||
.ar = ar,
|
||||
.rv3d = ar->regiondata,
|
||||
.region = region,
|
||||
.rv3d = region->regiondata,
|
||||
.v3d = v3d,
|
||||
.scene = scene,
|
||||
.view_layer = view_layer,
|
||||
@@ -2407,7 +2407,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rc
|
||||
drw_context_state_init();
|
||||
|
||||
/* Setup viewport */
|
||||
DST.viewport = WM_draw_region_get_viewport(ar, 0);
|
||||
DST.viewport = WM_draw_region_get_viewport(region, 0);
|
||||
drw_viewport_var_init();
|
||||
|
||||
/* Update ubos */
|
||||
@@ -2463,9 +2463,9 @@ static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_
|
||||
/**
|
||||
* Clears the Depth Buffer and draws only the specified object.
|
||||
*/
|
||||
void DRW_draw_depth_object(ARegion *ar, View3D *v3d, GPUViewport *viewport, Object *object)
|
||||
void DRW_draw_depth_object(ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object)
|
||||
{
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
DRW_opengl_context_enable();
|
||||
GPU_matrix_projection_set(rv3d->winmat);
|
||||
|
||||
@@ -119,9 +119,9 @@ void DRW_text_cache_add(DRWTextStore *dt,
|
||||
}
|
||||
}
|
||||
|
||||
void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
|
||||
void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, struct View3D *v3d)
|
||||
{
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
ViewCachedString *vos;
|
||||
int tot = 0;
|
||||
|
||||
@@ -130,7 +130,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
|
||||
BLI_memiter_iter_init(dt->cache_strings, &it);
|
||||
while ((vos = BLI_memiter_iter_step(&it))) {
|
||||
if (ED_view3d_project_short_ex(
|
||||
ar,
|
||||
region,
|
||||
(vos->flag & DRW_TEXT_CACHE_GLOBALSPACE) ? rv3d->persmat : rv3d->persmatob,
|
||||
(vos->flag & DRW_TEXT_CACHE_LOCALCLIP) != 0,
|
||||
vos->vec,
|
||||
@@ -153,7 +153,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
|
||||
|
||||
float original_proj[4][4];
|
||||
GPU_matrix_projection_get(original_proj);
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_identity_set();
|
||||
@@ -192,7 +192,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
|
||||
}
|
||||
|
||||
/* Copied from drawobject.c */
|
||||
void DRW_text_edit_mesh_measure_stats(ARegion *ar,
|
||||
void DRW_text_edit_mesh_measure_stats(ARegion *region,
|
||||
View3D *v3d,
|
||||
Object *ob,
|
||||
const UnitSettings *unit)
|
||||
@@ -251,9 +251,9 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
|
||||
if (v3d->overlay.edit_flag &
|
||||
(V3D_OVERLAY_EDIT_EDGE_LEN | V3D_OVERLAY_EDIT_EDGE_ANG | V3D_OVERLAY_EDIT_INDICES)) {
|
||||
BoundBox bb;
|
||||
const rcti rect = {0, ar->winx, 0, ar->winy};
|
||||
const rcti rect = {0, region->winx, 0, region->winy};
|
||||
|
||||
ED_view3d_clipping_calc(&bb, clip_planes, ar, ob, &rect);
|
||||
ED_view3d_clipping_calc(&bb, clip_planes, region, ob, &rect);
|
||||
}
|
||||
|
||||
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) {
|
||||
|
||||
@@ -41,9 +41,9 @@ void DRW_text_cache_add(struct DRWTextStore *dt,
|
||||
short flag,
|
||||
const uchar col[4]);
|
||||
|
||||
void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *ar, struct View3D *v3d);
|
||||
void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *region, struct View3D *v3d);
|
||||
|
||||
void DRW_text_edit_mesh_measure_stats(struct ARegion *ar,
|
||||
void DRW_text_edit_mesh_measure_stats(struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
struct Object *ob,
|
||||
const struct UnitSettings *unit);
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
/* Main function to read a block of pixels from the select frame buffer. */
|
||||
uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const rcti *rect,
|
||||
uint *r_buf_len)
|
||||
@@ -59,9 +59,9 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
|
||||
/* Clamp rect. */
|
||||
rcti r = {
|
||||
.xmin = 0,
|
||||
.xmax = ar->winx,
|
||||
.xmax = region->winx,
|
||||
.ymin = 0,
|
||||
.ymax = ar->winy,
|
||||
.ymax = region->winy,
|
||||
};
|
||||
|
||||
/* Make sure that the rect is within the bounds of the viewport.
|
||||
@@ -72,11 +72,11 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
|
||||
|
||||
DRW_opengl_context_enable();
|
||||
/* Update the drawing. */
|
||||
DRW_draw_select_id(depsgraph, ar, v3d, rect);
|
||||
DRW_draw_select_id(depsgraph, region, v3d, rect);
|
||||
|
||||
if (select_ctx->index_drawn_len > 1) {
|
||||
BLI_assert(ar->winx == GPU_texture_width(DRW_engine_select_texture_get()) &&
|
||||
ar->winy == GPU_texture_height(DRW_engine_select_texture_get()));
|
||||
BLI_assert(region->winx == GPU_texture_width(DRW_engine_select_texture_get()) &&
|
||||
region->winy == GPU_texture_height(DRW_engine_select_texture_get()));
|
||||
|
||||
/* Read the UI32 pixels. */
|
||||
buf_len = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
|
||||
@@ -126,7 +126,7 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
|
||||
* \returns a #BLI_bitmap the length of \a bitmap_len or NULL on failure.
|
||||
*/
|
||||
uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const rcti *rect,
|
||||
uint *r_bitmap_len)
|
||||
@@ -138,7 +138,7 @@ uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
|
||||
rect_px.ymax += 1;
|
||||
|
||||
uint buf_len;
|
||||
uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect_px, &buf_len);
|
||||
uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len);
|
||||
if (buf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
|
||||
* \returns a #BLI_bitmap the length of \a bitmap_len or NULL on failure.
|
||||
*/
|
||||
uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int center[2],
|
||||
const int radius,
|
||||
@@ -186,7 +186,7 @@ uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph,
|
||||
.ymax = center[1] + radius + 1,
|
||||
};
|
||||
|
||||
const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, NULL);
|
||||
const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, NULL);
|
||||
|
||||
if (buf == NULL) {
|
||||
return NULL;
|
||||
@@ -241,7 +241,7 @@ static void drw_select_mask_px_cb(int x, int x_end, int y, void *user_data)
|
||||
* \returns a #BLI_bitmap.
|
||||
*/
|
||||
uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int poly[][2],
|
||||
const int poly_len,
|
||||
@@ -255,7 +255,7 @@ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
|
||||
rect_px.ymax += 1;
|
||||
|
||||
uint buf_len;
|
||||
uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect_px, &buf_len);
|
||||
uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len);
|
||||
if (buf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
|
||||
* Samples a single pixel.
|
||||
*/
|
||||
uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int center[2])
|
||||
{
|
||||
@@ -326,7 +326,7 @@ uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
|
||||
};
|
||||
|
||||
uint buf_len;
|
||||
uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len);
|
||||
uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len);
|
||||
if (buf) {
|
||||
BLI_assert(0 != buf_len);
|
||||
ret = buf[0];
|
||||
@@ -342,7 +342,7 @@ uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
|
||||
* when found, this value is set to the distance of the selection that's returned.
|
||||
*/
|
||||
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int center[2],
|
||||
const uint id_min,
|
||||
@@ -369,7 +369,7 @@ uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph,
|
||||
/* Read from selection framebuffer. */
|
||||
|
||||
uint buf_len;
|
||||
const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len);
|
||||
const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len);
|
||||
|
||||
if (buf == NULL) {
|
||||
return index;
|
||||
|
||||
@@ -50,11 +50,11 @@
|
||||
void DRW_draw_region_info(void)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
|
||||
DRW_draw_cursor();
|
||||
|
||||
view3d_draw_region_info(draw_ctx->evil_C, ar);
|
||||
view3d_draw_region_info(draw_ctx->evil_C, region);
|
||||
}
|
||||
|
||||
/* **************************** 3D Cursor ******************************** */
|
||||
@@ -99,7 +99,7 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie
|
||||
void DRW_draw_cursor(void)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
Scene *scene = draw_ctx->scene;
|
||||
ViewLayer *view_layer = draw_ctx->view_layer;
|
||||
|
||||
@@ -114,9 +114,9 @@ void DRW_draw_cursor(void)
|
||||
const View3DCursor *cursor = &scene->cursor;
|
||||
|
||||
if (ED_view3d_project_int_global(
|
||||
ar, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) ==
|
||||
region, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
float cursor_quat[4];
|
||||
BKE_scene_cursor_rot_to_quat(cursor, cursor_quat);
|
||||
@@ -178,7 +178,7 @@ void DRW_draw_cursor(void)
|
||||
float original_proj[4][4];
|
||||
GPU_matrix_projection_get(original_proj);
|
||||
GPU_matrix_push();
|
||||
ED_region_pixelspace(ar);
|
||||
ED_region_pixelspace(region);
|
||||
GPU_matrix_translate_2f(co[0] + 0.5f, co[1] + 0.5f);
|
||||
GPU_matrix_scale_2f(U.widget_unit, U.widget_unit);
|
||||
|
||||
@@ -202,20 +202,20 @@ void DRW_draw_cursor(void)
|
||||
void DRW_draw_gizmo_3d(void)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
|
||||
/* draw depth culled gizmos - gizmos need to be updated *after* view matrix was set up */
|
||||
/* TODO depth culling gizmos is not yet supported, just drawing _3D here, should
|
||||
* later become _IN_SCENE (and draw _3D separate) */
|
||||
WM_gizmomap_draw(ar->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_3D);
|
||||
WM_gizmomap_draw(region->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_3D);
|
||||
}
|
||||
|
||||
void DRW_draw_gizmo_2d(void)
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *ar = draw_ctx->ar;
|
||||
ARegion *region = draw_ctx->region;
|
||||
|
||||
WM_gizmomap_draw(ar->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_2D);
|
||||
WM_gizmomap_draw(region->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_2D);
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac,
|
||||
float ymaxc)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
|
||||
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
float color[3];
|
||||
@@ -145,7 +145,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac,
|
||||
float ymaxc)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
float color[3];
|
||||
|
||||
@@ -253,7 +253,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac,
|
||||
float ymaxc)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
float color[3];
|
||||
|
||||
@@ -466,7 +466,7 @@ static void acf_summary_color(bAnimContext *UNUSED(ac),
|
||||
static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
float color[3];
|
||||
|
||||
/* set backdrop drawing color */
|
||||
@@ -874,7 +874,7 @@ static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[
|
||||
static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
|
||||
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
float color[3];
|
||||
@@ -1147,7 +1147,7 @@ static void acf_nla_controls_backdrop(bAnimContext *ac,
|
||||
float ymaxc)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
|
||||
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
float color[3];
|
||||
@@ -3580,7 +3580,7 @@ static void acf_nlaaction_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, fl
|
||||
static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
AnimData *adt = ale->adt;
|
||||
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
|
||||
float color[4];
|
||||
@@ -4010,7 +4010,7 @@ void ANIM_channel_draw(
|
||||
bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
short selected, offset;
|
||||
float y, ymid, ytext;
|
||||
|
||||
@@ -4741,7 +4741,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
|
||||
size_t channel_index)
|
||||
{
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
float ymid;
|
||||
const short channel_height = round_fl_to_int(BLI_rctf_size_y(rect));
|
||||
const bool is_being_renamed = achannel_is_being_renamed(ac, acf, channel_index);
|
||||
@@ -4871,7 +4871,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
|
||||
*/
|
||||
if (acf->name_prop(ale, &ptr, &prop)) {
|
||||
const short margin_x = 3 * round_fl_to_int(UI_DPI_FAC);
|
||||
const short width = ac->ar->winx - offset - (margin_x * 2);
|
||||
const short width = ac->region->winx - offset - (margin_x * 2);
|
||||
uiBut *but;
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
@@ -4894,7 +4894,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
|
||||
NULL);
|
||||
|
||||
/* copy what outliner does here, see outliner_buttons */
|
||||
if (UI_but_active_only(C, ac->ar, block, but) == false) {
|
||||
if (UI_but_active_only(C, ac->region, block, but) == false) {
|
||||
ac->ads->renameIndex = 0;
|
||||
|
||||
/* send notifiers */
|
||||
|
||||
@@ -2553,7 +2553,7 @@ static void box_select_anim_channels(bAnimContext *ac, rcti *rect, short selectm
|
||||
int filter;
|
||||
|
||||
SpaceNla *snla = (SpaceNla *)ac->sl;
|
||||
View2D *v2d = &ac->ar->v2d;
|
||||
View2D *v2d = &ac->region->v2d;
|
||||
rctf rectf;
|
||||
|
||||
/* convert border-region to view coordinates */
|
||||
@@ -2736,20 +2736,20 @@ static bool rename_anim_channels(bAnimContext *ac, int channel_index)
|
||||
|
||||
/* free temp data and tag for refresh */
|
||||
ANIM_animdata_freelist(&anim_data);
|
||||
ED_region_tag_redraw(ac->ar);
|
||||
ED_region_tag_redraw(ac->region);
|
||||
return success;
|
||||
}
|
||||
|
||||
static int animchannels_channel_get(bAnimContext *ac, const int mval[2])
|
||||
{
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
View2D *v2d;
|
||||
int channel_index;
|
||||
float x, y;
|
||||
|
||||
/* get useful pointers from animation context data */
|
||||
ar = ac->ar;
|
||||
v2d = &ar->v2d;
|
||||
region = ac->region;
|
||||
v2d = ®ion->v2d;
|
||||
|
||||
/* Figure out which channel user clicked in. */
|
||||
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
|
||||
@@ -3194,7 +3194,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
|
||||
static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
bAnimContext ac;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
View2D *v2d;
|
||||
int channel_index;
|
||||
int notifierFlags = 0;
|
||||
@@ -3207,8 +3207,8 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
|
||||
}
|
||||
|
||||
/* get useful pointers from animation context data */
|
||||
ar = ac.ar;
|
||||
v2d = &ar->v2d;
|
||||
region = ac.region;
|
||||
v2d = ®ion->v2d;
|
||||
|
||||
/* select mode is either replace (deselect all, then add) or add/extend */
|
||||
if (RNA_boolean_get(op->ptr, "extend")) {
|
||||
@@ -3327,7 +3327,7 @@ static bool select_anim_channel_keys(bAnimContext *ac, int channel_index, bool e
|
||||
}
|
||||
|
||||
/* free temp data and tag for refresh */
|
||||
ED_region_tag_redraw(ac->ar);
|
||||
ED_region_tag_redraw(ac->region);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -615,9 +615,9 @@ static bool find_prev_next_keyframes(struct bContext *C, int *nextfra, int *prev
|
||||
|
||||
void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
float w = BLI_rctf_size_x(&ar->v2d.cur);
|
||||
float w = BLI_rctf_size_x(®ion->v2d.cur);
|
||||
rctf newrct;
|
||||
int nextfra, prevfra;
|
||||
|
||||
@@ -626,8 +626,8 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
|
||||
const float fps = FPS;
|
||||
newrct.xmax = scene->r.cfra + U.view_frame_seconds * fps + 1;
|
||||
newrct.xmin = scene->r.cfra - U.view_frame_seconds * fps - 1;
|
||||
newrct.ymax = ar->v2d.cur.ymax;
|
||||
newrct.ymin = ar->v2d.cur.ymin;
|
||||
newrct.ymax = region->v2d.cur.ymax;
|
||||
newrct.ymin = region->v2d.cur.ymin;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -636,8 +636,8 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
|
||||
if (find_prev_next_keyframes(C, &nextfra, &prevfra)) {
|
||||
newrct.xmax = nextfra;
|
||||
newrct.xmin = prevfra;
|
||||
newrct.ymax = ar->v2d.cur.ymax;
|
||||
newrct.ymin = ar->v2d.cur.ymin;
|
||||
newrct.ymax = region->v2d.cur.ymax;
|
||||
newrct.ymin = region->v2d.cur.ymin;
|
||||
break;
|
||||
}
|
||||
/* else drop through, keep range instead */
|
||||
@@ -647,11 +647,11 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
|
||||
default:
|
||||
newrct.xmax = scene->r.cfra + (w / 2);
|
||||
newrct.xmin = scene->r.cfra - (w / 2);
|
||||
newrct.ymax = ar->v2d.cur.ymax;
|
||||
newrct.ymin = ar->v2d.cur.ymin;
|
||||
newrct.ymax = region->v2d.cur.ymax;
|
||||
newrct.ymin = region->v2d.cur.ymin;
|
||||
break;
|
||||
}
|
||||
|
||||
UI_view2d_smooth_view(C, ar, &newrct, smooth_viewtx);
|
||||
UI_view2d_smooth_view(C, region, &newrct, smooth_viewtx);
|
||||
}
|
||||
/* *************************************************** */
|
||||
|
||||
@@ -397,7 +397,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
SpaceLink *sl = CTX_wm_space_data(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
@@ -416,10 +416,10 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
|
||||
ac->view_layer = CTX_data_view_layer(C);
|
||||
ac->obact = (ac->view_layer->basact) ? ac->view_layer->basact->object : NULL;
|
||||
ac->sa = sa;
|
||||
ac->ar = ar;
|
||||
ac->region = region;
|
||||
ac->sl = sl;
|
||||
ac->spacetype = (sa) ? sa->spacetype : 0;
|
||||
ac->regiontype = (ar) ? ar->regiontype : 0;
|
||||
ac->regiontype = (region) ? region->regiontype : 0;
|
||||
|
||||
/* initialise default y-scale factor */
|
||||
animedit_get_yscale_factor(ac);
|
||||
|
||||
@@ -575,7 +575,7 @@ void ED_markers_draw(const bContext *C, int flag)
|
||||
return;
|
||||
}
|
||||
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
int cfra = CTX_data_scene(C)->r.cfra;
|
||||
|
||||
@@ -599,14 +599,14 @@ void ED_markers_draw(const bContext *C, int flag)
|
||||
for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
|
||||
if ((marker->flag & SELECT) == 0) {
|
||||
if (marker_is_in_frame_range(marker, clip_frame_range)) {
|
||||
draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, ar->winy);
|
||||
draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, region->winy);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
|
||||
if (marker->flag & SELECT) {
|
||||
if (marker_is_in_frame_range(marker, clip_frame_range)) {
|
||||
draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, ar->winy);
|
||||
draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, region->winy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -870,10 +870,10 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
{
|
||||
bool tweak = RNA_boolean_get(op->ptr, "tweak");
|
||||
if (tweak) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
View2D *v2d = &ar->v2d;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
if (!region_position_is_over_marker(v2d, markers, event->x - ar->winrct.xmin)) {
|
||||
if (!region_position_is_over_marker(v2d, markers, event->x - region->winrct.xmin)) {
|
||||
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
}
|
||||
@@ -1337,11 +1337,11 @@ static void MARKER_OT_select(wmOperatorType *ot)
|
||||
|
||||
static int ed_marker_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
View2D *v2d = &ar->v2d;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
bool over_marker = region_position_is_over_marker(v2d, markers, event->x - ar->winrct.xmin);
|
||||
bool over_marker = region_position_is_over_marker(v2d, markers, event->x - region->winrct.xmin);
|
||||
|
||||
bool tweak = RNA_boolean_get(op->ptr, "tweak");
|
||||
if (tweak && over_marker) {
|
||||
|
||||
@@ -403,7 +403,7 @@ static void ANIM_OT_end_frame_set(wmOperatorType *ot)
|
||||
static int previewrange_define_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
float sfra, efra;
|
||||
rcti rect;
|
||||
|
||||
@@ -411,8 +411,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op)
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
|
||||
/* convert min/max values to frames (i.e. region to 'tot' rect) */
|
||||
sfra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmin);
|
||||
efra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmax);
|
||||
sfra = UI_view2d_region_to_view_x(®ion->v2d, rect.xmin);
|
||||
efra = UI_view2d_region_to_view_x(®ion->v2d, rect.xmax);
|
||||
|
||||
/* set start/end frames for preview-range
|
||||
* - must clamp within allowable limits
|
||||
|
||||
@@ -46,11 +46,11 @@
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
static void get_time_scrub_region_rect(const ARegion *ar, rcti *rect)
|
||||
static void get_time_scrub_region_rect(const ARegion *region, rcti *rect)
|
||||
{
|
||||
rect->xmin = 0;
|
||||
rect->xmax = ar->winx;
|
||||
rect->ymax = ar->winy;
|
||||
rect->xmax = region->winx;
|
||||
rect->ymax = region->winy;
|
||||
rect->ymin = rect->ymax - UI_TIME_SCRUB_MARGIN_Y;
|
||||
}
|
||||
|
||||
@@ -134,18 +134,18 @@ static void draw_current_frame(const Scene *scene,
|
||||
color);
|
||||
}
|
||||
|
||||
void ED_time_scrub_draw(const ARegion *ar,
|
||||
void ED_time_scrub_draw(const ARegion *region,
|
||||
const Scene *scene,
|
||||
bool display_seconds,
|
||||
bool discrete_frames)
|
||||
{
|
||||
const View2D *v2d = &ar->v2d;
|
||||
const View2D *v2d = ®ion->v2d;
|
||||
|
||||
GPU_matrix_push_projection();
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
|
||||
rcti scrub_region_rect;
|
||||
get_time_scrub_region_rect(ar, &scrub_region_rect);
|
||||
get_time_scrub_region_rect(region, &scrub_region_rect);
|
||||
|
||||
draw_background(&scrub_region_rect);
|
||||
|
||||
@@ -153,11 +153,11 @@ void ED_time_scrub_draw(const ARegion *ar,
|
||||
numbers_rect.ymin = get_centered_text_y(&scrub_region_rect) - 4 * UI_DPI_FAC;
|
||||
if (discrete_frames) {
|
||||
UI_view2d_draw_scale_x__discrete_frames_or_seconds(
|
||||
ar, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
|
||||
region, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
|
||||
}
|
||||
else {
|
||||
UI_view2d_draw_scale_x__frames_or_seconds(
|
||||
ar, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
|
||||
region, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
|
||||
}
|
||||
|
||||
draw_current_frame(scene, display_seconds, v2d, &scrub_region_rect, scene->r.cfra);
|
||||
@@ -165,23 +165,23 @@ void ED_time_scrub_draw(const ARegion *ar,
|
||||
GPU_matrix_pop_projection();
|
||||
}
|
||||
|
||||
bool ED_time_scrub_event_in_region(const ARegion *ar, const wmEvent *event)
|
||||
bool ED_time_scrub_event_in_region(const ARegion *region, const wmEvent *event)
|
||||
{
|
||||
rcti rect = ar->winrct;
|
||||
rcti rect = region->winrct;
|
||||
rect.ymin = rect.ymax - UI_TIME_SCRUB_MARGIN_Y;
|
||||
return BLI_rcti_isect_pt(&rect, event->x, event->y);
|
||||
}
|
||||
|
||||
void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *ar, bDopeSheet *dopesheet)
|
||||
void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *region, bDopeSheet *dopesheet)
|
||||
{
|
||||
GPU_matrix_push_projection();
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
|
||||
rcti rect;
|
||||
rect.xmin = 0;
|
||||
rect.xmax = ar->winx;
|
||||
rect.ymin = ar->winy - UI_TIME_SCRUB_MARGIN_Y;
|
||||
rect.ymax = ar->winy;
|
||||
rect.xmax = region->winx;
|
||||
rect.ymin = region->winy - UI_TIME_SCRUB_MARGIN_Y;
|
||||
rect.ymax = region->winy;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
@@ -189,7 +189,7 @@ void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *ar, bDopeShee
|
||||
immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
|
||||
immUnbindProgram();
|
||||
|
||||
uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
||||
uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
|
||||
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(&CTX_wm_screen(C)->id, &RNA_DopeSheet, dopesheet, &ptr);
|
||||
|
||||
@@ -228,13 +228,13 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv
|
||||
|
||||
/* temporarily change 3d cursor position */
|
||||
Scene *scene;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
View3D *v3d;
|
||||
float tvec[3], oldcurs[3], mval_f[2];
|
||||
int retv;
|
||||
|
||||
scene = CTX_data_scene(C);
|
||||
ar = CTX_wm_region(C);
|
||||
region = CTX_wm_region(C);
|
||||
v3d = CTX_wm_view3d(C);
|
||||
|
||||
View3DCursor *cursor = &scene->cursor;
|
||||
@@ -242,7 +242,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv
|
||||
copy_v3_v3(oldcurs, cursor->location);
|
||||
|
||||
copy_v2fl_v2i(mval_f, event->mval);
|
||||
ED_view3d_win_to_3d(v3d, ar, cursor->location, mval_f, tvec);
|
||||
ED_view3d_win_to_3d(v3d, region, cursor->location, mval_f, tvec);
|
||||
copy_v3_v3(cursor->location, tvec);
|
||||
|
||||
/* extrude to the where new cursor is and store the operation result */
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef struct tPoseSlideOp {
|
||||
/** area that we're operating in (needed for modal()) */
|
||||
ScrArea *sa;
|
||||
/** region that we're operating in (needed for modal()) */
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
/** len of the PoseSlideObject array. */
|
||||
uint objects_len;
|
||||
|
||||
@@ -197,8 +197,8 @@ static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
|
||||
|
||||
/* get info from context */
|
||||
pso->scene = CTX_data_scene(C);
|
||||
pso->sa = CTX_wm_area(C); /* only really needed when doing modal() */
|
||||
pso->ar = CTX_wm_region(C); /* only really needed when doing modal() */
|
||||
pso->sa = CTX_wm_area(C); /* only really needed when doing modal() */
|
||||
pso->region = CTX_wm_region(C); /* only really needed when doing modal() */
|
||||
|
||||
pso->cframe = pso->scene->r.cfra;
|
||||
pso->mode = mode;
|
||||
@@ -1004,7 +1004,7 @@ static void pose_slide_mouse_update_percentage(tPoseSlideOp *pso,
|
||||
wmOperator *op,
|
||||
const wmEvent *event)
|
||||
{
|
||||
pso->percentage = (event->x - pso->ar->winrct.xmin) / ((float)pso->ar->winx);
|
||||
pso->percentage = (event->x - pso->region->winrct.xmin) / ((float)pso->region->winx);
|
||||
RNA_float_set(op->ptr, "percentage", pso->percentage);
|
||||
}
|
||||
|
||||
|
||||
@@ -5671,13 +5671,13 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
copy_v3_v3(location, vc.scene->cursor.location);
|
||||
}
|
||||
|
||||
ED_view3d_win_to_3d_int(vc.v3d, vc.ar, location, event->mval, location);
|
||||
ED_view3d_win_to_3d_int(vc.v3d, vc.region, location, event->mval, location);
|
||||
|
||||
if (use_proj) {
|
||||
const float mval[2] = {UNPACK2(event->mval)};
|
||||
|
||||
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
|
||||
vc.bmain, vc.scene, vc.depsgraph, 0, vc.ar, vc.v3d);
|
||||
vc.bmain, vc.scene, vc.depsgraph, 0, vc.region, vc.v3d);
|
||||
|
||||
ED_transform_snap_object_project_view3d(
|
||||
snap_context,
|
||||
|
||||
@@ -187,7 +187,7 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd,
|
||||
float r_location_world[3],
|
||||
float r_normal_world[3])
|
||||
{
|
||||
ARegion *ar = cdd->vc.ar;
|
||||
ARegion *region = cdd->vc.region;
|
||||
RegionView3D *rv3d = cdd->vc.rv3d;
|
||||
|
||||
bool is_location_world_set = false;
|
||||
@@ -195,7 +195,8 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd,
|
||||
/* project to 'location_world' */
|
||||
if (cdd->project.use_plane) {
|
||||
/* get the view vector to 'location' */
|
||||
if (ED_view3d_win_to_3d_on_plane(ar, cdd->project.plane, mval_fl, true, r_location_world)) {
|
||||
if (ED_view3d_win_to_3d_on_plane(
|
||||
region, cdd->project.plane, mval_fl, true, r_location_world)) {
|
||||
if (r_normal_world) {
|
||||
zero_v3(r_normal_world);
|
||||
}
|
||||
@@ -207,7 +208,7 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd,
|
||||
if (depths && ((unsigned int)mval_i[0] < depths->w) && ((unsigned int)mval_i[1] < depths->h)) {
|
||||
const double depth = (double)ED_view3d_depth_read_cached(&cdd->vc, mval_i);
|
||||
if ((depth > depths->depth_range[0]) && (depth < depths->depth_range[1])) {
|
||||
if (ED_view3d_depth_unproject(ar, mval_i, depth, r_location_world)) {
|
||||
if (ED_view3d_depth_unproject(region, mval_i, depth, r_location_world)) {
|
||||
is_location_world_set = true;
|
||||
if (r_normal_world) {
|
||||
zero_v3(r_normal_world);
|
||||
@@ -252,7 +253,7 @@ static bool stroke_elem_project_fallback(const struct CurveDrawData *cdd,
|
||||
cdd, mval_i, mval_fl, surface_offset, radius, r_location_world, r_normal_world);
|
||||
if (is_depth_found == false) {
|
||||
ED_view3d_win_to_3d(
|
||||
cdd->vc.v3d, cdd->vc.ar, location_fallback_depth, mval_fl, r_location_world);
|
||||
cdd->vc.v3d, cdd->vc.region, location_fallback_depth, mval_fl, r_location_world);
|
||||
zero_v3(r_normal_local);
|
||||
}
|
||||
mul_v3_m4v3(r_location_local, cdd->vc.obedit->imat, r_location_world);
|
||||
@@ -345,7 +346,9 @@ static void curve_draw_stroke_from_operator(wmOperator *op)
|
||||
/** \name Operator Callbacks & Helpers
|
||||
* \{ */
|
||||
|
||||
static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
|
||||
static void curve_draw_stroke_3d(const struct bContext *UNUSED(C),
|
||||
ARegion *UNUSED(region),
|
||||
void *arg)
|
||||
{
|
||||
wmOperator *op = arg;
|
||||
struct CurveDrawData *cdd = op->customdata;
|
||||
@@ -502,7 +505,7 @@ static void curve_draw_event_add(wmOperator *op, const wmEvent *event)
|
||||
|
||||
cdd->prev.selem = selem;
|
||||
|
||||
ED_region_tag_redraw(cdd->vc.ar);
|
||||
ED_region_tag_redraw(cdd->vc.region);
|
||||
}
|
||||
|
||||
static void curve_draw_event_add_first(wmOperator *op, const wmEvent *event)
|
||||
@@ -572,7 +575,7 @@ static bool curve_draw_init(bContext *C, wmOperator *op, bool is_invoke)
|
||||
|
||||
if (is_invoke) {
|
||||
ED_view3d_viewcontext_init(C, &cdd->vc, depsgraph);
|
||||
if (ELEM(NULL, cdd->vc.ar, cdd->vc.rv3d, cdd->vc.v3d, cdd->vc.win, cdd->vc.scene)) {
|
||||
if (ELEM(NULL, cdd->vc.region, cdd->vc.rv3d, cdd->vc.v3d, cdd->vc.win, cdd->vc.scene)) {
|
||||
MEM_freeN(cdd);
|
||||
BKE_report(op->reports, RPT_ERROR, "Unable to access 3D viewport");
|
||||
return false;
|
||||
@@ -610,7 +613,7 @@ static void curve_draw_exit(wmOperator *op)
|
||||
struct CurveDrawData *cdd = op->customdata;
|
||||
if (cdd) {
|
||||
if (cdd->draw_handle_view) {
|
||||
ED_region_draw_cb_exit(cdd->vc.ar->type, cdd->draw_handle_view);
|
||||
ED_region_draw_cb_exit(cdd->vc.region->type, cdd->draw_handle_view);
|
||||
WM_cursor_modal_restore(cdd->vc.win);
|
||||
}
|
||||
|
||||
@@ -1052,12 +1055,12 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
const float mval_fl[2] = {UNPACK2(event->mval)};
|
||||
float center[3];
|
||||
negate_v3_v3(center, cdd->vc.rv3d->ofs);
|
||||
ED_view3d_win_to_3d(cdd->vc.v3d, cdd->vc.ar, center, mval_fl, cdd->prev.location_world);
|
||||
ED_view3d_win_to_3d(cdd->vc.v3d, cdd->vc.region, center, mval_fl, cdd->prev.location_world);
|
||||
copy_v3_v3(cdd->prev.location_world_valid, cdd->prev.location_world);
|
||||
}
|
||||
|
||||
cdd->draw_handle_view = ED_region_draw_cb_activate(
|
||||
cdd->vc.ar->type, curve_draw_stroke_3d, op, REGION_DRAW_POST_VIEW);
|
||||
cdd->vc.region->type, curve_draw_stroke_3d, op, REGION_DRAW_POST_VIEW);
|
||||
WM_cursor_modal_set(cdd->vc.win, WM_CURSOR_PAINT_BRUSH);
|
||||
|
||||
{
|
||||
@@ -1080,13 +1083,13 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
/* needed or else the draw matrix can be incorrect */
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
ED_view3d_autodist_init(cdd->vc.depsgraph, cdd->vc.ar, cdd->vc.v3d, 0);
|
||||
ED_view3d_autodist_init(cdd->vc.depsgraph, cdd->vc.region, cdd->vc.v3d, 0);
|
||||
|
||||
if (cdd->vc.rv3d->depths) {
|
||||
cdd->vc.rv3d->depths->damaged = true;
|
||||
}
|
||||
|
||||
ED_view3d_depth_update(cdd->vc.ar);
|
||||
ED_view3d_depth_update(cdd->vc.region);
|
||||
|
||||
if (cdd->vc.rv3d->depths != NULL) {
|
||||
cdd->project.use_depth = true;
|
||||
@@ -1140,7 +1143,7 @@ static int curve_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
if (event->type == cdd->init_event_type) {
|
||||
if (event->val == KM_RELEASE) {
|
||||
ED_region_tag_redraw(cdd->vc.ar);
|
||||
ED_region_tag_redraw(cdd->vc.region);
|
||||
|
||||
curve_draw_exec_precalc(op);
|
||||
|
||||
@@ -1152,7 +1155,7 @@ static int curve_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
}
|
||||
else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) {
|
||||
ED_region_tag_redraw(cdd->vc.ar);
|
||||
ED_region_tag_redraw(cdd->vc.region);
|
||||
curve_draw_cancel(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -2256,7 +2256,7 @@ bool ED_curve_editfont_select_pick(
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (ED_view3d_project_float_object(
|
||||
vc.ar, obedit_co[j], screen_co[j], V3D_PROJ_TEST_CLIP_BB) == V3D_PROJ_RET_OK) {
|
||||
vc.region, obedit_co[j], screen_co[j], V3D_PROJ_TEST_CLIP_BB) == V3D_PROJ_RET_OK) {
|
||||
project_ok |= (1 << j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,12 +196,12 @@ bool gizmo_window_project_2d(bContext *C,
|
||||
/* rotate mouse in relation to the center and relocate it */
|
||||
if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
|
||||
/* For 3d views, transform 2D mouse pos onto plane. */
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
float plane[4], co[3];
|
||||
plane_from_point_normal_v3(plane, mat[3], mat[2]);
|
||||
bool clip_ray = ((RegionView3D *)ar->regiondata)->is_persp;
|
||||
if (ED_view3d_win_to_3d_on_plane(ar, plane, mval, clip_ray, co)) {
|
||||
bool clip_ray = ((RegionView3D *)region->regiondata)->is_persp;
|
||||
if (ED_view3d_win_to_3d_on_plane(region, plane, mval, clip_ray, co)) {
|
||||
float imat[4][4];
|
||||
invert_m4_m4(imat, mat);
|
||||
mul_m4_v3(imat, co);
|
||||
@@ -237,10 +237,10 @@ bool gizmo_window_project_3d(
|
||||
|
||||
if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
/* Note: we might want a custom reference point passed in,
|
||||
* instead of the gizmo center. */
|
||||
ED_view3d_win_to_3d(v3d, ar, mat[3], mval, r_co);
|
||||
ED_view3d_win_to_3d(v3d, region, mat[3], mval, r_co);
|
||||
invert_m4(mat);
|
||||
mul_m4_v3(mat, r_co);
|
||||
return true;
|
||||
|
||||
@@ -274,8 +274,8 @@ static int gizmo_arrow_modal(bContext *C,
|
||||
}
|
||||
ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz;
|
||||
GizmoInteraction *inter = gz->interaction_data;
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
float offset[3];
|
||||
float facdir = 1.0f;
|
||||
@@ -298,7 +298,7 @@ static int gizmo_arrow_modal(bContext *C,
|
||||
int ok = 0;
|
||||
|
||||
for (int j = 0; j < 2; j++) {
|
||||
ED_view3d_win_to_ray(ar, proj[j].mval, proj[j].ray_origin, proj[j].ray_direction);
|
||||
ED_view3d_win_to_ray(region, proj[j].mval, proj[j].ray_origin, proj[j].ray_direction);
|
||||
/* Force Y axis if we're view aligned */
|
||||
if (j == 0) {
|
||||
if (RAD2DEGF(acosf(dot_v3v3(proj[j].ray_direction, arrow->gizmo.matrix_basis[2]))) < 5.0f) {
|
||||
@@ -353,7 +353,7 @@ static int gizmo_arrow_modal(bContext *C,
|
||||
}
|
||||
|
||||
/* tag the region for redraw */
|
||||
ED_region_tag_redraw_editor_overlays(ar);
|
||||
ED_region_tag_redraw_editor_overlays(region);
|
||||
WM_event_add_mousemove(CTX_wm_window(C));
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
||||
@@ -402,15 +402,15 @@ static void gizmo_cage3d_draw_intern(
|
||||
*/
|
||||
static void gizmo_cage3d_draw_select(const bContext *C, wmGizmo *gz, int select_id)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
gizmo_cage3d_draw_intern(rv3d, gz, true, false, select_id);
|
||||
}
|
||||
|
||||
static void gizmo_cage3d_draw(const bContext *C, wmGizmo *gz)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
|
||||
gizmo_cage3d_draw_intern(rv3d, gz, false, is_highlight, -1);
|
||||
}
|
||||
|
||||
@@ -287,15 +287,15 @@ static void dial_ghostarc_draw(const float angle_ofs,
|
||||
|
||||
static void dial_ghostarc_get_angles(const wmGizmo *gz,
|
||||
const wmEvent *event,
|
||||
const ARegion *ar,
|
||||
const ARegion *region,
|
||||
const float mat[4][4],
|
||||
const float co_outer[3],
|
||||
float *r_start,
|
||||
float *r_delta)
|
||||
{
|
||||
DialInteraction *inter = gz->interaction_data;
|
||||
const RegionView3D *rv3d = ar->regiondata;
|
||||
const float mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
|
||||
const RegionView3D *rv3d = region->regiondata;
|
||||
const float mval[2] = {event->x - region->winrct.xmin, event->y - region->winrct.ymin};
|
||||
|
||||
/* We might need to invert the direction of the angles. */
|
||||
float view_vec[3], axis_vec[3];
|
||||
@@ -312,12 +312,13 @@ static void dial_ghostarc_get_angles(const wmGizmo *gz,
|
||||
|
||||
plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec);
|
||||
|
||||
if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
|
||||
if (!ED_view3d_win_to_3d_on_plane(
|
||||
region, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
|
||||
goto fail;
|
||||
}
|
||||
sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]);
|
||||
|
||||
if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, false, proj_mval_new_rel)) {
|
||||
if (!ED_view3d_win_to_3d_on_plane(region, dial_plane, mval, false, proj_mval_new_rel)) {
|
||||
goto fail;
|
||||
}
|
||||
sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]);
|
||||
@@ -440,8 +441,8 @@ static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id
|
||||
float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL;
|
||||
|
||||
if (clip_plane) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
copy_v3_v3(clip_plane, rv3d->viewinv[2]);
|
||||
clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
|
||||
@@ -467,8 +468,8 @@ static void gizmo_dial_draw(const bContext *C, wmGizmo *gz)
|
||||
NULL;
|
||||
|
||||
if (clip_plane) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
copy_v3_v3(clip_plane, rv3d->viewinv[2]);
|
||||
clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
|
||||
|
||||
@@ -148,7 +148,7 @@ static void move_geom_draw(const wmGizmo *gz,
|
||||
|
||||
static void move3d_get_translate(const wmGizmo *gz,
|
||||
const wmEvent *event,
|
||||
const ARegion *ar,
|
||||
const ARegion *region,
|
||||
float co_delta[3])
|
||||
{
|
||||
MoveInteraction *inter = gz->interaction_data;
|
||||
@@ -157,12 +157,12 @@ static void move3d_get_translate(const wmGizmo *gz,
|
||||
event->mval[1] - inter->init.mval[1],
|
||||
};
|
||||
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
float co_ref[3];
|
||||
mul_v3_mat3_m4v3(co_ref, gz->matrix_space, inter->init.prop_co);
|
||||
const float zfac = ED_view3d_calc_zfac(rv3d, co_ref, NULL);
|
||||
|
||||
ED_view3d_win_to_delta(ar, mval_delta, co_delta, zfac);
|
||||
ED_view3d_win_to_delta(region, mval_delta, co_delta, zfac);
|
||||
|
||||
float matrix_space_inv[3][3];
|
||||
copy_m3_m4(matrix_space_inv, gz->matrix_space);
|
||||
@@ -246,11 +246,11 @@ static int gizmo_move_modal(bContext *C,
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
MoveGizmo3D *move = (MoveGizmo3D *)gz;
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
float prop_delta[3];
|
||||
if (CTX_wm_area(C)->spacetype == SPACE_VIEW3D) {
|
||||
move3d_get_translate(gz, event, ar, prop_delta);
|
||||
move3d_get_translate(gz, event, region, prop_delta);
|
||||
}
|
||||
else {
|
||||
float mval_proj_init[2], mval_proj_curr[2];
|
||||
@@ -303,7 +303,7 @@ static int gizmo_move_modal(bContext *C,
|
||||
zero_v3(move->prop_co);
|
||||
}
|
||||
|
||||
ED_region_tag_redraw_editor_overlays(ar);
|
||||
ED_region_tag_redraw_editor_overlays(region);
|
||||
|
||||
inter->prev.tweak_flag = tweak_flag;
|
||||
|
||||
|
||||
@@ -933,7 +933,7 @@ static void annotation_draw_data_layers(
|
||||
}
|
||||
|
||||
/* draw a short status message in the top-right corner */
|
||||
static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
|
||||
static void annotation_draw_status_text(const bGPdata *gpd, ARegion *region)
|
||||
{
|
||||
|
||||
/* Cannot draw any status text when drawing OpenGL Renders */
|
||||
@@ -942,7 +942,7 @@ static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
|
||||
}
|
||||
|
||||
/* Get bounds of region - Necessary to avoid problems with region overlap */
|
||||
const rcti *rect = ED_region_visible_rect(ar);
|
||||
const rcti *rect = ED_region_visible_rect(region);
|
||||
|
||||
/* for now, this should only be used to indicate when we are in stroke editmode */
|
||||
if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
|
||||
@@ -1050,7 +1050,7 @@ void ED_annotation_draw_2dimage(const bContext *C)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
int offsx, offsy, sizex, sizey;
|
||||
@@ -1071,10 +1071,11 @@ void ED_annotation_draw_2dimage(const bContext *C)
|
||||
* so disabled. */
|
||||
offsx = 0;
|
||||
offsy = 0;
|
||||
sizex = ar->winx;
|
||||
sizey = ar->winy;
|
||||
sizex = region->winx;
|
||||
sizey = region->winy;
|
||||
|
||||
wmOrtho2(ar->v2d.cur.xmin, ar->v2d.cur.xmax, ar->v2d.cur.ymin, ar->v2d.cur.ymax);
|
||||
wmOrtho2(
|
||||
region->v2d.cur.xmin, region->v2d.cur.xmax, region->v2d.cur.ymin, region->v2d.cur.ymax);
|
||||
|
||||
dflag |= GP_DRAWDATA_ONLYV2D | GP_DRAWDATA_IEDITHACK;
|
||||
break;
|
||||
@@ -1084,8 +1085,8 @@ void ED_annotation_draw_2dimage(const bContext *C)
|
||||
/* just draw using standard scaling (settings here are currently ignored anyways) */
|
||||
offsx = 0;
|
||||
offsy = 0;
|
||||
sizex = ar->winx;
|
||||
sizey = ar->winy;
|
||||
sizex = region->winx;
|
||||
sizey = region->winy;
|
||||
|
||||
/* NOTE: I2D was used in 2.4x, but the old settings for that have been deprecated
|
||||
* and everything moved to standard View2d
|
||||
@@ -1096,8 +1097,8 @@ void ED_annotation_draw_2dimage(const bContext *C)
|
||||
default: /* for spacetype not yet handled */
|
||||
offsx = 0;
|
||||
offsy = 0;
|
||||
sizex = ar->winx;
|
||||
sizey = ar->winy;
|
||||
sizex = region->winx;
|
||||
sizey = region->winy;
|
||||
|
||||
dflag |= GP_DRAWDATA_ONLYI2D;
|
||||
break;
|
||||
@@ -1124,7 +1125,7 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int dflag = 0;
|
||||
|
||||
@@ -1152,11 +1153,12 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
|
||||
dflag |= GP_DRAWDATA_NO_ONIONS;
|
||||
}
|
||||
|
||||
annotation_draw_data_all(scene, gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag, sa->spacetype);
|
||||
annotation_draw_data_all(
|
||||
scene, gpd, 0, 0, region->winx, region->winy, CFRA, dflag, sa->spacetype);
|
||||
|
||||
/* draw status text (if in screen/pixel-space) */
|
||||
if (!onlyv2d) {
|
||||
annotation_draw_status_text(gpd, ar);
|
||||
annotation_draw_status_text(gpd, region);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1164,10 +1166,10 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
|
||||
* Note: this gets called twice - first time with only3d=true to draw 3d-strokes,
|
||||
* second time with only3d=false for screen-aligned strokes */
|
||||
void ED_annotation_draw_view3d(
|
||||
Scene *scene, struct Depsgraph *depsgraph, View3D *v3d, ARegion *ar, bool only3d)
|
||||
Scene *scene, struct Depsgraph *depsgraph, View3D *v3d, ARegion *region, bool only3d)
|
||||
{
|
||||
int dflag = 0;
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
int offsx, offsy, winx, winy;
|
||||
|
||||
/* check that we have grease-pencil stuff to draw */
|
||||
@@ -1181,7 +1183,7 @@ void ED_annotation_draw_view3d(
|
||||
* deal with the camera border, otherwise map the coords to the camera border. */
|
||||
if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
|
||||
rctf rectf;
|
||||
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
|
||||
ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &rectf, true); /* no shift */
|
||||
|
||||
offsx = round_fl_to_int(rectf.xmin);
|
||||
offsy = round_fl_to_int(rectf.ymin);
|
||||
@@ -1191,8 +1193,8 @@ void ED_annotation_draw_view3d(
|
||||
else {
|
||||
offsx = 0;
|
||||
offsy = 0;
|
||||
winx = ar->winx;
|
||||
winy = ar->winy;
|
||||
winx = region->winx;
|
||||
winy = region->winy;
|
||||
}
|
||||
|
||||
/* set flags */
|
||||
|
||||
@@ -116,7 +116,7 @@ typedef struct tGPsdata {
|
||||
/** area where painting originated. */
|
||||
ScrArea *sa;
|
||||
/** region where painting originated. */
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
/** needed for GP_STROKE_2DSPACE. */
|
||||
View2D *v2d;
|
||||
/** for using the camera rect within the 3d view. */
|
||||
@@ -306,7 +306,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
|
||||
if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) {
|
||||
int mval_i[2];
|
||||
round_v2i_v2fl(mval_i, mval);
|
||||
if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval_i, out, 0, depth))) {
|
||||
if (gpencil_project_check(p) &&
|
||||
(ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth))) {
|
||||
/* projecting onto 3D-Geometry
|
||||
* - nothing more needs to be done here, since view_autodist_simple() has already done it
|
||||
*/
|
||||
@@ -326,13 +327,13 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
|
||||
*/
|
||||
|
||||
gp_get_3d_reference(p, rvec);
|
||||
zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
|
||||
zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec, NULL);
|
||||
|
||||
if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
if (ED_view3d_project_float_global(p->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
float mval_f[2];
|
||||
sub_v2_v2v2(mval_f, mval_prj, mval);
|
||||
ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
|
||||
ED_view3d_win_to_delta(p->region, mval_f, dvec, zfac);
|
||||
sub_v3_v3v3(out, rvec, dvec);
|
||||
}
|
||||
else {
|
||||
@@ -350,8 +351,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
|
||||
/* 2d - relative to screen (viewport area) */
|
||||
else {
|
||||
if (p->subrect == NULL) { /* normal 3D view */
|
||||
out[0] = (float)(mval[0]) / (float)(p->ar->winx) * 100;
|
||||
out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
|
||||
out[0] = (float)(mval[0]) / (float)(p->region->winx) * 100;
|
||||
out[1] = (float)(mval[1]) / (float)(p->region->winy) * 100;
|
||||
}
|
||||
else { /* camera view, use subrect */
|
||||
out[0] = ((mval[0] - p->subrect->xmin) / BLI_rctf_size_x(p->subrect)) * 100;
|
||||
@@ -522,9 +523,11 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
|
||||
if (gpencil_project_check(p)) {
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
|
||||
view3d_region_operator_needs_opengl(p->win, p->ar);
|
||||
ED_view3d_autodist_init(
|
||||
p->depsgraph, p->ar, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
view3d_region_operator_needs_opengl(p->win, p->region);
|
||||
ED_view3d_autodist_init(p->depsgraph,
|
||||
p->region,
|
||||
v3d,
|
||||
(ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
}
|
||||
|
||||
/* convert screen-coordinates to appropriate coordinates (and store them) */
|
||||
@@ -676,9 +679,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
|
||||
for (i = 0, ptc = gpd->runtime.sbuffer; i < gpd->runtime.sbuffer_used; i++, ptc++, pt++) {
|
||||
round_v2i_v2fl(mval_i, &ptc->x);
|
||||
|
||||
if ((ED_view3d_autodist_depth(p->ar, mval_i, depth_margin, depth_arr + i) == 0) &&
|
||||
if ((ED_view3d_autodist_depth(p->region, mval_i, depth_margin, depth_arr + i) == 0) &&
|
||||
(i && (ED_view3d_autodist_depth_seg(
|
||||
p->ar, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
|
||||
p->region, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
|
||||
interp_depth = true;
|
||||
}
|
||||
else {
|
||||
@@ -794,11 +797,11 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
|
||||
const int y)
|
||||
{
|
||||
if ((p->sa->spacetype == SPACE_VIEW3D) && (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH)) {
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
const int mval_i[2] = {x, y};
|
||||
float mval_3d[3];
|
||||
|
||||
if (ED_view3d_autodist_simple(p->ar, mval_i, mval_3d, 0, NULL)) {
|
||||
if (ED_view3d_autodist_simple(p->region, mval_i, mval_3d, 0, NULL)) {
|
||||
const float depth_mval = view3d_point_depth(rv3d, mval_3d);
|
||||
const float depth_pt = view3d_point_depth(rv3d, &pt->x);
|
||||
|
||||
@@ -924,8 +927,8 @@ static void gp_stroke_doeraser(tGPsdata *p)
|
||||
if (p->sa->spacetype == SPACE_VIEW3D) {
|
||||
if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) {
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
view3d_region_operator_needs_opengl(p->win, p->ar);
|
||||
ED_view3d_autodist_init(p->depsgraph, p->ar, v3d, 0);
|
||||
view3d_region_operator_needs_opengl(p->win, p->region);
|
||||
ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,7 +970,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
Main *bmain = CTX_data_main(C);
|
||||
bGPdata **gpd_ptr = NULL;
|
||||
ScrArea *curarea = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
|
||||
/* make sure the active view (at the starting time) is a 3d-view */
|
||||
@@ -992,17 +995,17 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
/* supported views first */
|
||||
case SPACE_VIEW3D: {
|
||||
/* View3D *v3d = curarea->spacedata.first; */
|
||||
/* RegionView3D *rv3d = ar->regiondata; */
|
||||
/* RegionView3D *rv3d = region->regiondata; */
|
||||
|
||||
/* set current area
|
||||
* - must verify that region data is 3D-view (and not something else)
|
||||
*/
|
||||
/* CAUTION: If this is the "toolbar", then this will change on the first stroke */
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->region = region;
|
||||
p->align_flag = &ts->annotate_v3d_align;
|
||||
|
||||
if (ar->regiondata == NULL) {
|
||||
if (region->regiondata == NULL) {
|
||||
p->status = GP_STATUS_ERROR;
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf(
|
||||
@@ -1018,8 +1021,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
|
||||
/* set current area */
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->v2d = &ar->v2d;
|
||||
p->region = region;
|
||||
p->v2d = ®ion->v2d;
|
||||
p->align_flag = &ts->gpencil_v2d_align;
|
||||
break;
|
||||
}
|
||||
@@ -1028,8 +1031,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
|
||||
/* set current area */
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->v2d = &ar->v2d;
|
||||
p->region = region;
|
||||
p->v2d = ®ion->v2d;
|
||||
p->align_flag = &ts->gpencil_seq_align;
|
||||
|
||||
/* check that gpencil data is allowed to be drawn */
|
||||
@@ -1047,8 +1050,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
|
||||
/* set the current area */
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->v2d = &ar->v2d;
|
||||
p->region = region;
|
||||
p->v2d = ®ion->v2d;
|
||||
p->align_flag = &ts->gpencil_ima_align;
|
||||
break;
|
||||
}
|
||||
@@ -1063,8 +1066,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
|
||||
|
||||
/* set the current area */
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->v2d = &ar->v2d;
|
||||
p->region = region;
|
||||
p->v2d = ®ion->v2d;
|
||||
p->align_flag = &ts->gpencil_v2d_align;
|
||||
|
||||
invert_m4_m4(p->imat, sc->unistabmat);
|
||||
@@ -1305,13 +1308,13 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
|
||||
if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) {
|
||||
if (p->sa->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
|
||||
/* for camera view set the subrect */
|
||||
if (rv3d->persp == RV3D_CAMOB) {
|
||||
/* no shift */
|
||||
ED_view3d_calc_camera_border(
|
||||
p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
|
||||
p->scene, depsgraph, p->region, v3d, rv3d, &p->subrect_data, true);
|
||||
p->subrect = &p->subrect_data;
|
||||
}
|
||||
}
|
||||
@@ -1322,7 +1325,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
|
||||
p->gsc.gpl = p->gpl;
|
||||
|
||||
p->gsc.sa = p->sa;
|
||||
p->gsc.ar = p->ar;
|
||||
p->gsc.region = p->region;
|
||||
p->gsc.v2d = p->v2d;
|
||||
|
||||
p->gsc.subrect_data = p->subrect_data;
|
||||
@@ -1359,9 +1362,9 @@ static void gp_paint_strokeend(tGPsdata *p)
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
|
||||
/* need to restore the original projection settings before packing up */
|
||||
view3d_region_operator_needs_opengl(p->win, p->ar);
|
||||
view3d_region_operator_needs_opengl(p->win, p->region);
|
||||
ED_view3d_autodist_init(
|
||||
p->depsgraph, p->ar, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
p->depsgraph, p->region, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
}
|
||||
|
||||
/* check if doing eraser or not */
|
||||
@@ -1776,7 +1779,7 @@ static void annotation_draw_apply_event(
|
||||
|
||||
/* force refresh */
|
||||
/* just active area for now, since doing whole screen is too slow */
|
||||
ED_region_tag_redraw(p->ar);
|
||||
ED_region_tag_redraw(p->region);
|
||||
}
|
||||
|
||||
/* ------------------------------- */
|
||||
@@ -2043,8 +2046,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
*/
|
||||
|
||||
if (p->status == GP_STATUS_IDLING) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
p->ar = ar;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
p->region = region;
|
||||
}
|
||||
|
||||
/* We don't pass on key events, GP is used with key-modifiers -
|
||||
@@ -2151,14 +2154,14 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
* NOTE: An exception here is that if launched from the toolbar,
|
||||
* whatever region we're now in should become the new region
|
||||
*/
|
||||
if ((p->ar) && (p->ar->regiontype == RGN_TYPE_TOOLS)) {
|
||||
if ((p->region) && (p->region->regiontype == RGN_TYPE_TOOLS)) {
|
||||
/* Change to whatever region is now under the mouse */
|
||||
ARegion *current_region = BKE_area_find_region_xy(p->sa, RGN_TYPE_ANY, event->x, event->y);
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("found alternative region %p (old was %p) - at %d %d (sa: %d %d -> %d %d)\n",
|
||||
current_region,
|
||||
p->ar,
|
||||
p->region,
|
||||
event->x,
|
||||
event->y,
|
||||
p->sa->totrct.xmin,
|
||||
@@ -2171,7 +2174,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
/* Assume that since we found the cursor in here, it is in bounds
|
||||
* and that this should be the region that we begin drawing in
|
||||
*/
|
||||
p->ar = current_region;
|
||||
p->region = current_region;
|
||||
in_bounds = true;
|
||||
}
|
||||
else {
|
||||
@@ -2184,9 +2187,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p->ar) {
|
||||
else if (p->region) {
|
||||
/* Perform bounds check. */
|
||||
const rcti *region_rect = ED_region_visible_rect(p->ar);
|
||||
const rcti *region_rect = ED_region_visible_rect(p->region);
|
||||
in_bounds = BLI_rcti_isect_pt_v(region_rect, event->mval);
|
||||
}
|
||||
else {
|
||||
@@ -2284,7 +2287,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
/* force refresh */
|
||||
/* just active area for now, since doing whole screen is too slow */
|
||||
ED_region_tag_redraw(p->ar);
|
||||
ED_region_tag_redraw(p->region);
|
||||
|
||||
/* event handled, so just tag as running modal */
|
||||
estate = OPERATOR_RUNNING_MODAL;
|
||||
|
||||
@@ -1120,8 +1120,8 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
|
||||
void ED_gp_draw_interpolation(const bContext *C, tGPDinterpolate *tgpi, const int type)
|
||||
{
|
||||
tGPDdraw tgpw;
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
tGPDinterpolate_layer *tgpil;
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
/* Drawing code is expected to run with fully evaluated depsgraph. */
|
||||
@@ -1143,8 +1143,8 @@ void ED_gp_draw_interpolation(const bContext *C, tGPDinterpolate *tgpi, const in
|
||||
tgpw.gpd = tgpi->gpd;
|
||||
tgpw.offsx = 0;
|
||||
tgpw.offsy = 0;
|
||||
tgpw.winx = tgpi->ar->winx;
|
||||
tgpw.winy = tgpi->ar->winy;
|
||||
tgpw.winx = tgpi->region->winx;
|
||||
tgpw.winy = tgpi->region->winy;
|
||||
tgpw.dflag = dflag;
|
||||
|
||||
/* turn on alpha-blending */
|
||||
@@ -1180,7 +1180,7 @@ void ED_gp_draw_fill(tGPDdraw *tgpw)
|
||||
}
|
||||
|
||||
/* draw a short status message in the top-right corner */
|
||||
static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar)
|
||||
static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *region)
|
||||
{
|
||||
|
||||
/* Cannot draw any status text when drawing OpenGL Renders */
|
||||
@@ -1189,7 +1189,7 @@ static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar
|
||||
}
|
||||
|
||||
/* Get bounds of region - Necessary to avoid problems with region overlap. */
|
||||
const rcti *rect = ED_region_visible_rect(ar);
|
||||
const rcti *rect = ED_region_visible_rect(region);
|
||||
|
||||
/* for now, this should only be used to indicate when we are in stroke editmode */
|
||||
if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct tGP_BrushEditData {
|
||||
Object *object;
|
||||
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
/* Current GPencil datablock */
|
||||
bGPdata *gpd;
|
||||
@@ -537,7 +537,7 @@ static void gp_brush_grab_calc_dvec(tGP_BrushEditData *gso)
|
||||
// TODO: incorporate pressure into this?
|
||||
// XXX: screen-space strokes in 3D space will suffer!
|
||||
if (gso->sa->spacetype == SPACE_VIEW3D) {
|
||||
RegionView3D *rv3d = gso->ar->regiondata;
|
||||
RegionView3D *rv3d = gso->region->regiondata;
|
||||
float *rvec = gso->object->loc;
|
||||
float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL);
|
||||
|
||||
@@ -557,7 +557,7 @@ static void gp_brush_grab_calc_dvec(tGP_BrushEditData *gso)
|
||||
copy_v2_v2(mval_f, r);
|
||||
}
|
||||
|
||||
ED_view3d_win_to_delta(gso->ar, mval_f, gso->dvec, zfac);
|
||||
ED_view3d_win_to_delta(gso->region, mval_f, gso->dvec, zfac);
|
||||
}
|
||||
else {
|
||||
/* 2D - just copy */
|
||||
@@ -662,7 +662,7 @@ static void gp_brush_calc_midpoint(tGP_BrushEditData *gso)
|
||||
/* Convert mouse position to 3D space
|
||||
* See: gpencil_paint.c :: gp_stroke_convertcoords()
|
||||
*/
|
||||
RegionView3D *rv3d = gso->ar->regiondata;
|
||||
RegionView3D *rv3d = gso->region->regiondata;
|
||||
const float *rvec = gso->object->loc;
|
||||
float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL);
|
||||
|
||||
@@ -671,10 +671,10 @@ static void gp_brush_calc_midpoint(tGP_BrushEditData *gso)
|
||||
float mval_prj[2];
|
||||
float dvec[3];
|
||||
|
||||
if (ED_view3d_project_float_global(gso->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
if (ED_view3d_project_float_global(gso->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
sub_v2_v2v2(mval_f, mval_prj, mval_f);
|
||||
ED_view3d_win_to_delta(gso->ar, mval_f, dvec, zfac);
|
||||
ED_view3d_win_to_delta(gso->region, mval_f, dvec, zfac);
|
||||
sub_v3_v3v3(gso->dvec, rvec, dvec);
|
||||
}
|
||||
else {
|
||||
@@ -774,7 +774,7 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso,
|
||||
/* Rotate in 2D or 3D space? */
|
||||
if (gps->flag & GP_STROKE_3DSPACE) {
|
||||
/* Perform rotation in 3D space... */
|
||||
RegionView3D *rv3d = gso->ar->regiondata;
|
||||
RegionView3D *rv3d = gso->region->regiondata;
|
||||
float rmat[3][3];
|
||||
float axis[3];
|
||||
float vec[3];
|
||||
@@ -888,11 +888,11 @@ static bool gp_brush_randomize_apply(tGP_BrushEditData *gso,
|
||||
/* 3D: Project to 3D space */
|
||||
if (gso->sa->spacetype == SPACE_VIEW3D) {
|
||||
bool flip;
|
||||
RegionView3D *rv3d = gso->ar->regiondata;
|
||||
RegionView3D *rv3d = gso->region->regiondata;
|
||||
float zfac = ED_view3d_calc_zfac(rv3d, &pt->x, &flip);
|
||||
if (flip == false) {
|
||||
float dvec[3];
|
||||
ED_view3d_win_to_delta(gso->gsc.ar, svec, dvec, zfac);
|
||||
ED_view3d_win_to_delta(gso->gsc.region, svec, dvec, zfac);
|
||||
add_v3_v3(&pt->x, dvec);
|
||||
/* compute lock axis */
|
||||
gpsculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
@@ -1343,7 +1343,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
gso->sa = CTX_wm_area(C);
|
||||
gso->ar = CTX_wm_region(C);
|
||||
gso->region = CTX_wm_region(C);
|
||||
|
||||
/* save mask */
|
||||
gso->mask = ts->gpencil_selectmode_sculpt;
|
||||
@@ -2094,7 +2094,7 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
|
||||
/* start drawing immediately? */
|
||||
if (is_modal == false) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
/* ensure that we'll have a new frame to draw on */
|
||||
gpsculpt_brush_init_stroke(C, gso);
|
||||
@@ -2104,7 +2104,7 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
gpsculpt_brush_apply_event(C, op, event);
|
||||
|
||||
/* redraw view with feedback */
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
@@ -2297,8 +2297,8 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
|
||||
|
||||
/* Redraw region? */
|
||||
if (redraw_region) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ED_region_tag_redraw(ar);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
|
||||
/* Redraw toolsettings (brush settings)? */
|
||||
|
||||
@@ -161,7 +161,7 @@ static void gp_strokepoint_convertcoords(bContext *C,
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
/* TODO(sergey): This function might be called from a loop, but no tagging is happening in it,
|
||||
* so it's not that expensive to ensure evaluated depsgraph here. However, ideally all the
|
||||
* parameters are to wrapped into a context style struct and queried from Context once.*/
|
||||
@@ -188,7 +188,7 @@ static void gp_strokepoint_convertcoords(bContext *C,
|
||||
|
||||
/* get screen coordinate */
|
||||
if (gps->flag & GP_STROKE_2DSPACE) {
|
||||
View2D *v2d = &ar->v2d;
|
||||
View2D *v2d = ®ion->v2d;
|
||||
UI_view2d_view_to_region_fl(v2d, pt->x, pt->y, &mvalf[0], &mvalf[1]);
|
||||
}
|
||||
else {
|
||||
@@ -197,12 +197,12 @@ static void gp_strokepoint_convertcoords(bContext *C,
|
||||
mvalf[1] = (((float)pt->y / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin;
|
||||
}
|
||||
else {
|
||||
mvalf[0] = (float)pt->x / 100.0f * ar->winx;
|
||||
mvalf[1] = (float)pt->y / 100.0f * ar->winy;
|
||||
mvalf[0] = (float)pt->x / 100.0f * region->winx;
|
||||
mvalf[1] = (float)pt->y / 100.0f * region->winy;
|
||||
}
|
||||
}
|
||||
|
||||
ED_view3d_win_to_3d(v3d, ar, fp, mvalf, p3d);
|
||||
ED_view3d_win_to_3d(v3d, region, fp, mvalf, p3d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1236,16 +1236,16 @@ static void gp_stroke_norm_curve_weights(Curve *cu, const float minmax_weights[2
|
||||
static int gp_camera_view_subrect(bContext *C, rctf *subrect)
|
||||
{
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
if (v3d) {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
/* for camera view set the subrect */
|
||||
if (rv3d->persp == RV3D_CAMOB) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, subrect, true);
|
||||
ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, subrect, true);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3410,8 +3410,8 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
SnapObjectContext *sctx = NULL;
|
||||
int oldframe = (int)DEG_get_ctime(depsgraph);
|
||||
|
||||
@@ -3426,7 +3426,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
|
||||
int cfra_prv = INT_MIN;
|
||||
/* init snap context for geometry projection */
|
||||
sctx = ED_transform_snap_object_context_create_view3d(
|
||||
bmain, scene, depsgraph, 0, ar, CTX_wm_view3d(C));
|
||||
bmain, scene, depsgraph, 0, region, CTX_wm_view3d(C));
|
||||
|
||||
/* Go through each editable + selected stroke, adjusting each of its points one by one... */
|
||||
GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
|
||||
@@ -3515,7 +3515,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
|
||||
float location[3] = {0.0f, 0.0f, 0.0f};
|
||||
float normal[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
ED_view3d_win_to_ray(ar, xy, &ray_start[0], &ray_normal[0]);
|
||||
ED_view3d_win_to_ray(region, xy, &ray_start[0], &ray_normal[0]);
|
||||
if (ED_transform_snap_object_project_ray(sctx,
|
||||
&(const struct SnapObjectParams){
|
||||
.snap_select = SNAP_ALL,
|
||||
|
||||
@@ -97,7 +97,7 @@ typedef struct tGPDfill {
|
||||
/** view3 where painting originated */
|
||||
struct View3D *v3d;
|
||||
/** region where painting originated */
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
/** current GP datablock */
|
||||
struct bGPdata *gpd;
|
||||
/** current material */
|
||||
@@ -237,8 +237,8 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
|
||||
tgpw.gpd = gpd;
|
||||
tgpw.offsx = 0;
|
||||
tgpw.offsy = 0;
|
||||
tgpw.winx = tgpf->ar->winx;
|
||||
tgpw.winy = tgpf->ar->winy;
|
||||
tgpw.winx = tgpf->region->winx;
|
||||
tgpw.winy = tgpf->region->winy;
|
||||
tgpw.dflag = 0;
|
||||
tgpw.disable_fill = 1;
|
||||
tgpw.dflag |= (GP_DRAWFILLS_ONLY3D | GP_DRAWFILLS_NOSTATUS);
|
||||
@@ -328,26 +328,26 @@ static bool gp_render_offscreen(tGPDfill *tgpf)
|
||||
}
|
||||
|
||||
/* set temporary new size */
|
||||
tgpf->bwinx = tgpf->ar->winx;
|
||||
tgpf->bwiny = tgpf->ar->winy;
|
||||
tgpf->brect = tgpf->ar->winrct;
|
||||
tgpf->bwinx = tgpf->region->winx;
|
||||
tgpf->bwiny = tgpf->region->winy;
|
||||
tgpf->brect = tgpf->region->winrct;
|
||||
|
||||
/* resize ar */
|
||||
tgpf->ar->winrct.xmin = 0;
|
||||
tgpf->ar->winrct.ymin = 0;
|
||||
tgpf->ar->winrct.xmax = (int)tgpf->ar->winx * tgpf->fill_factor;
|
||||
tgpf->ar->winrct.ymax = (int)tgpf->ar->winy * tgpf->fill_factor;
|
||||
tgpf->ar->winx = (short)abs(tgpf->ar->winrct.xmax - tgpf->ar->winrct.xmin);
|
||||
tgpf->ar->winy = (short)abs(tgpf->ar->winrct.ymax - tgpf->ar->winrct.ymin);
|
||||
/* resize region */
|
||||
tgpf->region->winrct.xmin = 0;
|
||||
tgpf->region->winrct.ymin = 0;
|
||||
tgpf->region->winrct.xmax = (int)tgpf->region->winx * tgpf->fill_factor;
|
||||
tgpf->region->winrct.ymax = (int)tgpf->region->winy * tgpf->fill_factor;
|
||||
tgpf->region->winx = (short)abs(tgpf->region->winrct.xmax - tgpf->region->winrct.xmin);
|
||||
tgpf->region->winy = (short)abs(tgpf->region->winrct.ymax - tgpf->region->winrct.ymin);
|
||||
|
||||
/* save new size */
|
||||
tgpf->sizex = (int)tgpf->ar->winx;
|
||||
tgpf->sizey = (int)tgpf->ar->winy;
|
||||
tgpf->sizex = (int)tgpf->region->winx;
|
||||
tgpf->sizey = (int)tgpf->region->winy;
|
||||
|
||||
/* adjust center */
|
||||
float center[2];
|
||||
center[0] = (float)tgpf->center[0] * ((float)tgpf->ar->winx / (float)tgpf->bwinx);
|
||||
center[1] = (float)tgpf->center[1] * ((float)tgpf->ar->winy / (float)tgpf->bwiny);
|
||||
center[0] = (float)tgpf->center[0] * ((float)tgpf->region->winx / (float)tgpf->bwinx);
|
||||
center[1] = (float)tgpf->center[1] * ((float)tgpf->region->winy / (float)tgpf->bwiny);
|
||||
round_v2i_v2fl(tgpf->center, center);
|
||||
|
||||
char err_out[256] = "unknown";
|
||||
@@ -402,7 +402,7 @@ static bool gp_render_offscreen(tGPDfill *tgpf)
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
ED_view3d_update_viewmat(
|
||||
tgpf->depsgraph, tgpf->scene, tgpf->v3d, tgpf->ar, NULL, winmat, NULL, true);
|
||||
tgpf->depsgraph, tgpf->scene, tgpf->v3d, tgpf->region, NULL, winmat, NULL, true);
|
||||
/* set for opengl */
|
||||
GPU_matrix_projection_set(tgpf->rv3d->winmat);
|
||||
GPU_matrix_set(tgpf->rv3d->viewmat);
|
||||
@@ -930,8 +930,8 @@ static void gpencil_get_depth_array(tGPDfill *tgpf)
|
||||
*/
|
||||
if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) {
|
||||
/* need to restore the original projection settings before packing up */
|
||||
view3d_region_operator_needs_opengl(tgpf->win, tgpf->ar);
|
||||
ED_view3d_autodist_init(tgpf->depsgraph, tgpf->ar, tgpf->v3d, 0);
|
||||
view3d_region_operator_needs_opengl(tgpf->win, tgpf->region);
|
||||
ED_view3d_autodist_init(tgpf->depsgraph, tgpf->region, tgpf->v3d, 0);
|
||||
|
||||
/* Since strokes are so fine, when using their depth we need a margin
|
||||
* otherwise they might get missed. */
|
||||
@@ -949,9 +949,11 @@ static void gpencil_get_depth_array(tGPDfill *tgpf)
|
||||
int mval_i[2];
|
||||
round_v2i_v2fl(mval_i, &ptc->x);
|
||||
|
||||
if ((ED_view3d_autodist_depth(tgpf->ar, mval_i, depth_margin, tgpf->depth_arr + i) == 0) &&
|
||||
(i && (ED_view3d_autodist_depth_seg(
|
||||
tgpf->ar, mval_i, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) {
|
||||
if ((ED_view3d_autodist_depth(tgpf->region, mval_i, depth_margin, tgpf->depth_arr + i) ==
|
||||
0) &&
|
||||
(i &&
|
||||
(ED_view3d_autodist_depth_seg(
|
||||
tgpf->region, mval_i, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) {
|
||||
interp_depth = true;
|
||||
}
|
||||
else {
|
||||
@@ -1080,7 +1082,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
|
||||
for (int i = 0; i < tgpf->sbuffer_used && point2D; i++, point2D++, pt++) {
|
||||
/* convert screen-coordinates to 3D coordinates */
|
||||
gp_stroke_convertcoords_tpoint(tgpf->scene,
|
||||
tgpf->ar,
|
||||
tgpf->region,
|
||||
tgpf->ob,
|
||||
tgpf->gpl,
|
||||
point2D,
|
||||
@@ -1164,12 +1166,12 @@ static void gpencil_draw_boundary_lines(const bContext *UNUSED(C), tGPDfill *tgp
|
||||
}
|
||||
|
||||
/* Drawing callback for modal operator in 3d mode */
|
||||
static void gpencil_fill_draw_3d(const bContext *C, ARegion *UNUSED(ar), void *arg)
|
||||
static void gpencil_fill_draw_3d(const bContext *C, ARegion *UNUSED(region), void *arg)
|
||||
{
|
||||
tGPDfill *tgpf = (tGPDfill *)arg;
|
||||
/* draw only in the region that originated operator. This is required for multiwindow */
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
if (ar != tgpf->ar) {
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
if (region != tgpf->region) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1218,8 +1220,8 @@ static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *UNUSED(op))
|
||||
tgpf->scene = CTX_data_scene(C);
|
||||
tgpf->ob = CTX_data_active_object(C);
|
||||
tgpf->sa = CTX_wm_area(C);
|
||||
tgpf->ar = CTX_wm_region(C);
|
||||
tgpf->rv3d = tgpf->ar->regiondata;
|
||||
tgpf->region = CTX_wm_region(C);
|
||||
tgpf->rv3d = tgpf->region->regiondata;
|
||||
tgpf->v3d = tgpf->sa->spacedata.first;
|
||||
tgpf->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
tgpf->win = CTX_wm_window(C);
|
||||
@@ -1290,7 +1292,7 @@ static void gpencil_fill_exit(bContext *C, wmOperator *op)
|
||||
|
||||
/* remove drawing handler */
|
||||
if (tgpf->draw_handle_3d) {
|
||||
ED_region_draw_cb_exit(tgpf->ar->type, tgpf->draw_handle_3d);
|
||||
ED_region_draw_cb_exit(tgpf->region->type, tgpf->draw_handle_3d);
|
||||
}
|
||||
|
||||
/* delete temp image */
|
||||
@@ -1394,7 +1396,7 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
|
||||
/* Enable custom drawing handlers to show help lines */
|
||||
if (tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) {
|
||||
tgpf->draw_handle_3d = ED_region_draw_cb_activate(
|
||||
tgpf->ar->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW);
|
||||
tgpf->region->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW);
|
||||
}
|
||||
|
||||
WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_PAINT_BRUSH);
|
||||
@@ -1426,14 +1428,15 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
tgpf->on_back = RNA_boolean_get(op->ptr, "on_back");
|
||||
/* first time the event is not enabled to show help lines */
|
||||
if ((tgpf->oldkey != -1) || ((tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) == 0)) {
|
||||
ARegion *ar = BKE_area_find_region_xy(CTX_wm_area(C), RGN_TYPE_ANY, event->x, event->y);
|
||||
if (ar) {
|
||||
ARegion *region = BKE_area_find_region_xy(
|
||||
CTX_wm_area(C), RGN_TYPE_ANY, event->x, event->y);
|
||||
if (region) {
|
||||
bool in_bounds = false;
|
||||
|
||||
/* Perform bounds check */
|
||||
in_bounds = BLI_rcti_isect_pt(&ar->winrct, event->x, event->y);
|
||||
in_bounds = BLI_rcti_isect_pt(®ion->winrct, event->x, event->y);
|
||||
|
||||
if ((in_bounds) && (ar->regiontype == RGN_TYPE_WINDOW)) {
|
||||
if ((in_bounds) && (region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
/* TODO GPXX: Verify the mouse click is right for any window size */
|
||||
tgpf->center[0] = event->mval[0];
|
||||
tgpf->center[1] = event->mval[1];
|
||||
@@ -1461,9 +1464,9 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
|
||||
/* restore size */
|
||||
tgpf->ar->winx = (short)tgpf->bwinx;
|
||||
tgpf->ar->winy = (short)tgpf->bwiny;
|
||||
tgpf->ar->winrct = tgpf->brect;
|
||||
tgpf->region->winx = (short)tgpf->bwinx;
|
||||
tgpf->region->winy = (short)tgpf->bwiny;
|
||||
tgpf->region->winrct = tgpf->brect;
|
||||
|
||||
/* free temp stack data */
|
||||
if (tgpf->stack) {
|
||||
|
||||
@@ -116,7 +116,7 @@ typedef struct tGPDinterpolate {
|
||||
/** area where painting originated */
|
||||
struct ScrArea *sa;
|
||||
/** region where painting originated */
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
/** current GP datablock */
|
||||
struct bGPdata *gpd;
|
||||
/** current material */
|
||||
@@ -162,7 +162,7 @@ typedef struct tGPDprimitive {
|
||||
/** view3d where painting originated */
|
||||
struct View3D *v3d;
|
||||
/** region where painting originated */
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
/** current GP datablock */
|
||||
struct bGPdata *gpd;
|
||||
/** current material */
|
||||
@@ -252,7 +252,7 @@ typedef struct GP_SpaceConversion {
|
||||
struct bGPDlayer *gpl;
|
||||
|
||||
struct ScrArea *sa;
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
struct View2D *v2d;
|
||||
|
||||
rctf *subrect; /* for using the camera rect within the 3d view */
|
||||
@@ -308,7 +308,7 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
|
||||
|
||||
/* helper to convert 2d to 3d */
|
||||
void gp_stroke_convertcoords_tpoint(struct Scene *scene,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
const struct tGPspoint *point2D,
|
||||
|
||||
@@ -335,7 +335,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
|
||||
|
||||
/* Drawing callback for modal operator in screen mode */
|
||||
static void gpencil_interpolate_draw_screen(const struct bContext *C,
|
||||
ARegion *UNUSED(ar),
|
||||
ARegion *UNUSED(region),
|
||||
void *arg)
|
||||
{
|
||||
tGPDinterpolate *tgpi = (tGPDinterpolate *)arg;
|
||||
@@ -343,7 +343,7 @@ static void gpencil_interpolate_draw_screen(const struct bContext *C,
|
||||
}
|
||||
|
||||
/* Drawing callback for modal operator in 3d mode */
|
||||
static void gpencil_interpolate_draw_3d(const bContext *C, ARegion *UNUSED(ar), void *arg)
|
||||
static void gpencil_interpolate_draw_3d(const bContext *C, ARegion *UNUSED(region), void *arg)
|
||||
{
|
||||
tGPDinterpolate *tgpi = (tGPDinterpolate *)arg;
|
||||
ED_gp_draw_interpolation(C, tgpi, REGION_DRAW_POST_VIEW);
|
||||
@@ -356,8 +356,8 @@ static void gpencil_interpolate_draw_3d(const bContext *C, ARegion *UNUSED(ar),
|
||||
*/
|
||||
static void gpencil_mouse_update_shift(tGPDinterpolate *tgpi, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
float mid = (float)(tgpi->ar->winx - tgpi->ar->winrct.xmin) / 2.0f;
|
||||
float mpos = event->x - tgpi->ar->winrct.xmin;
|
||||
float mid = (float)(tgpi->region->winx - tgpi->region->winrct.xmin) / 2.0f;
|
||||
float mpos = event->x - tgpi->region->winrct.xmin;
|
||||
|
||||
if (mpos >= mid) {
|
||||
tgpi->shift = ((mpos - mid) * tgpi->high_limit) / mid;
|
||||
@@ -422,10 +422,10 @@ static void gpencil_interpolate_exit(bContext *C, wmOperator *op)
|
||||
if (tgpi) {
|
||||
/* remove drawing handler */
|
||||
if (tgpi->draw_handle_screen) {
|
||||
ED_region_draw_cb_exit(tgpi->ar->type, tgpi->draw_handle_screen);
|
||||
ED_region_draw_cb_exit(tgpi->region->type, tgpi->draw_handle_screen);
|
||||
}
|
||||
if (tgpi->draw_handle_3d) {
|
||||
ED_region_draw_cb_exit(tgpi->ar->type, tgpi->draw_handle_3d);
|
||||
ED_region_draw_cb_exit(tgpi->region->type, tgpi->draw_handle_3d);
|
||||
}
|
||||
|
||||
/* clear status message area */
|
||||
@@ -457,7 +457,7 @@ static bool gp_interpolate_set_init_values(bContext *C, wmOperator *op, tGPDinte
|
||||
/* set current scene and window */
|
||||
tgpi->scene = CTX_data_scene(C);
|
||||
tgpi->sa = CTX_wm_area(C);
|
||||
tgpi->ar = CTX_wm_region(C);
|
||||
tgpi->region = CTX_wm_region(C);
|
||||
tgpi->flag = ts->gp_interpolate.flag;
|
||||
|
||||
/* set current frame number */
|
||||
@@ -555,9 +555,9 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||
* and each handler use different coord system
|
||||
*/
|
||||
tgpi->draw_handle_screen = ED_region_draw_cb_activate(
|
||||
tgpi->ar->type, gpencil_interpolate_draw_screen, tgpi, REGION_DRAW_POST_PIXEL);
|
||||
tgpi->region->type, gpencil_interpolate_draw_screen, tgpi, REGION_DRAW_POST_PIXEL);
|
||||
tgpi->draw_handle_3d = ED_region_draw_cb_activate(
|
||||
tgpi->ar->type, gpencil_interpolate_draw_3d, tgpi, REGION_DRAW_POST_VIEW);
|
||||
tgpi->region->type, gpencil_interpolate_draw_3d, tgpi, REGION_DRAW_POST_VIEW);
|
||||
|
||||
/* set cursor to indicate modal */
|
||||
WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL);
|
||||
|
||||
@@ -154,7 +154,7 @@ typedef struct tGPsdata {
|
||||
/** area where painting originated. */
|
||||
ScrArea *sa;
|
||||
/** region where painting originated. */
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
/** needed for GP_STROKE_2DSPACE. */
|
||||
View2D *v2d;
|
||||
/** for using the camera rect within the 3d view. */
|
||||
@@ -411,7 +411,7 @@ static void gp_reproject_toplane(tGPsdata *p, bGPDstroke *gps)
|
||||
Object *obact = (Object *)p->ownerPtr.data;
|
||||
|
||||
float origin[3];
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
|
||||
/* verify the stroke mode is CURSOR 3d space mode */
|
||||
if ((gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) == 0) {
|
||||
@@ -446,7 +446,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
|
||||
int mval_i[2];
|
||||
round_v2i_v2fl(mval_i, mval);
|
||||
|
||||
if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval_i, out, 0, depth))) {
|
||||
if (gpencil_project_check(p) &&
|
||||
(ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth))) {
|
||||
/* projecting onto 3D-Geometry
|
||||
* - nothing more needs to be done here, since view_autodist_simple() has already done it
|
||||
*/
|
||||
@@ -468,12 +469,12 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
|
||||
* works OK, but it could of course be improved. */
|
||||
|
||||
gp_get_3d_reference(p, rvec);
|
||||
zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
|
||||
zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec, NULL);
|
||||
|
||||
if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
if (ED_view3d_project_float_global(p->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
sub_v2_v2v2(mval_f, mval_prj, mval);
|
||||
ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
|
||||
ED_view3d_win_to_delta(p->region, mval_f, dvec, zfac);
|
||||
sub_v3_v3v3(out, rvec, dvec);
|
||||
}
|
||||
else {
|
||||
@@ -789,7 +790,7 @@ static short gp_stroke_addpoint(
|
||||
ToolSettings *ts = p->scene->toolsettings;
|
||||
Object *obact = (Object *)p->ownerPtr.data;
|
||||
Depsgraph *depsgraph = p->depsgraph;
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
MaterialGPencilStyle *gp_style = p->material->gp_style;
|
||||
const int def_nr = obact->actdef - 1;
|
||||
@@ -954,11 +955,11 @@ static short gp_stroke_addpoint(
|
||||
float origin[3];
|
||||
gp_get_3d_reference(p, origin);
|
||||
/* reproject current */
|
||||
ED_gpencil_tpoint_to_point(p->ar, origin, pt, &spt);
|
||||
ED_gpencil_tpoint_to_point(p->region, origin, pt, &spt);
|
||||
ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt);
|
||||
|
||||
/* reproject previous */
|
||||
ED_gpencil_tpoint_to_point(p->ar, origin, ptb, &spt2);
|
||||
ED_gpencil_tpoint_to_point(p->region, origin, ptb, &spt2);
|
||||
ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt2);
|
||||
p->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize;
|
||||
pt->uv_fac = p->totpixlen;
|
||||
@@ -1029,9 +1030,11 @@ static short gp_stroke_addpoint(
|
||||
* so initialize depth buffer before converting coordinates
|
||||
*/
|
||||
if (gpencil_project_check(p)) {
|
||||
view3d_region_operator_needs_opengl(p->win, p->ar);
|
||||
ED_view3d_autodist_init(
|
||||
p->depsgraph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
view3d_region_operator_needs_opengl(p->win, p->region);
|
||||
ED_view3d_autodist_init(p->depsgraph,
|
||||
p->region,
|
||||
v3d,
|
||||
(ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
}
|
||||
|
||||
/* convert screen-coordinates to appropriate coordinates (and store them) */
|
||||
@@ -1092,7 +1095,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
|
||||
ToolSettings *ts = p->scene->toolsettings;
|
||||
Depsgraph *depsgraph = p->depsgraph;
|
||||
Object *obact = (Object *)p->ownerPtr.data;
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
const int def_nr = obact->actdef - 1;
|
||||
const bool have_weight = (bool)BLI_findlink(&obact->defbase, def_nr);
|
||||
const char *align_flag = &ts->gpencil_v3d_align;
|
||||
@@ -1306,9 +1309,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
|
||||
|
||||
round_v2i_v2fl(mval_i, &ptc->x);
|
||||
|
||||
if ((ED_view3d_autodist_depth(p->ar, mval_i, depth_margin, depth_arr + i) == 0) &&
|
||||
if ((ED_view3d_autodist_depth(p->region, mval_i, depth_margin, depth_arr + i) == 0) &&
|
||||
(i && (ED_view3d_autodist_depth_seg(
|
||||
p->ar, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
|
||||
p->region, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
|
||||
interp_depth = true;
|
||||
}
|
||||
else {
|
||||
@@ -1528,7 +1531,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
|
||||
|
||||
if ((gp_settings != NULL) && (p->sa->spacetype == SPACE_VIEW3D) &&
|
||||
(gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) {
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
bGPDlayer *gpl = p->gpl;
|
||||
|
||||
const int mval_i[2] = {x, y};
|
||||
@@ -1539,7 +1542,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
|
||||
/* calculate difference matrix if parent object */
|
||||
ED_gpencil_parent_location(p->depsgraph, obact, p->gpd, gpl, diff_mat);
|
||||
|
||||
if (ED_view3d_autodist_simple(p->ar, mval_i, mval_3d, 0, NULL)) {
|
||||
if (ED_view3d_autodist_simple(p->region, mval_i, mval_3d, 0, NULL)) {
|
||||
const float depth_mval = view3d_point_depth(rv3d, mval_3d);
|
||||
|
||||
mul_v3_m4v3(fpt, diff_mat, &pt->x);
|
||||
@@ -1891,8 +1894,8 @@ static void gp_stroke_doeraser(tGPsdata *p)
|
||||
if (p->sa->spacetype == SPACE_VIEW3D) {
|
||||
if ((gp_settings != NULL) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) {
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
view3d_region_operator_needs_opengl(p->win, p->ar);
|
||||
ED_view3d_autodist_init(p->depsgraph, p->ar, v3d, 0);
|
||||
view3d_region_operator_needs_opengl(p->win, p->region);
|
||||
ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2101,7 +2104,7 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
|
||||
Main *bmain = CTX_data_main(C);
|
||||
bGPdata **gpd_ptr = NULL;
|
||||
ScrArea *curarea = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
|
||||
@@ -2129,17 +2132,17 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
|
||||
/* supported views first */
|
||||
case SPACE_VIEW3D: {
|
||||
/* View3D *v3d = curarea->spacedata.first; */
|
||||
/* RegionView3D *rv3d = ar->regiondata; */
|
||||
/* RegionView3D *rv3d = region->regiondata; */
|
||||
|
||||
/* set current area
|
||||
* - must verify that region data is 3D-view (and not something else)
|
||||
*/
|
||||
/* CAUTION: If this is the "toolbar", then this will change on the first stroke */
|
||||
p->sa = curarea;
|
||||
p->ar = ar;
|
||||
p->region = region;
|
||||
p->align_flag = &ts->gpencil_v3d_align;
|
||||
|
||||
if (ar->regiondata == NULL) {
|
||||
if (region->regiondata == NULL) {
|
||||
p->status = GP_STATUS_ERROR;
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf(
|
||||
@@ -2406,13 +2409,13 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
|
||||
if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) {
|
||||
if (p->sa->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
|
||||
/* for camera view set the subrect */
|
||||
if (rv3d->persp == RV3D_CAMOB) {
|
||||
/* no shift */
|
||||
ED_view3d_calc_camera_border(
|
||||
p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
|
||||
p->scene, depsgraph, p->region, v3d, rv3d, &p->subrect_data, true);
|
||||
p->subrect = &p->subrect_data;
|
||||
}
|
||||
}
|
||||
@@ -2423,7 +2426,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
|
||||
p->gsc.gpl = p->gpl;
|
||||
|
||||
p->gsc.sa = p->sa;
|
||||
p->gsc.ar = p->ar;
|
||||
p->gsc.region = p->region;
|
||||
p->gsc.v2d = p->v2d;
|
||||
|
||||
p->gsc.subrect_data = p->subrect_data;
|
||||
@@ -2453,9 +2456,9 @@ static void gp_paint_strokeend(tGPsdata *p)
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
|
||||
/* need to restore the original projection settings before packing up */
|
||||
view3d_region_operator_needs_opengl(p->win, p->ar);
|
||||
view3d_region_operator_needs_opengl(p->win, p->region);
|
||||
ED_view3d_autodist_init(
|
||||
p->depsgraph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
p->depsgraph, p->region, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
}
|
||||
|
||||
/* check if doing eraser or not */
|
||||
@@ -2910,7 +2913,7 @@ static void gp_origin_get(tGPsdata *p, float origin[2])
|
||||
static void gpencil_speed_guide_init(tGPsdata *p, GP_Sculpt_Guide *guide)
|
||||
{
|
||||
/* calculate initial guide values */
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
float scale = 1.0f;
|
||||
if (rv3d->is_persp) {
|
||||
float vec[3];
|
||||
@@ -3193,7 +3196,7 @@ static void gpencil_draw_apply_event(bContext *C,
|
||||
|
||||
/* force refresh */
|
||||
/* just active area for now, since doing whole screen is too slow */
|
||||
ED_region_tag_redraw(p->ar);
|
||||
ED_region_tag_redraw(p->region);
|
||||
}
|
||||
|
||||
/* ------------------------------- */
|
||||
@@ -3584,7 +3587,7 @@ static bool gpencil_add_fake_events(bContext *C, wmOperator *op, const wmEvent *
|
||||
return added_events;
|
||||
}
|
||||
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
RegionView3D *rv3d = p->region->regiondata;
|
||||
float defaultpixsize = rv3d->pixsize * 1000.0f;
|
||||
int samples = (GP_MAX_INPUT_SAMPLES - input_samples + 1);
|
||||
float thickness = (float)brush->size;
|
||||
@@ -3672,8 +3675,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
*/
|
||||
|
||||
if (p->status == GP_STATUS_IDLING) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
p->ar = ar;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
p->region = region;
|
||||
}
|
||||
|
||||
/* special mode for editing control points */
|
||||
@@ -3851,14 +3854,14 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
* NOTE: An exception here is that if launched from the toolbar,
|
||||
* whatever region we're now in should become the new region
|
||||
*/
|
||||
if ((p->ar) && (p->ar->regiontype == RGN_TYPE_TOOLS)) {
|
||||
if ((p->region) && (p->region->regiontype == RGN_TYPE_TOOLS)) {
|
||||
/* Change to whatever region is now under the mouse */
|
||||
ARegion *current_region = BKE_area_find_region_xy(p->sa, RGN_TYPE_ANY, event->x, event->y);
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("found alternative region %p (old was %p) - at %d %d (sa: %d %d -> %d %d)\n",
|
||||
current_region,
|
||||
p->ar,
|
||||
p->region,
|
||||
event->x,
|
||||
event->y,
|
||||
p->sa->totrct.xmin,
|
||||
@@ -3871,7 +3874,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
/* Assume that since we found the cursor in here, it is in bounds
|
||||
* and that this should be the region that we begin drawing in
|
||||
*/
|
||||
p->ar = current_region;
|
||||
p->region = current_region;
|
||||
in_bounds = true;
|
||||
}
|
||||
else {
|
||||
@@ -3884,9 +3887,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p->ar) {
|
||||
else if (p->region) {
|
||||
/* Perform bounds check using */
|
||||
const rcti *region_rect = ED_region_visible_rect(p->ar);
|
||||
const rcti *region_rect = ED_region_visible_rect(p->region);
|
||||
in_bounds = BLI_rcti_isect_pt_v(region_rect, event->mval);
|
||||
}
|
||||
else {
|
||||
@@ -3942,7 +3945,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
else if (event->val == KM_RELEASE) {
|
||||
p->status = GP_STATUS_IDLING;
|
||||
op->flag |= OP_IS_MODAL_CURSOR_REGION;
|
||||
ED_region_tag_redraw(p->ar);
|
||||
ED_region_tag_redraw(p->region);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4008,7 +4011,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
/* force refresh */
|
||||
/* just active area for now, since doing whole screen is too slow */
|
||||
ED_region_tag_redraw(p->ar);
|
||||
ED_region_tag_redraw(p->region);
|
||||
|
||||
/* event handled, so just tag as running modal */
|
||||
estate = OPERATOR_RUNNING_MODAL;
|
||||
|
||||
@@ -774,9 +774,9 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
||||
bool found_depth = false;
|
||||
|
||||
/* need to restore the original projection settings before packing up */
|
||||
view3d_region_operator_needs_opengl(tgpi->win, tgpi->ar);
|
||||
view3d_region_operator_needs_opengl(tgpi->win, tgpi->region);
|
||||
ED_view3d_autodist_init(tgpi->depsgraph,
|
||||
tgpi->ar,
|
||||
tgpi->region,
|
||||
tgpi->v3d,
|
||||
(ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
|
||||
|
||||
@@ -784,9 +784,9 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
||||
tGPspoint *ptc = &points2D[0];
|
||||
for (i = 0; i < gps->totpoints; i++, ptc++) {
|
||||
round_v2i_v2fl(mval_i, &ptc->x);
|
||||
if ((ED_view3d_autodist_depth(tgpi->ar, mval_i, depth_margin, depth_arr + i) == 0) &&
|
||||
if ((ED_view3d_autodist_depth(tgpi->region, mval_i, depth_margin, depth_arr + i) == 0) &&
|
||||
(i && (ED_view3d_autodist_depth_seg(
|
||||
tgpi->ar, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
|
||||
tgpi->region, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
|
||||
interp_depth = true;
|
||||
}
|
||||
else {
|
||||
@@ -982,12 +982,12 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
||||
float origin[3];
|
||||
ED_gp_get_drawing_reference(tgpi->scene, tgpi->ob, tgpi->gpl, ts->gpencil_v3d_align, origin);
|
||||
/* reproject current */
|
||||
ED_gpencil_tpoint_to_point(tgpi->ar, origin, tpt, &spt);
|
||||
ED_gpencil_tpoint_to_point(tgpi->region, origin, tpt, &spt);
|
||||
ED_gp_project_point_to_plane(
|
||||
tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt);
|
||||
|
||||
/* reproject previous */
|
||||
ED_gpencil_tpoint_to_point(tgpi->ar, origin, tptb, &spt2);
|
||||
ED_gpencil_tpoint_to_point(tgpi->region, origin, tptb, &spt2);
|
||||
ED_gp_project_point_to_plane(
|
||||
tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt2);
|
||||
tgpi->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize;
|
||||
@@ -1015,8 +1015,13 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
||||
}
|
||||
|
||||
/* convert screen-coordinates to 3D coordinates */
|
||||
gp_stroke_convertcoords_tpoint(
|
||||
tgpi->scene, tgpi->ar, tgpi->ob, tgpi->gpl, p2d, depth_arr ? depth_arr + i : NULL, &pt->x);
|
||||
gp_stroke_convertcoords_tpoint(tgpi->scene,
|
||||
tgpi->region,
|
||||
tgpi->ob,
|
||||
tgpi->gpl,
|
||||
p2d,
|
||||
depth_arr ? depth_arr + i : NULL,
|
||||
&pt->x);
|
||||
|
||||
pt->pressure = pressure;
|
||||
pt->strength = strength;
|
||||
@@ -1040,7 +1045,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
||||
for (int i = 0; i < tgpi->gpd->runtime.tot_cp_points; i++) {
|
||||
bGPDcontrolpoint *cp = &cps[i];
|
||||
gp_stroke_convertcoords_tpoint(
|
||||
tgpi->scene, tgpi->ar, tgpi->ob, tgpi->gpl, (tGPspoint *)cp, NULL, &cp->x);
|
||||
tgpi->scene, tgpi->region, tgpi->ob, tgpi->gpl, (tGPspoint *)cp, NULL, &cp->x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1160,8 +1165,8 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
|
||||
tgpi->scene = scene;
|
||||
tgpi->ob = CTX_data_active_object(C);
|
||||
tgpi->sa = CTX_wm_area(C);
|
||||
tgpi->ar = CTX_wm_region(C);
|
||||
tgpi->rv3d = tgpi->ar->regiondata;
|
||||
tgpi->region = CTX_wm_region(C);
|
||||
tgpi->rv3d = tgpi->region->regiondata;
|
||||
tgpi->v3d = tgpi->sa->spacedata.first;
|
||||
tgpi->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
tgpi->win = CTX_wm_window(C);
|
||||
@@ -1175,7 +1180,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
|
||||
/* set GP datablock */
|
||||
tgpi->gpd = gpd;
|
||||
/* region where paint was originated */
|
||||
tgpi->gpd->runtime.ar = tgpi->ar;
|
||||
tgpi->gpd->runtime.ar = tgpi->region;
|
||||
|
||||
/* if brush doesn't exist, create a new set (fix damaged files from old versions) */
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
|
||||
@@ -575,7 +575,7 @@ bool ED_gpencil_stroke_color_use(Object *ob, const bGPDlayer *gpl, const bGPDstr
|
||||
void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
/* zero out the storage (just in case) */
|
||||
memset(r_gsc, 0, sizeof(GP_SpaceConversion));
|
||||
@@ -586,8 +586,8 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
|
||||
r_gsc->ob = CTX_data_active_object(C);
|
||||
|
||||
r_gsc->sa = sa;
|
||||
r_gsc->ar = ar;
|
||||
r_gsc->v2d = &ar->v2d;
|
||||
r_gsc->region = region;
|
||||
r_gsc->v2d = ®ion->v2d;
|
||||
|
||||
/* init region-specific stuff */
|
||||
if (sa->spacetype == SPACE_VIEW3D) {
|
||||
@@ -595,17 +595,18 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
View3D *v3d = (View3D *)CTX_wm_space_data(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
|
||||
/* init 3d depth buffers */
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
view3d_region_operator_needs_opengl(win, ar);
|
||||
ED_view3d_autodist_init(depsgraph, ar, v3d, 0);
|
||||
view3d_region_operator_needs_opengl(win, region);
|
||||
ED_view3d_autodist_init(depsgraph, region, v3d, 0);
|
||||
|
||||
/* for camera view set the subrect */
|
||||
if (rv3d->persp == RV3D_CAMOB) {
|
||||
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &r_gsc->subrect_data, true);
|
||||
ED_view3d_calc_camera_border(
|
||||
scene, depsgraph, region, v3d, rv3d, &r_gsc->subrect_data, true);
|
||||
r_gsc->subrect = &r_gsc->subrect_data;
|
||||
}
|
||||
}
|
||||
@@ -680,7 +681,7 @@ void gp_apply_parent_point(
|
||||
void gp_point_to_xy(
|
||||
const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, int *r_x, int *r_y)
|
||||
{
|
||||
const ARegion *ar = gsc->ar;
|
||||
const ARegion *region = gsc->region;
|
||||
const View2D *v2d = gsc->v2d;
|
||||
const rctf *subrect = gsc->subrect;
|
||||
int xyval[2];
|
||||
@@ -690,7 +691,8 @@ void gp_point_to_xy(
|
||||
BLI_assert(!(gps->flag & GP_STROKE_2DSPACE) || (gsc->sa->spacetype != SPACE_VIEW3D));
|
||||
|
||||
if (gps->flag & GP_STROKE_3DSPACE) {
|
||||
if (ED_view3d_project_int_global(ar, &pt->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||
if (ED_view3d_project_int_global(region, &pt->x, xyval, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
*r_x = xyval[0];
|
||||
*r_y = xyval[1];
|
||||
}
|
||||
@@ -707,8 +709,8 @@ void gp_point_to_xy(
|
||||
else {
|
||||
if (subrect == NULL) {
|
||||
/* normal 3D view (or view space) */
|
||||
*r_x = (int)(pt->x / 100 * ar->winx);
|
||||
*r_y = (int)(pt->y / 100 * ar->winy);
|
||||
*r_x = (int)(pt->x / 100 * region->winx);
|
||||
*r_y = (int)(pt->y / 100 * region->winy);
|
||||
}
|
||||
else {
|
||||
/* camera view, use subrect */
|
||||
@@ -737,7 +739,7 @@ void gp_point_to_xy_fl(const GP_SpaceConversion *gsc,
|
||||
float *r_x,
|
||||
float *r_y)
|
||||
{
|
||||
const ARegion *ar = gsc->ar;
|
||||
const ARegion *region = gsc->region;
|
||||
const View2D *v2d = gsc->v2d;
|
||||
const rctf *subrect = gsc->subrect;
|
||||
float xyval[2];
|
||||
@@ -747,7 +749,8 @@ void gp_point_to_xy_fl(const GP_SpaceConversion *gsc,
|
||||
BLI_assert(!(gps->flag & GP_STROKE_2DSPACE) || (gsc->sa->spacetype != SPACE_VIEW3D));
|
||||
|
||||
if (gps->flag & GP_STROKE_3DSPACE) {
|
||||
if (ED_view3d_project_float_global(ar, &pt->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||
if (ED_view3d_project_float_global(region, &pt->x, xyval, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
*r_x = xyval[0];
|
||||
*r_y = xyval[1];
|
||||
}
|
||||
@@ -776,8 +779,8 @@ void gp_point_to_xy_fl(const GP_SpaceConversion *gsc,
|
||||
else {
|
||||
if (subrect == NULL) {
|
||||
/* normal 3D view (or view space) */
|
||||
*r_x = (pt->x / 100.0f * ar->winx);
|
||||
*r_y = (pt->y / 100.0f * ar->winy);
|
||||
*r_x = (pt->x / 100.0f * region->winx);
|
||||
*r_y = (pt->y / 100.0f * region->winy);
|
||||
}
|
||||
else {
|
||||
/* camera view, use subrect */
|
||||
@@ -795,7 +798,7 @@ void gp_point_3d_to_xy(const GP_SpaceConversion *gsc,
|
||||
const float pt[3],
|
||||
float xy[2])
|
||||
{
|
||||
const ARegion *ar = gsc->ar;
|
||||
const ARegion *region = gsc->region;
|
||||
const View2D *v2d = gsc->v2d;
|
||||
const rctf *subrect = gsc->subrect;
|
||||
float xyval[2];
|
||||
@@ -804,7 +807,7 @@ void gp_point_3d_to_xy(const GP_SpaceConversion *gsc,
|
||||
BLI_assert((gsc->sa->spacetype == SPACE_VIEW3D));
|
||||
|
||||
if (flag & GP_STROKE_3DSPACE) {
|
||||
if (ED_view3d_project_float_global(ar, pt, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||
if (ED_view3d_project_float_global(region, pt, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||
xy[0] = xyval[0];
|
||||
xy[1] = xyval[1];
|
||||
}
|
||||
@@ -833,8 +836,8 @@ void gp_point_3d_to_xy(const GP_SpaceConversion *gsc,
|
||||
else {
|
||||
if (subrect == NULL) {
|
||||
/* normal 3D view (or view space) */
|
||||
xy[0] = (pt[0] / 100.0f * ar->winx);
|
||||
xy[1] = (pt[1] / 100.0f * ar->winy);
|
||||
xy[0] = (pt[0] / 100.0f * region->winx);
|
||||
xy[1] = (pt[1] / 100.0f * region->winy);
|
||||
}
|
||||
else {
|
||||
/* camera view, use subrect */
|
||||
@@ -864,7 +867,7 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
|
||||
const float screen_co[2],
|
||||
float r_out[3])
|
||||
{
|
||||
const RegionView3D *rv3d = gsc->ar->regiondata;
|
||||
const RegionView3D *rv3d = gsc->region->regiondata;
|
||||
float rvec[3];
|
||||
|
||||
ED_gp_get_drawing_reference(
|
||||
@@ -877,10 +880,10 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
|
||||
|
||||
copy_v2_v2(mval_f, screen_co);
|
||||
|
||||
if (ED_view3d_project_float_global(gsc->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
if (ED_view3d_project_float_global(gsc->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
sub_v2_v2v2(mval_f, mval_prj, mval_f);
|
||||
ED_view3d_win_to_delta(gsc->ar, mval_f, dvec, zfac);
|
||||
ED_view3d_win_to_delta(gsc->region, mval_f, dvec, zfac);
|
||||
sub_v3_v3v3(r_out, rvec, dvec);
|
||||
|
||||
return true;
|
||||
@@ -901,7 +904,7 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
|
||||
* \param[out] r_out: The resulting 2D point data.
|
||||
*/
|
||||
void gp_stroke_convertcoords_tpoint(Scene *scene,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
const tGPspoint *point2D,
|
||||
@@ -913,7 +916,7 @@ void gp_stroke_convertcoords_tpoint(Scene *scene,
|
||||
int mval_i[2];
|
||||
round_v2i_v2fl(mval_i, &point2D->x);
|
||||
|
||||
if ((depth != NULL) && (ED_view3d_autodist_simple(ar, mval_i, r_out, 0, depth))) {
|
||||
if ((depth != NULL) && (ED_view3d_autodist_simple(region, mval_i, r_out, 0, depth))) {
|
||||
/* projecting onto 3D-Geometry
|
||||
* - nothing more needs to be done here, since view_autodist_simple() has already done it
|
||||
*/
|
||||
@@ -928,11 +931,12 @@ void gp_stroke_convertcoords_tpoint(Scene *scene,
|
||||
* 3D-coordinates using the 3D-cursor as reference.
|
||||
*/
|
||||
ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, rvec);
|
||||
zfac = ED_view3d_calc_zfac(ar->regiondata, rvec, NULL);
|
||||
zfac = ED_view3d_calc_zfac(region->regiondata, rvec, NULL);
|
||||
|
||||
if (ED_view3d_project_float_global(ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||
if (ED_view3d_project_float_global(region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
sub_v2_v2v2(mval_f, mval_prj, mval_f);
|
||||
ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
|
||||
ED_view3d_win_to_delta(region, mval_f, dvec, zfac);
|
||||
sub_v3_v3v3(r_out, rvec, dvec);
|
||||
}
|
||||
else {
|
||||
@@ -1668,7 +1672,7 @@ void ED_gpencil_vgroup_deselect(bContext *C, Object *ob)
|
||||
/* check if cursor is in drawing region */
|
||||
static bool gp_check_cursor_region(bContext *C, int mval_i[2])
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
@@ -1681,11 +1685,11 @@ static bool gp_check_cursor_region(bContext *C, int mval_i[2])
|
||||
if (!ELEM(sa->spacetype, SPACE_VIEW3D)) {
|
||||
return false;
|
||||
}
|
||||
if ((ar) && (ar->regiontype != RGN_TYPE_WINDOW)) {
|
||||
if ((region) && (region->regiontype != RGN_TYPE_WINDOW)) {
|
||||
return false;
|
||||
}
|
||||
else if (ar) {
|
||||
return BLI_rcti_isect_pt_v(&ar->winrct, mval_i);
|
||||
else if (region) {
|
||||
return BLI_rcti_isect_pt_v(®ion->winrct, mval_i);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
@@ -1748,7 +1752,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
|
||||
bGPdata *gpd = ED_gpencil_data_get_active(C);
|
||||
@@ -1879,8 +1883,9 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2f(pos, x, y);
|
||||
immVertex2f(
|
||||
pos, last_mouse_position[0] + ar->winrct.xmin, last_mouse_position[1] + ar->winrct.ymin);
|
||||
immVertex2f(pos,
|
||||
last_mouse_position[0] + region->winrct.xmin,
|
||||
last_mouse_position[1] + region->winrct.ymin);
|
||||
immEnd();
|
||||
|
||||
GPU_blend(false);
|
||||
@@ -1992,7 +1997,7 @@ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode)
|
||||
}
|
||||
|
||||
/* helper to convert 2d to 3d for simple drawing buffer */
|
||||
static void gpencil_stroke_convertcoords(ARegion *ar,
|
||||
static void gpencil_stroke_convertcoords(ARegion *region,
|
||||
const tGPspoint *point2D,
|
||||
const float origin[3],
|
||||
float out[3])
|
||||
@@ -2004,11 +2009,12 @@ static void gpencil_stroke_convertcoords(ARegion *ar,
|
||||
|
||||
copy_v3_v3(rvec, origin);
|
||||
|
||||
zfac = ED_view3d_calc_zfac(ar->regiondata, rvec, NULL);
|
||||
zfac = ED_view3d_calc_zfac(region->regiondata, rvec, NULL);
|
||||
|
||||
if (ED_view3d_project_float_global(ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||
if (ED_view3d_project_float_global(region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
sub_v2_v2v2(mval_f, mval_prj, mval_f);
|
||||
ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
|
||||
ED_view3d_win_to_delta(region, mval_f, dvec, zfac);
|
||||
sub_v3_v3v3(out, rvec, dvec);
|
||||
}
|
||||
else {
|
||||
@@ -2017,11 +2023,14 @@ static void gpencil_stroke_convertcoords(ARegion *ar,
|
||||
}
|
||||
|
||||
/* convert 2d tGPspoint to 3d bGPDspoint */
|
||||
void ED_gpencil_tpoint_to_point(ARegion *ar, float origin[3], const tGPspoint *tpt, bGPDspoint *pt)
|
||||
void ED_gpencil_tpoint_to_point(ARegion *region,
|
||||
float origin[3],
|
||||
const tGPspoint *tpt,
|
||||
bGPDspoint *pt)
|
||||
{
|
||||
float p3d[3];
|
||||
/* conversion to 3d format */
|
||||
gpencil_stroke_convertcoords(ar, tpt, origin, p3d);
|
||||
gpencil_stroke_convertcoords(region, tpt, origin, p3d);
|
||||
copy_v3_v3(&pt->x, p3d);
|
||||
|
||||
pt->pressure = tpt->pressure;
|
||||
|
||||
@@ -84,7 +84,7 @@ typedef struct bAnimContext {
|
||||
/** editor data */
|
||||
struct SpaceLink *sl;
|
||||
/** region within editor */
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
|
||||
/** dopesheet data for editor (or which is being used) */
|
||||
struct bDopeSheet *ads;
|
||||
@@ -407,7 +407,7 @@ typedef enum eAnimFilter_Flags {
|
||||
|
||||
/* channel heights */
|
||||
#define ACHANNEL_FIRST_TOP(ac) \
|
||||
(UI_view2d_scale_get_y(&(ac)->ar->v2d) * -UI_TIME_SCRUB_MARGIN_Y - ACHANNEL_SKIP)
|
||||
(UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - ACHANNEL_SKIP)
|
||||
#define ACHANNEL_HEIGHT(ac) (0.8f * (ac)->yscale_fac * U.widget_unit)
|
||||
#define ACHANNEL_SKIP (0.1f * U.widget_unit)
|
||||
#define ACHANNEL_STEP(ac) (ACHANNEL_HEIGHT(ac) + ACHANNEL_SKIP)
|
||||
@@ -425,7 +425,7 @@ typedef enum eAnimFilter_Flags {
|
||||
|
||||
/* NLA channel heights */
|
||||
#define NLACHANNEL_FIRST_TOP(ac) \
|
||||
(UI_view2d_scale_get_y(&(ac)->ar->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLACHANNEL_SKIP)
|
||||
(UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLACHANNEL_SKIP)
|
||||
#define NLACHANNEL_HEIGHT(snla) \
|
||||
((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : (1.2f * U.widget_unit))
|
||||
#define NLACHANNEL_SKIP (0.1f * U.widget_unit)
|
||||
|
||||
@@ -50,7 +50,10 @@ bool ED_space_clip_maskedit_mask_poll(struct bContext *C);
|
||||
|
||||
void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height);
|
||||
void ED_space_clip_get_size_fl(struct SpaceClip *sc, float size[2]);
|
||||
void ED_space_clip_get_zoom(struct SpaceClip *sc, struct ARegion *ar, float *zoomx, float *zoomy);
|
||||
void ED_space_clip_get_zoom(struct SpaceClip *sc,
|
||||
struct ARegion *region,
|
||||
float *zoomx,
|
||||
float *zoomy);
|
||||
void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
|
||||
void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
|
||||
|
||||
@@ -63,24 +66,27 @@ struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc,
|
||||
float *angle);
|
||||
|
||||
bool ED_space_clip_color_sample(struct SpaceClip *sc,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
int mval[2],
|
||||
float r_col[3]);
|
||||
|
||||
void ED_clip_update_frame(const struct Main *mainp, int cfra);
|
||||
bool ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, bool fit);
|
||||
bool ED_clip_view_selection(const struct bContext *C, struct ARegion *region, bool fit);
|
||||
|
||||
void ED_clip_select_all(struct SpaceClip *sc, int action, bool *r_has_selection);
|
||||
bool ED_clip_can_select(struct bContext *C);
|
||||
|
||||
void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]);
|
||||
void ED_clip_point_stable_pos(
|
||||
struct SpaceClip *sc, struct ARegion *ar, float x, float y, float *xr, float *yr);
|
||||
struct SpaceClip *sc, struct ARegion *region, float x, float y, float *xr, float *yr);
|
||||
void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const float co[2],
|
||||
float r_co[2]);
|
||||
void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *ar, const int mval[2], float co[2]);
|
||||
void ED_clip_mouse_pos(struct SpaceClip *sc,
|
||||
struct ARegion *region,
|
||||
const int mval[2],
|
||||
float co[2]);
|
||||
|
||||
bool ED_space_clip_check_show_trackedit(struct SpaceClip *sc);
|
||||
bool ED_space_clip_check_show_maskedit(struct SpaceClip *sc);
|
||||
|
||||
@@ -110,11 +110,11 @@ void ED_fileselect_params_to_userdef(struct SpaceFile *sfile,
|
||||
|
||||
void ED_fileselect_reset_params(struct SpaceFile *sfile);
|
||||
|
||||
void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar);
|
||||
void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *region);
|
||||
|
||||
FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar);
|
||||
FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *region);
|
||||
|
||||
int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *ar);
|
||||
int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *region);
|
||||
int ED_fileselect_layout_offset(FileLayout *layout, int x, int y);
|
||||
FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const struct rcti *rect);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ void ED_annotation_draw_view2d(const struct bContext *C, bool onlyv2d);
|
||||
void ED_annotation_draw_view3d(struct Scene *scene,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct View3D *v3d,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
bool only3d);
|
||||
void ED_annotation_draw_ex(struct Scene *scene,
|
||||
struct bGPdata *gpd,
|
||||
@@ -273,7 +273,7 @@ void ED_gpencil_vgroup_deselect(struct bContext *C, struct Object *ob);
|
||||
int ED_gpencil_join_objects_exec(struct bContext *C, struct wmOperator *op);
|
||||
|
||||
/* texture coordinate utilities */
|
||||
void ED_gpencil_tpoint_to_point(struct ARegion *ar,
|
||||
void ED_gpencil_tpoint_to_point(struct ARegion *region,
|
||||
float origin[3],
|
||||
const struct tGPspoint *tpt,
|
||||
struct bGPDspoint *pt);
|
||||
|
||||
@@ -57,7 +57,7 @@ struct Mask *ED_space_image_get_mask(struct SpaceImage *sima);
|
||||
void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask);
|
||||
|
||||
bool ED_space_image_color_sample(struct SpaceImage *sima,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
int mval[2],
|
||||
float r_col[3]);
|
||||
struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile);
|
||||
@@ -68,7 +68,7 @@ void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height);
|
||||
void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]);
|
||||
void ED_space_image_get_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
|
||||
void ED_space_image_get_zoom(struct SpaceImage *sima,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
float *zoomx,
|
||||
float *zoomy);
|
||||
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
|
||||
@@ -84,14 +84,14 @@ void ED_space_image_paint_update(struct Main *bmain,
|
||||
|
||||
void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *aspx, float *aspy);
|
||||
void ED_image_mouse_pos(struct SpaceImage *sima,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const int mval[2],
|
||||
float co[2]);
|
||||
void ED_image_view_center_to_point(struct SpaceImage *sima, float x, float y);
|
||||
void ED_image_point_pos(
|
||||
struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr);
|
||||
struct SpaceImage *sima, struct ARegion *region, float x, float y, float *xr, float *yr);
|
||||
void ED_image_point_pos__reverse(struct SpaceImage *sima,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const float co[2],
|
||||
float r_co[2]);
|
||||
bool ED_image_slot_cycle(struct Image *image, int direction);
|
||||
@@ -108,7 +108,7 @@ bool ED_space_image_maskedit_mask_poll(struct bContext *C);
|
||||
bool ED_space_image_cursor_poll(struct bContext *C);
|
||||
|
||||
void ED_image_draw_info(struct Scene *scene,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
bool color_manage,
|
||||
bool use_default_view,
|
||||
int channels,
|
||||
|
||||
@@ -37,19 +37,19 @@ struct wmKeyConfig;
|
||||
|
||||
/* mask_edit.c */
|
||||
void ED_mask_get_size(struct ScrArea *sa, int *width, int *height);
|
||||
void ED_mask_zoom(struct ScrArea *sa, struct ARegion *ar, float *zoomx, float *zoomy);
|
||||
void ED_mask_get_aspect(struct ScrArea *sa, struct ARegion *ar, float *aspx, float *aspy);
|
||||
void ED_mask_zoom(struct ScrArea *sa, struct ARegion *region, float *zoomx, float *zoomy);
|
||||
void ED_mask_get_aspect(struct ScrArea *sa, struct ARegion *region, float *aspx, float *aspy);
|
||||
|
||||
void ED_mask_pixelspace_factor(struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
float *scalex,
|
||||
float *scaley);
|
||||
void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *ar, const int mval[2], float co[2]);
|
||||
void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *region, const int mval[2], float co[2]);
|
||||
|
||||
void ED_mask_point_pos(
|
||||
struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr);
|
||||
struct ScrArea *sa, struct ARegion *region, float x, float y, float *xr, float *yr);
|
||||
void ED_mask_point_pos__reverse(
|
||||
struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr);
|
||||
struct ScrArea *sa, struct ARegion *region, float x, float y, float *xr, float *yr);
|
||||
|
||||
void ED_mask_cursor_location_get(struct ScrArea *sa, float cursor[2]);
|
||||
bool ED_mask_selected_minmax(const struct bContext *C, float min[2], float max[2]);
|
||||
@@ -64,7 +64,7 @@ void ED_operatormacros_mask(void);
|
||||
void ED_mask_draw(const struct bContext *C, const char draw_flag, const char draw_type);
|
||||
void ED_mask_draw_region(struct Depsgraph *depsgraph,
|
||||
struct Mask *mask,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const char draw_flag,
|
||||
const char draw_type,
|
||||
const char overlay_mode,
|
||||
@@ -78,7 +78,7 @@ void ED_mask_draw_region(struct Depsgraph *depsgraph,
|
||||
const struct bContext *C);
|
||||
|
||||
void ED_mask_draw_frames(
|
||||
struct Mask *mask, struct ARegion *ar, const int cfra, const int sfra, const int efra);
|
||||
struct Mask *mask, struct ARegion *region, const int cfra, const int sfra, const int efra);
|
||||
|
||||
/* mask_shapekey.c */
|
||||
void ED_mask_layer_shape_auto_key(struct MaskLayer *mask_layer, const int frame);
|
||||
|
||||
@@ -135,7 +135,7 @@ void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
|
||||
bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
|
||||
struct BMEdge *e,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
struct Object *obedit);
|
||||
|
||||
@@ -296,7 +296,7 @@ void ED_keymap_mesh(struct wmKeyConfig *keyconf);
|
||||
/* editmesh_tools.c (could be moved) */
|
||||
void EDBM_project_snap_verts(struct bContext *C,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct Object *obedit,
|
||||
struct BMEditMesh *em);
|
||||
|
||||
|
||||
@@ -111,8 +111,11 @@ void ED_node_composite_job(const struct bContext *C,
|
||||
void ED_operatormacros_node(void);
|
||||
|
||||
/* node_view.c */
|
||||
bool ED_space_node_color_sample(
|
||||
struct Main *bmain, struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]);
|
||||
bool ED_space_node_color_sample(struct Main *bmain,
|
||||
struct SpaceNode *snode,
|
||||
struct ARegion *region,
|
||||
int mval[2],
|
||||
float r_col[3]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -64,75 +64,75 @@ struct wmWindowManager;
|
||||
/* regions */
|
||||
void ED_region_do_listen(struct wmWindow *win,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct wmNotifier *note,
|
||||
const Scene *scene);
|
||||
void ED_region_do_layout(struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_do_draw(struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_exit(struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_remove(struct bContext *C, struct ScrArea *sa, struct ARegion *ar);
|
||||
void ED_region_pixelspace(struct ARegion *ar);
|
||||
void ED_region_update_rect(struct ARegion *ar);
|
||||
void ED_region_floating_initialize(struct ARegion *ar);
|
||||
void ED_region_tag_redraw(struct ARegion *ar);
|
||||
void ED_region_tag_redraw_partial(struct ARegion *ar, const struct rcti *rct, bool rebuild);
|
||||
void ED_region_tag_redraw_cursor(struct ARegion *ar);
|
||||
void ED_region_tag_redraw_no_rebuild(struct ARegion *ar);
|
||||
void ED_region_tag_refresh_ui(struct ARegion *ar);
|
||||
void ED_region_tag_redraw_editor_overlays(struct ARegion *ar);
|
||||
void ED_region_do_layout(struct bContext *C, struct ARegion *region);
|
||||
void ED_region_do_draw(struct bContext *C, struct ARegion *region);
|
||||
void ED_region_exit(struct bContext *C, struct ARegion *region);
|
||||
void ED_region_remove(struct bContext *C, struct ScrArea *sa, struct ARegion *region);
|
||||
void ED_region_pixelspace(struct ARegion *region);
|
||||
void ED_region_update_rect(struct ARegion *region);
|
||||
void ED_region_floating_initialize(struct ARegion *region);
|
||||
void ED_region_tag_redraw(struct ARegion *region);
|
||||
void ED_region_tag_redraw_partial(struct ARegion *region, const struct rcti *rct, bool rebuild);
|
||||
void ED_region_tag_redraw_cursor(struct ARegion *region);
|
||||
void ED_region_tag_redraw_no_rebuild(struct ARegion *region);
|
||||
void ED_region_tag_refresh_ui(struct ARegion *region);
|
||||
void ED_region_tag_redraw_editor_overlays(struct ARegion *region);
|
||||
|
||||
void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *ar);
|
||||
void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *region);
|
||||
void ED_region_panels_ex(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const char *contexts[],
|
||||
int contextnr,
|
||||
const bool vertical);
|
||||
void ED_region_panels(const struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_panels(const struct bContext *C, struct ARegion *region);
|
||||
void ED_region_panels_layout_ex(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct ListBase *paneltypes,
|
||||
const char *contexts[],
|
||||
int contextnr,
|
||||
const bool vertical,
|
||||
const char *category_override);
|
||||
|
||||
void ED_region_panels_layout(const struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_panels_draw(const struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_panels_layout(const struct bContext *C, struct ARegion *region);
|
||||
void ED_region_panels_draw(const struct bContext *C, struct ARegion *region);
|
||||
|
||||
void ED_region_header_init(struct ARegion *ar);
|
||||
void ED_region_header(const struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_header_layout(const struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_header_draw(const struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_header_init(struct ARegion *region);
|
||||
void ED_region_header(const struct bContext *C, struct ARegion *region);
|
||||
void ED_region_header_layout(const struct bContext *C, struct ARegion *region);
|
||||
void ED_region_header_draw(const struct bContext *C, struct ARegion *region);
|
||||
|
||||
void ED_region_cursor_set(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar);
|
||||
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_cursor_set(struct wmWindow *win, struct ScrArea *sa, struct ARegion *region);
|
||||
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *region);
|
||||
void ED_region_visibility_change_update(struct bContext *C,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar);
|
||||
struct ARegion *region);
|
||||
/* screen_ops.c */
|
||||
void ED_region_visibility_change_update_animated(struct bContext *C,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar);
|
||||
struct ARegion *region);
|
||||
|
||||
void ED_region_info_draw(struct ARegion *ar,
|
||||
void ED_region_info_draw(struct ARegion *region,
|
||||
const char *text,
|
||||
float fill_color[4],
|
||||
const bool full_redraw);
|
||||
void ED_region_info_draw_multiline(ARegion *ar,
|
||||
void ED_region_info_draw_multiline(ARegion *region,
|
||||
const char *text_array[],
|
||||
float fill_color[4],
|
||||
const bool full_redraw);
|
||||
void ED_region_image_metadata_draw(
|
||||
int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy);
|
||||
void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout);
|
||||
void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy, float x0, float y0);
|
||||
float ED_region_blend_alpha(struct ARegion *ar);
|
||||
void ED_region_visible_rect_calc(struct ARegion *ar, struct rcti *rect);
|
||||
const rcti *ED_region_visible_rect(ARegion *ar);
|
||||
void ED_region_grid_draw(struct ARegion *region, float zoomx, float zoomy, float x0, float y0);
|
||||
float ED_region_blend_alpha(struct ARegion *region);
|
||||
void ED_region_visible_rect_calc(struct ARegion *region, struct rcti *rect);
|
||||
const rcti *ED_region_visible_rect(ARegion *region);
|
||||
bool ED_region_is_overlap(int spacetype, int regiontype);
|
||||
|
||||
int ED_region_snap_size_test(const struct ARegion *ar);
|
||||
bool ED_region_snap_size_apply(struct ARegion *ar, int snap_flag);
|
||||
int ED_region_snap_size_test(const struct ARegion *region);
|
||||
bool ED_region_snap_size_apply(struct ARegion *region, int snap_flag);
|
||||
|
||||
/* message_bus callbacks */
|
||||
void ED_region_do_msg_notify_tag_redraw(struct bContext *C,
|
||||
@@ -147,14 +147,14 @@ void ED_area_do_mgs_subscribe_for_tool_header(const struct bContext *C,
|
||||
struct Scene *scene,
|
||||
struct bScreen *screen,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct wmMsgBus *mbus);
|
||||
void ED_area_do_mgs_subscribe_for_tool_ui(const struct bContext *C,
|
||||
struct WorkSpace *workspace,
|
||||
struct Scene *scene,
|
||||
struct bScreen *screen,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct wmMsgBus *mbus);
|
||||
|
||||
/* message bus */
|
||||
@@ -163,7 +163,7 @@ void ED_region_message_subscribe(struct bContext *C,
|
||||
struct Scene *scene,
|
||||
struct bScreen *screen,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct wmMsgBus *mbus);
|
||||
|
||||
/* spaces */
|
||||
@@ -409,10 +409,13 @@ void ED_screen_user_menu_register(void);
|
||||
|
||||
/* Cache display helpers */
|
||||
|
||||
void ED_region_cache_draw_background(struct ARegion *ar);
|
||||
void ED_region_cache_draw_background(struct ARegion *region);
|
||||
void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y);
|
||||
void ED_region_cache_draw_cached_segments(
|
||||
struct ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra);
|
||||
void ED_region_cache_draw_cached_segments(struct ARegion *region,
|
||||
const int num_segments,
|
||||
const int *points,
|
||||
const int sfra,
|
||||
const int efra);
|
||||
|
||||
/* area_utils.c */
|
||||
void ED_region_generic_tools_region_message_subscribe(const struct bContext *C,
|
||||
@@ -420,24 +423,28 @@ void ED_region_generic_tools_region_message_subscribe(const struct bContext *C,
|
||||
struct Scene *scene,
|
||||
struct bScreen *screen,
|
||||
struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct wmMsgBus *mbus);
|
||||
int ED_region_generic_tools_region_snap_size(const struct ARegion *ar, int size, int axis);
|
||||
int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis);
|
||||
|
||||
/* area_query.c */
|
||||
bool ED_region_overlap_isect_x(const ARegion *ar, const int event_x);
|
||||
bool ED_region_overlap_isect_y(const ARegion *ar, const int event_y);
|
||||
bool ED_region_overlap_isect_xy(const ARegion *ar, const int event_xy[2]);
|
||||
bool ED_region_overlap_isect_x_with_margin(const ARegion *ar, const int event_x, const int margin);
|
||||
bool ED_region_overlap_isect_y_with_margin(const ARegion *ar, const int event_y, const int margin);
|
||||
bool ED_region_overlap_isect_xy_with_margin(const ARegion *ar,
|
||||
bool ED_region_overlap_isect_x(const ARegion *region, const int event_x);
|
||||
bool ED_region_overlap_isect_y(const ARegion *region, const int event_y);
|
||||
bool ED_region_overlap_isect_xy(const ARegion *region, const int event_xy[2]);
|
||||
bool ED_region_overlap_isect_x_with_margin(const ARegion *region,
|
||||
const int event_x,
|
||||
const int margin);
|
||||
bool ED_region_overlap_isect_y_with_margin(const ARegion *region,
|
||||
const int event_y,
|
||||
const int margin);
|
||||
bool ED_region_overlap_isect_xy_with_margin(const ARegion *region,
|
||||
const int event_xy[2],
|
||||
const int margin);
|
||||
|
||||
bool ED_region_panel_category_gutter_calc_rect(const ARegion *ar, rcti *r_ar_gutter);
|
||||
bool ED_region_panel_category_gutter_isect_xy(const ARegion *ar, const int event_xy[2]);
|
||||
bool ED_region_panel_category_gutter_calc_rect(const ARegion *region, rcti *r_ar_gutter);
|
||||
bool ED_region_panel_category_gutter_isect_xy(const ARegion *region, const int event_xy[2]);
|
||||
|
||||
bool ED_region_contains_xy(const struct ARegion *ar, const int event_xy[2]);
|
||||
bool ED_region_contains_xy(const struct ARegion *region, const int event_xy[2]);
|
||||
|
||||
/* interface_region_hud.c */
|
||||
struct ARegionType *ED_area_type_hud(int space_type);
|
||||
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
|
||||
/* for animplayer */
|
||||
typedef struct ScreenAnimData {
|
||||
ARegion *ar; /* do not read from this, only for comparing if region exists */
|
||||
ARegion *region; /* do not read from this, only for comparing if region exists */
|
||||
short redraws;
|
||||
short flag; /* flags for playback */
|
||||
int sfra; /* frame that playback was started from */
|
||||
@@ -95,7 +95,7 @@ typedef enum {
|
||||
/* for editing areas/regions */
|
||||
typedef struct AZone {
|
||||
struct AZone *next, *prev;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
int type;
|
||||
|
||||
union {
|
||||
|
||||
@@ -37,7 +37,7 @@ struct rcti;
|
||||
|
||||
/* sculpt.c */
|
||||
void ED_operatortypes_sculpt(void);
|
||||
void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, struct Object *ob);
|
||||
void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *region, struct Object *ob);
|
||||
bool ED_sculpt_mask_box_select(struct bContext *C,
|
||||
struct ViewContext *vc,
|
||||
const struct rcti *rect,
|
||||
|
||||
@@ -76,7 +76,9 @@ void ED_region_draw_cb_draw(const struct bContext *, struct ARegion *, int);
|
||||
void ED_region_draw_cb_exit(struct ARegionType *, void *);
|
||||
/* generic callbacks */
|
||||
/* ed_util.c */
|
||||
void ED_region_draw_mouse_line_cb(const struct bContext *C, struct ARegion *ar, void *arg_info);
|
||||
void ED_region_draw_mouse_line_cb(const struct bContext *C,
|
||||
struct ARegion *region,
|
||||
void *arg_info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ struct UndoType;
|
||||
struct bContext;
|
||||
|
||||
bool ED_text_region_location_from_cursor(struct SpaceText *st,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const int cursor_co[2],
|
||||
int r_pixel_co[2]);
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@ struct bContext;
|
||||
struct bDopeSheet;
|
||||
struct wmEvent;
|
||||
|
||||
void ED_time_scrub_draw(const struct ARegion *ar,
|
||||
void ED_time_scrub_draw(const struct ARegion *region,
|
||||
const struct Scene *scene,
|
||||
bool display_seconds,
|
||||
bool discrete_frames);
|
||||
|
||||
bool ED_time_scrub_event_in_region(const struct ARegion *ar, const struct wmEvent *event);
|
||||
bool ED_time_scrub_event_in_region(const struct ARegion *region, const struct wmEvent *event);
|
||||
|
||||
void ED_time_scrub_channel_search_draw(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct bDopeSheet *dopesheet);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -86,7 +86,7 @@ SnapObjectContext *ED_transform_snap_object_context_create_view3d(struct Main *b
|
||||
struct Depsgraph *depsgraph,
|
||||
int flag,
|
||||
/* extra args for view3d */
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const struct View3D *v3d);
|
||||
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx);
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void ED_uvedit_live_unwrap(const struct Scene *scene, struct Object **objects, i
|
||||
void ED_uvedit_add_simple_uvs(struct Main *bmain, const struct Scene *scene, struct Object *ob);
|
||||
|
||||
/* uvedit_draw.c */
|
||||
void ED_image_draw_cursor(struct ARegion *ar, const float cursor[2]);
|
||||
void ED_image_draw_cursor(struct ARegion *region, const float cursor[2]);
|
||||
void ED_uvedit_draw_main(struct SpaceImage *sima,
|
||||
const struct Scene *scene,
|
||||
struct ViewLayer *view_layer,
|
||||
|
||||
@@ -83,7 +83,7 @@ typedef struct ViewContext {
|
||||
struct ViewLayer *view_layer;
|
||||
struct Object *obact;
|
||||
struct Object *obedit;
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
struct View3D *v3d;
|
||||
struct wmWindow *win;
|
||||
struct RegionView3D *rv3d;
|
||||
@@ -93,7 +93,7 @@ typedef struct ViewContext {
|
||||
|
||||
typedef struct ViewDepths {
|
||||
unsigned short w, h;
|
||||
short x, y; /* only for temp use for sub-rects, added to ar->winx/y */
|
||||
short x, y; /* only for temp use for sub-rects, added to region->winx/y */
|
||||
float *depths;
|
||||
double depth_range[2];
|
||||
|
||||
@@ -105,7 +105,7 @@ typedef struct ViewDrawOffscreenContext {
|
||||
struct Scene *scene;
|
||||
int drawtype;
|
||||
struct View3D *v3d;
|
||||
struct ARegion *ar;
|
||||
struct ARegion *region;
|
||||
int winx;
|
||||
int winy;
|
||||
float viewmat[4][4];
|
||||
@@ -160,12 +160,12 @@ void ED_view3d_to_object(const struct Depsgraph *depsgraph,
|
||||
void ED_view3d_lastview_store(struct RegionView3D *rv3d);
|
||||
|
||||
/* Depth buffer */
|
||||
void ED_view3d_depth_update(struct ARegion *ar);
|
||||
void ED_view3d_depth_update(struct ARegion *region);
|
||||
float ED_view3d_depth_read_cached(const struct ViewContext *vc, const int mval[2]);
|
||||
bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
|
||||
const int mval[2],
|
||||
float r_normal[3]);
|
||||
bool ED_view3d_depth_unproject(const struct ARegion *ar,
|
||||
bool ED_view3d_depth_unproject(const struct ARegion *region,
|
||||
const int mval[2],
|
||||
const double depth,
|
||||
float r_location_world[3]);
|
||||
@@ -278,61 +278,61 @@ void pose_foreachScreenBone(struct ViewContext *vc,
|
||||
/* *** end iterators *** */
|
||||
|
||||
/* view3d_project.c */
|
||||
void ED_view3d_project_float_v2_m4(const struct ARegion *ar,
|
||||
void ED_view3d_project_float_v2_m4(const struct ARegion *region,
|
||||
const float co[3],
|
||||
float r_co[2],
|
||||
float mat[4][4]);
|
||||
void ED_view3d_project_float_v3_m4(const struct ARegion *ar,
|
||||
void ED_view3d_project_float_v3_m4(const struct ARegion *region,
|
||||
const float co[3],
|
||||
float r_co[3],
|
||||
float mat[4][4]);
|
||||
|
||||
eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *base);
|
||||
eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, struct Base *base);
|
||||
|
||||
/* *** short *** */
|
||||
eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *region,
|
||||
float perspmat[4][4],
|
||||
const bool is_local,
|
||||
const float co[3],
|
||||
short r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *region,
|
||||
const float co[3],
|
||||
short r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *region,
|
||||
const float co[3],
|
||||
short r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
|
||||
/* *** int *** */
|
||||
eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *region,
|
||||
float perspmat[4][4],
|
||||
const bool is_local,
|
||||
const float co[3],
|
||||
int r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *region,
|
||||
const float co[3],
|
||||
int r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *region,
|
||||
const float co[3],
|
||||
int r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
|
||||
/* *** float *** */
|
||||
eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *region,
|
||||
float perspmat[4][4],
|
||||
const bool is_local,
|
||||
const float co[3],
|
||||
float r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region,
|
||||
const float co[3],
|
||||
float r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *ar,
|
||||
eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region,
|
||||
const float co[3],
|
||||
float r_co[2],
|
||||
const eV3DProjTest flag);
|
||||
@@ -343,21 +343,21 @@ float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const fl
|
||||
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip);
|
||||
bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]);
|
||||
bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const struct View3D *v3d,
|
||||
const float mval[2],
|
||||
float ray_start[3],
|
||||
float ray_normal[3],
|
||||
const bool do_clip);
|
||||
bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const struct View3D *v3d,
|
||||
const float mval[2],
|
||||
float r_ray_co[3],
|
||||
float r_ray_normal[3],
|
||||
float r_ray_start[3],
|
||||
bool do_clip);
|
||||
void ED_view3d_win_to_ray(const struct ARegion *ar,
|
||||
void ED_view3d_win_to_ray(const struct ARegion *region,
|
||||
const float mval[2],
|
||||
float r_ray_start[3],
|
||||
float r_ray_normal[3]);
|
||||
@@ -365,33 +365,33 @@ void ED_view3d_global_to_vector(const struct RegionView3D *rv3d,
|
||||
const float coord[3],
|
||||
float vec[3]);
|
||||
void ED_view3d_win_to_3d(const struct View3D *v3d,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const float depth_pt[3],
|
||||
const float mval[2],
|
||||
float r_out[3]);
|
||||
void ED_view3d_win_to_3d_int(const struct View3D *v3d,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const float depth_pt[3],
|
||||
const int mval[2],
|
||||
float r_out[3]);
|
||||
bool ED_view3d_win_to_3d_on_plane(const struct ARegion *ar,
|
||||
bool ED_view3d_win_to_3d_on_plane(const struct ARegion *region,
|
||||
const float plane[4],
|
||||
const float mval[2],
|
||||
const bool do_clip,
|
||||
float r_out[3]);
|
||||
bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *ar,
|
||||
bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *region,
|
||||
const float plane[4],
|
||||
const int mval[2],
|
||||
const bool do_clip,
|
||||
float r_out[3]);
|
||||
void ED_view3d_win_to_delta(const struct ARegion *ar,
|
||||
void ED_view3d_win_to_delta(const struct ARegion *region,
|
||||
const float mval[2],
|
||||
float out[3],
|
||||
const float zfac);
|
||||
void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]);
|
||||
void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]);
|
||||
void ED_view3d_win_to_origin(const struct ARegion *region, const float mval[2], float out[3]);
|
||||
void ED_view3d_win_to_vector(const struct ARegion *region, const float mval[2], float out[3]);
|
||||
bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const float mval[2],
|
||||
float r_ray_start[3],
|
||||
@@ -404,9 +404,9 @@ void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d,
|
||||
float obmat[4][4],
|
||||
float pmat[4][4]);
|
||||
|
||||
void ED_view3d_project(const struct ARegion *ar, const float world[3], float region[3]);
|
||||
void ED_view3d_project(const struct ARegion *region, const float world[3], float r_region_co[3]);
|
||||
bool ED_view3d_unproject(
|
||||
const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3]);
|
||||
const struct ARegion *region, float regionx, float regiony, float regionz, float world[3]);
|
||||
|
||||
/* end */
|
||||
|
||||
@@ -431,21 +431,21 @@ void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist)
|
||||
|
||||
void ED_view3d_calc_camera_border(const struct Scene *scene,
|
||||
struct Depsgraph *depsgraph,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const struct View3D *v3d,
|
||||
const struct RegionView3D *rv3d,
|
||||
struct rctf *r_viewborder,
|
||||
const bool no_shift);
|
||||
void ED_view3d_calc_camera_border_size(const struct Scene *scene,
|
||||
struct Depsgraph *depsgraph,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const struct View3D *v3d,
|
||||
const struct RegionView3D *rv3d,
|
||||
float r_size[2]);
|
||||
bool ED_view3d_calc_render_border(const struct Scene *scene,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct View3D *v3d,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct rcti *rect);
|
||||
|
||||
void ED_view3d_clipping_calc_from_boundbox(float clip[6][4],
|
||||
@@ -453,7 +453,7 @@ void ED_view3d_clipping_calc_from_boundbox(float clip[6][4],
|
||||
const bool is_flip);
|
||||
void ED_view3d_clipping_calc(struct BoundBox *bb,
|
||||
float planes[4][4],
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const struct Object *ob,
|
||||
const struct rcti *rect);
|
||||
void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
|
||||
@@ -467,7 +467,7 @@ void ED_view3d_clipping_disable(void);
|
||||
float ED_view3d_radius_to_dist_persp(const float angle, const float radius);
|
||||
float ED_view3d_radius_to_dist_ortho(const float lens, const float radius);
|
||||
float ED_view3d_radius_to_dist(const struct View3D *v3d,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const struct Depsgraph *depsgraph,
|
||||
const char persp,
|
||||
const bool use_aspect,
|
||||
@@ -477,12 +477,12 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un
|
||||
|
||||
/* backbuffer select and draw support */
|
||||
void ED_view3d_backbuf_depth_validate(struct ViewContext *vc);
|
||||
int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist);
|
||||
int ED_view3d_backbuf_sample_size_clamp(struct ARegion *region, const float dist);
|
||||
|
||||
void ED_view3d_select_id_validate(struct ViewContext *vc);
|
||||
|
||||
bool ED_view3d_autodist(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const int mval[2],
|
||||
float mouse_worldloc[3],
|
||||
@@ -491,17 +491,20 @@ bool ED_view3d_autodist(struct Depsgraph *depsgraph,
|
||||
|
||||
/* only draw so ED_view3d_autodist_simple can be called many times after */
|
||||
void ED_view3d_autodist_init(struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
int mode);
|
||||
bool ED_view3d_autodist_simple(struct ARegion *ar,
|
||||
bool ED_view3d_autodist_simple(struct ARegion *region,
|
||||
const int mval[2],
|
||||
float mouse_worldloc[3],
|
||||
int margin,
|
||||
float *force_depth);
|
||||
bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
|
||||
bool ED_view3d_autodist_depth_seg(
|
||||
struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
|
||||
bool ED_view3d_autodist_depth(struct ARegion *region, const int mval[2], int margin, float *depth);
|
||||
bool ED_view3d_autodist_depth_seg(struct ARegion *region,
|
||||
const int mval_sta[2],
|
||||
const int mval_end[2],
|
||||
int margin,
|
||||
float *depth);
|
||||
|
||||
/* select */
|
||||
#define MAXPICKELEMS 2500
|
||||
@@ -545,7 +548,7 @@ void ED_view3d_viewcontext_init(struct bContext *C,
|
||||
struct Depsgraph *depsgraph);
|
||||
void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact);
|
||||
void view3d_operator_needs_opengl(const struct bContext *C);
|
||||
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
|
||||
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *region);
|
||||
|
||||
/* XXX should move to BLI_math */
|
||||
bool edge_inside_circle(const float cent[2],
|
||||
@@ -584,7 +587,7 @@ bool ED_view3d_context_activate(struct bContext *C);
|
||||
void ED_view3d_draw_setup_view(struct wmWindow *win,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
float viewmat[4][4],
|
||||
float winmat[4][4],
|
||||
@@ -593,11 +596,11 @@ void ED_view3d_draw_setup_view(struct wmWindow *win,
|
||||
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
|
||||
struct Object *ED_view3d_give_object_under_cursor(struct bContext *C, const int mval[2]);
|
||||
bool ED_view3d_is_object_under_cursor(struct bContext *C, const int mval[2]);
|
||||
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);
|
||||
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *region, bool do_clip);
|
||||
void ED_view3d_update_viewmat(struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
struct View3D *v3d,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
float viewmat[4][4],
|
||||
float winmat[4][4],
|
||||
const struct rcti *rect,
|
||||
@@ -628,7 +631,7 @@ void ED_view3d_persp_switch_from_camera(const struct Depsgraph *depsgraph,
|
||||
const char persp);
|
||||
bool ED_view3d_persp_ensure(const struct Depsgraph *depsgraph,
|
||||
struct View3D *v3d,
|
||||
struct ARegion *ar);
|
||||
struct ARegion *region);
|
||||
|
||||
/* camera lock functions */
|
||||
bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
|
||||
@@ -692,7 +695,7 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op,
|
||||
#endif
|
||||
|
||||
/* render */
|
||||
void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
|
||||
void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *region);
|
||||
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
|
||||
|
||||
#define XRAY_ALPHA(v3d) \
|
||||
@@ -707,7 +710,7 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr
|
||||
/* Try avoid using these more move out of legacy. */
|
||||
void ED_view3d_draw_bgpic_test(struct Scene *scene,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct View3D *v3d,
|
||||
const bool do_foreground,
|
||||
const bool do_camera_frame);
|
||||
@@ -720,7 +723,7 @@ void ED_view3d_gizmo_mesh_preselect_get_active(struct bContext *C,
|
||||
|
||||
/* space_view3d.c */
|
||||
void ED_view3d_buttons_region_layout_ex(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const char *category_override);
|
||||
|
||||
/* view3d_view.c */
|
||||
|
||||
@@ -46,7 +46,7 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
eDrawType drawtype,
|
||||
struct View3D *v3d,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
int winx,
|
||||
int winy,
|
||||
float viewmat[4][4],
|
||||
@@ -62,7 +62,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
eDrawType drawtype,
|
||||
struct View3D *v3d,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
int sizex,
|
||||
int sizey,
|
||||
eImBufFlags imbuf_flag,
|
||||
|
||||
@@ -604,7 +604,7 @@ struct uiLayout *UI_pie_menu_layout(struct uiPieMenu *pie);
|
||||
*
|
||||
* Functions used to create popup blocks. These are like popup menus
|
||||
* but allow using all button types and creating an own layout. */
|
||||
typedef uiBlock *(*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
|
||||
typedef uiBlock *(*uiBlockCreateFunc)(struct bContext *C, struct ARegion *region, void *arg1);
|
||||
typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
|
||||
|
||||
void UI_popup_block_invoke(struct bContext *C,
|
||||
@@ -728,16 +728,19 @@ void UI_but_type_set_menu_from_pulldown(uiBut *but);
|
||||
|
||||
/* special button case, only draw it when used actively, for outliner etc */
|
||||
bool UI_but_active_only_ex(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
uiBlock *block,
|
||||
uiBut *but,
|
||||
const bool remove_on_failure);
|
||||
bool UI_but_active_only(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but);
|
||||
bool UI_but_active_only(const struct bContext *C,
|
||||
struct ARegion *region,
|
||||
uiBlock *block,
|
||||
uiBut *but);
|
||||
bool UI_block_active_only_flagged_buttons(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct uiBlock *block);
|
||||
|
||||
void UI_but_execute(const struct bContext *C, struct ARegion *ar, uiBut *but);
|
||||
void UI_but_execute(const struct bContext *C, struct ARegion *region, uiBut *but);
|
||||
|
||||
bool UI_but_online_manual_id(const uiBut *but,
|
||||
char *r_str,
|
||||
@@ -1599,7 +1602,7 @@ void UI_but_tooltip_refresh(struct bContext *C, uiBut *but);
|
||||
void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but);
|
||||
|
||||
bool UI_textbutton_activate_rna(const struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const void *rna_poin_data,
|
||||
const char *rna_prop_id);
|
||||
bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but);
|
||||
@@ -1637,42 +1640,43 @@ int UI_autocomplete_end(AutoComplete *autocpl, char *autoname);
|
||||
* could use a good cleanup, though how they will function in 2.5 is
|
||||
* not clear yet so we postpone that. */
|
||||
|
||||
void UI_panels_begin(const struct bContext *C, struct ARegion *ar);
|
||||
void UI_panels_end(const struct bContext *C, struct ARegion *ar, int *r_x, int *r_y);
|
||||
void UI_panels_draw(const struct bContext *C, struct ARegion *ar);
|
||||
void UI_panels_begin(const struct bContext *C, struct ARegion *region);
|
||||
void UI_panels_end(const struct bContext *C, struct ARegion *region, int *r_x, int *r_y);
|
||||
void UI_panels_draw(const struct bContext *C, struct ARegion *region);
|
||||
|
||||
struct Panel *UI_panel_find_by_type(struct ListBase *lb, struct PanelType *pt);
|
||||
struct Panel *UI_panel_begin(struct ScrArea *sa,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
struct ListBase *lb,
|
||||
uiBlock *block,
|
||||
struct PanelType *pt,
|
||||
struct Panel *pa,
|
||||
bool *r_open);
|
||||
void UI_panel_end(const struct ScrArea *sa,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
uiBlock *block,
|
||||
int width,
|
||||
int height,
|
||||
bool open);
|
||||
void UI_panels_scale(struct ARegion *ar, float new_width);
|
||||
void UI_panels_scale(struct ARegion *region, float new_width);
|
||||
void UI_panel_label_offset(struct uiBlock *block, int *r_x, int *r_y);
|
||||
int UI_panel_size_y(const struct Panel *pa);
|
||||
|
||||
bool UI_panel_category_is_visible(const struct ARegion *ar);
|
||||
void UI_panel_category_add(struct ARegion *ar, const char *name);
|
||||
struct PanelCategoryDyn *UI_panel_category_find(struct ARegion *ar, const char *idname);
|
||||
struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *ar, const char *idname);
|
||||
const char *UI_panel_category_active_get(struct ARegion *ar, bool set_fallback);
|
||||
void UI_panel_category_active_set(struct ARegion *ar, const char *idname);
|
||||
void UI_panel_category_active_set_default(struct ARegion *ar, const char *idname);
|
||||
struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *ar,
|
||||
bool UI_panel_category_is_visible(const struct ARegion *region);
|
||||
void UI_panel_category_add(struct ARegion *region, const char *name);
|
||||
struct PanelCategoryDyn *UI_panel_category_find(struct ARegion *region, const char *idname);
|
||||
struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *region,
|
||||
const char *idname);
|
||||
const char *UI_panel_category_active_get(struct ARegion *region, bool set_fallback);
|
||||
void UI_panel_category_active_set(struct ARegion *region, const char *idname);
|
||||
void UI_panel_category_active_set_default(struct ARegion *region, const char *idname);
|
||||
struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *region,
|
||||
const int x,
|
||||
const int y);
|
||||
struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *ar,
|
||||
struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *region,
|
||||
const struct wmEvent *event);
|
||||
void UI_panel_category_clear_all(struct ARegion *ar);
|
||||
void UI_panel_category_draw_all(struct ARegion *ar, const char *category_id_active);
|
||||
void UI_panel_category_clear_all(struct ARegion *region);
|
||||
void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_active);
|
||||
|
||||
struct PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname);
|
||||
|
||||
@@ -1805,7 +1809,7 @@ uiLayout *UI_block_layout(uiBlock *block,
|
||||
void UI_block_layout_set_current(uiBlock *block, uiLayout *layout);
|
||||
void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y);
|
||||
|
||||
void UI_region_message_subscribe(struct ARegion *ar, struct wmMsgBus *mbus);
|
||||
void UI_region_message_subscribe(struct ARegion *region, struct wmMsgBus *mbus);
|
||||
|
||||
uiBlock *uiLayoutGetBlock(uiLayout *layout);
|
||||
|
||||
@@ -2376,8 +2380,8 @@ void UI_context_active_but_prop_get_templateID(struct bContext *C,
|
||||
struct PropertyRNA **r_prop);
|
||||
struct ID *UI_context_active_but_get_tab_ID(struct bContext *C);
|
||||
|
||||
uiBut *UI_region_active_but_get(struct ARegion *ar);
|
||||
uiBut *UI_region_but_find_rect_over(const struct ARegion *ar, const struct rcti *isect);
|
||||
uiBut *UI_region_active_but_get(struct ARegion *region);
|
||||
uiBut *UI_region_but_find_rect_over(const struct ARegion *region, const struct rcti *isect);
|
||||
|
||||
/* uiFontStyle.align */
|
||||
typedef enum eFontStyle_Align {
|
||||
@@ -2454,7 +2458,7 @@ struct ARegion *UI_tooltip_create_from_button(struct bContext *C,
|
||||
uiBut *but,
|
||||
bool is_label);
|
||||
struct ARegion *UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *gz);
|
||||
void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *ar);
|
||||
void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *region);
|
||||
|
||||
/* How long before a tool-tip shows. */
|
||||
#define UI_TOOLTIP_DELAY 0.5
|
||||
|
||||
@@ -133,7 +133,7 @@ void UI_view2d_zoom_cache_reset(void);
|
||||
|
||||
/* view matrix operations */
|
||||
void UI_view2d_view_ortho(const struct View2D *v2d);
|
||||
void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, const bool xaxis);
|
||||
void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, const bool xaxis);
|
||||
void UI_view2d_view_restore(const struct bContext *C);
|
||||
|
||||
/* grid drawing */
|
||||
@@ -158,21 +158,21 @@ float UI_view2d_grid_resolution_x__frames_or_seconds(const struct View2D *v2d,
|
||||
float UI_view2d_grid_resolution_y__values(const struct View2D *v2d);
|
||||
|
||||
/* scale indicator text drawing */
|
||||
void UI_view2d_draw_scale_y__values(const struct ARegion *ar,
|
||||
void UI_view2d_draw_scale_y__values(const struct ARegion *region,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect,
|
||||
int colorid);
|
||||
void UI_view2d_draw_scale_y__block(const struct ARegion *ar,
|
||||
void UI_view2d_draw_scale_y__block(const struct ARegion *region,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect,
|
||||
int colorid);
|
||||
void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar,
|
||||
void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *region,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect,
|
||||
const struct Scene *scene,
|
||||
bool display_seconds,
|
||||
int colorid);
|
||||
void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar,
|
||||
void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect,
|
||||
const struct Scene *scene,
|
||||
@@ -236,16 +236,16 @@ void UI_view2d_center_set(struct View2D *v2d, float x, float y);
|
||||
void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac);
|
||||
|
||||
char UI_view2d_mouse_in_scrollers_ex(
|
||||
const struct ARegion *ar, const struct View2D *v2d, int x, int y, int *r_scroll);
|
||||
char UI_view2d_mouse_in_scrollers(const struct ARegion *ar,
|
||||
const struct ARegion *region, const struct View2D *v2d, int x, int y, int *r_scroll);
|
||||
char UI_view2d_mouse_in_scrollers(const struct ARegion *region,
|
||||
const struct View2D *v2d,
|
||||
int x,
|
||||
int y);
|
||||
char UI_view2d_rect_in_scrollers_ex(const struct ARegion *ar,
|
||||
char UI_view2d_rect_in_scrollers_ex(const struct ARegion *region,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect,
|
||||
int *r_scroll);
|
||||
char UI_view2d_rect_in_scrollers(const struct ARegion *ar,
|
||||
char UI_view2d_rect_in_scrollers(const struct ARegion *region,
|
||||
const struct View2D *v2d,
|
||||
const struct rcti *rect);
|
||||
|
||||
@@ -257,14 +257,14 @@ void UI_view2d_text_cache_add_rectf(struct View2D *v2d,
|
||||
const char *str,
|
||||
size_t str_len,
|
||||
const char col[4]);
|
||||
void UI_view2d_text_cache_draw(struct ARegion *ar);
|
||||
void UI_view2d_text_cache_draw(struct ARegion *region);
|
||||
|
||||
/* operators */
|
||||
void ED_operatortypes_view2d(void);
|
||||
void ED_keymap_view2d(struct wmKeyConfig *keyconf);
|
||||
|
||||
void UI_view2d_smooth_view(struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const struct rctf *cur,
|
||||
const int smooth_viewtx);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
/* prototypes. */
|
||||
static void ui_but_to_pixelrect(struct rcti *rect,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
struct uiBlock *block,
|
||||
struct uiBut *but);
|
||||
static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *but_p);
|
||||
@@ -124,15 +124,15 @@ static bool ui_but_is_unit_radians(const uiBut *but)
|
||||
|
||||
/* ************* window matrix ************** */
|
||||
|
||||
void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
|
||||
void ui_block_to_window_fl(const ARegion *region, uiBlock *block, float *x, float *y)
|
||||
{
|
||||
float gx, gy;
|
||||
int sx, sy, getsizex, getsizey;
|
||||
|
||||
getsizex = BLI_rcti_size_x(&ar->winrct) + 1;
|
||||
getsizey = BLI_rcti_size_y(&ar->winrct) + 1;
|
||||
sx = ar->winrct.xmin;
|
||||
sy = ar->winrct.ymin;
|
||||
getsizex = BLI_rcti_size_x(®ion->winrct) + 1;
|
||||
getsizey = BLI_rcti_size_y(®ion->winrct) + 1;
|
||||
sx = region->winrct.xmin;
|
||||
sy = region->winrct.ymin;
|
||||
|
||||
gx = *x;
|
||||
gy = *y;
|
||||
@@ -150,48 +150,51 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y
|
||||
block->winmat[3][1]));
|
||||
}
|
||||
|
||||
void ui_block_to_window(const ARegion *ar, uiBlock *block, int *x, int *y)
|
||||
void ui_block_to_window(const ARegion *region, uiBlock *block, int *x, int *y)
|
||||
{
|
||||
float fx, fy;
|
||||
|
||||
fx = *x;
|
||||
fy = *y;
|
||||
|
||||
ui_block_to_window_fl(ar, block, &fx, &fy);
|
||||
ui_block_to_window_fl(region, block, &fx, &fy);
|
||||
|
||||
*x = (int)(fx + 0.5f);
|
||||
*y = (int)(fy + 0.5f);
|
||||
}
|
||||
|
||||
void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src)
|
||||
void ui_block_to_window_rctf(const ARegion *region,
|
||||
uiBlock *block,
|
||||
rctf *rct_dst,
|
||||
const rctf *rct_src)
|
||||
{
|
||||
*rct_dst = *rct_src;
|
||||
ui_block_to_window_fl(ar, block, &rct_dst->xmin, &rct_dst->ymin);
|
||||
ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
|
||||
ui_block_to_window_fl(region, block, &rct_dst->xmin, &rct_dst->ymin);
|
||||
ui_block_to_window_fl(region, block, &rct_dst->xmax, &rct_dst->ymax);
|
||||
}
|
||||
|
||||
float ui_block_to_window_scale(const ARegion *ar, uiBlock *block)
|
||||
float ui_block_to_window_scale(const ARegion *region, uiBlock *block)
|
||||
{
|
||||
/* We could have function for this to avoid dummy arg. */
|
||||
float dummy_x;
|
||||
float min_y = 0, max_y = 1;
|
||||
dummy_x = 0.0f;
|
||||
ui_block_to_window_fl(ar, block, &dummy_x, &min_y);
|
||||
ui_block_to_window_fl(region, block, &dummy_x, &min_y);
|
||||
dummy_x = 0.0f;
|
||||
ui_block_to_window_fl(ar, block, &dummy_x, &max_y);
|
||||
ui_block_to_window_fl(region, block, &dummy_x, &max_y);
|
||||
return max_y - min_y;
|
||||
}
|
||||
|
||||
/* for mouse cursor */
|
||||
void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
|
||||
void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *x, float *y)
|
||||
{
|
||||
float a, b, c, d, e, f, px, py;
|
||||
int sx, sy, getsizex, getsizey;
|
||||
|
||||
getsizex = BLI_rcti_size_x(&ar->winrct) + 1;
|
||||
getsizey = BLI_rcti_size_y(&ar->winrct) + 1;
|
||||
sx = ar->winrct.xmin;
|
||||
sy = ar->winrct.ymin;
|
||||
getsizex = BLI_rcti_size_x(®ion->winrct) + 1;
|
||||
getsizey = BLI_rcti_size_y(®ion->winrct) + 1;
|
||||
sx = region->winrct.xmin;
|
||||
sy = region->winrct.ymin;
|
||||
|
||||
a = 0.5f * ((float)getsizex) * block->winmat[0][0];
|
||||
b = 0.5f * ((float)getsizex) * block->winmat[1][0];
|
||||
@@ -213,47 +216,47 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y
|
||||
}
|
||||
}
|
||||
|
||||
void ui_window_to_block_rctf(const struct ARegion *ar,
|
||||
void ui_window_to_block_rctf(const struct ARegion *region,
|
||||
uiBlock *block,
|
||||
rctf *rct_dst,
|
||||
const rctf *rct_src)
|
||||
{
|
||||
*rct_dst = *rct_src;
|
||||
ui_window_to_block_fl(ar, block, &rct_dst->xmin, &rct_dst->ymin);
|
||||
ui_window_to_block_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
|
||||
ui_window_to_block_fl(region, block, &rct_dst->xmin, &rct_dst->ymin);
|
||||
ui_window_to_block_fl(region, block, &rct_dst->xmax, &rct_dst->ymax);
|
||||
}
|
||||
|
||||
void ui_window_to_block(const ARegion *ar, uiBlock *block, int *x, int *y)
|
||||
void ui_window_to_block(const ARegion *region, uiBlock *block, int *x, int *y)
|
||||
{
|
||||
float fx, fy;
|
||||
|
||||
fx = *x;
|
||||
fy = *y;
|
||||
|
||||
ui_window_to_block_fl(ar, block, &fx, &fy);
|
||||
ui_window_to_block_fl(region, block, &fx, &fy);
|
||||
|
||||
*x = (int)(fx + 0.5f);
|
||||
*y = (int)(fy + 0.5f);
|
||||
}
|
||||
|
||||
void ui_window_to_region(const ARegion *ar, int *x, int *y)
|
||||
void ui_window_to_region(const ARegion *region, int *x, int *y)
|
||||
{
|
||||
*x -= ar->winrct.xmin;
|
||||
*y -= ar->winrct.ymin;
|
||||
*x -= region->winrct.xmin;
|
||||
*y -= region->winrct.ymin;
|
||||
}
|
||||
|
||||
void ui_window_to_region_rcti(const ARegion *ar, rcti *rect_dst, const rcti *rct_src)
|
||||
void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src)
|
||||
{
|
||||
rect_dst->xmin = rct_src->xmin - ar->winrct.xmin;
|
||||
rect_dst->xmax = rct_src->xmax - ar->winrct.xmin;
|
||||
rect_dst->ymin = rct_src->ymin - ar->winrct.ymin;
|
||||
rect_dst->ymax = rct_src->ymax - ar->winrct.ymin;
|
||||
rect_dst->xmin = rct_src->xmin - region->winrct.xmin;
|
||||
rect_dst->xmax = rct_src->xmax - region->winrct.xmin;
|
||||
rect_dst->ymin = rct_src->ymin - region->winrct.ymin;
|
||||
rect_dst->ymax = rct_src->ymax - region->winrct.ymin;
|
||||
}
|
||||
|
||||
void ui_region_to_window(const ARegion *ar, int *x, int *y)
|
||||
void ui_region_to_window(const ARegion *region, int *x, int *y)
|
||||
{
|
||||
*x += ar->winrct.xmin;
|
||||
*y += ar->winrct.ymin;
|
||||
*x += region->winrct.xmin;
|
||||
*y += region->winrct.ymin;
|
||||
}
|
||||
|
||||
static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
|
||||
@@ -336,15 +339,15 @@ static void ui_update_window_matrix(const wmWindow *window, const ARegion *regio
|
||||
* Popups will add a margin to #ARegion.winrct for shadow,
|
||||
* for interactivity (point-inside tests for eg), we want the winrct without the margin added.
|
||||
*/
|
||||
void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect)
|
||||
void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect)
|
||||
{
|
||||
uiBlock *block = ar->uiblocks.first;
|
||||
uiBlock *block = region->uiblocks.first;
|
||||
if (block && (block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_RADIAL) == 0) {
|
||||
BLI_rcti_rctf_copy_floor(r_rect, &block->rect);
|
||||
BLI_rcti_translate(r_rect, ar->winrct.xmin, ar->winrct.ymin);
|
||||
BLI_rcti_translate(r_rect, region->winrct.xmin, region->winrct.ymin);
|
||||
}
|
||||
else {
|
||||
*r_rect = ar->winrct;
|
||||
*r_rect = region->winrct;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,7 +853,7 @@ static bool ui_but_update_from_old_block(const bContext *C,
|
||||
* they should keep calling uiDefButs to keep them alive */
|
||||
/* returns 0 when button removed */
|
||||
bool UI_but_active_only_ex(
|
||||
const bContext *C, ARegion *ar, uiBlock *block, uiBut *but, const bool remove_on_failure)
|
||||
const bContext *C, ARegion *region, uiBlock *block, uiBut *but, const bool remove_on_failure)
|
||||
{
|
||||
uiBlock *oldblock;
|
||||
uiBut *oldbut;
|
||||
@@ -871,7 +874,7 @@ bool UI_but_active_only_ex(
|
||||
}
|
||||
}
|
||||
if ((activate == true) || (found == false)) {
|
||||
ui_but_activate_event((bContext *)C, ar, but);
|
||||
ui_but_activate_event((bContext *)C, region, but);
|
||||
}
|
||||
else if ((found == true) && (isactive == false)) {
|
||||
if (remove_on_failure) {
|
||||
@@ -884,23 +887,23 @@ bool UI_but_active_only_ex(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but)
|
||||
bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBut *but)
|
||||
{
|
||||
return UI_but_active_only_ex(C, ar, block, but, true);
|
||||
return UI_but_active_only_ex(C, region, block, but, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* \warning This must run after other handlers have been added,
|
||||
* otherwise the handler wont be removed, see: T71112.
|
||||
*/
|
||||
bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBlock *block)
|
||||
bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block)
|
||||
{
|
||||
bool done = false;
|
||||
for (uiBut *but = block->buttons.first; but; but = but->next) {
|
||||
if (but->flag & UI_BUT_ACTIVATE_ON_INIT) {
|
||||
but->flag &= ~UI_BUT_ACTIVATE_ON_INIT;
|
||||
if (ui_but_is_editable(but)) {
|
||||
if (UI_but_active_only_ex(C, ar, block, but, false)) {
|
||||
if (UI_but_active_only_ex(C, region, block, but, false)) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
@@ -920,12 +923,12 @@ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBloc
|
||||
}
|
||||
|
||||
/* simulate button click */
|
||||
void UI_but_execute(const bContext *C, ARegion *ar, uiBut *but)
|
||||
void UI_but_execute(const bContext *C, ARegion *region, uiBut *but)
|
||||
{
|
||||
void *active_back;
|
||||
ui_but_execute_begin((bContext *)C, ar, but, &active_back);
|
||||
ui_but_execute_begin((bContext *)C, region, but, &active_back);
|
||||
/* Value is applied in begin. No further action required. */
|
||||
ui_but_execute_end((bContext *)C, ar, but, active_back);
|
||||
ui_but_execute_end((bContext *)C, region, but, active_back);
|
||||
}
|
||||
|
||||
/* use to check if we need to disable undo, but don't make any changes
|
||||
@@ -1827,27 +1830,27 @@ void ui_fontscale(short *points, float aspect)
|
||||
}
|
||||
|
||||
/* project button or block (but==NULL) to pixels in regionspace */
|
||||
static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, uiBut *but)
|
||||
static void ui_but_to_pixelrect(rcti *rect, const ARegion *region, uiBlock *block, uiBut *but)
|
||||
{
|
||||
rctf rectf;
|
||||
|
||||
ui_block_to_window_rctf(ar, block, &rectf, (but) ? &but->rect : &block->rect);
|
||||
ui_block_to_window_rctf(region, block, &rectf, (but) ? &but->rect : &block->rect);
|
||||
BLI_rcti_rctf_copy_round(rect, &rectf);
|
||||
BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin);
|
||||
BLI_rcti_translate(rect, -region->winrct.xmin, -region->winrct.ymin);
|
||||
}
|
||||
|
||||
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
|
||||
void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
{
|
||||
uiStyle style = *UI_style_get_dpi(); /* XXX pass on as arg */
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
uiBut *but;
|
||||
rcti rect;
|
||||
|
||||
/* get menu region or area region */
|
||||
ar = CTX_wm_menu(C);
|
||||
if (!ar) {
|
||||
ar = CTX_wm_region(C);
|
||||
region = CTX_wm_menu(C);
|
||||
if (!region) {
|
||||
region = CTX_wm_region(C);
|
||||
}
|
||||
|
||||
if (!block->endblock) {
|
||||
@@ -1865,40 +1868,41 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
ui_fontscale(&style.widget.points, block->aspect);
|
||||
|
||||
/* scale block min/max to rect */
|
||||
ui_but_to_pixelrect(&rect, ar, block, NULL);
|
||||
ui_but_to_pixelrect(&rect, region, block, NULL);
|
||||
|
||||
/* pixel space for AA widgets */
|
||||
GPU_matrix_push_projection();
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_identity_set();
|
||||
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
|
||||
/* back */
|
||||
if (block->flag & UI_BLOCK_RADIAL) {
|
||||
ui_draw_pie_center(block);
|
||||
}
|
||||
else if (block->flag & UI_BLOCK_POPOVER) {
|
||||
ui_draw_popover_back(ar, &style, block, &rect);
|
||||
ui_draw_popover_back(region, &style, block, &rect);
|
||||
}
|
||||
else if (block->flag & UI_BLOCK_LOOP) {
|
||||
ui_draw_menu_back(&style, block, &rect);
|
||||
}
|
||||
else if (block->panel) {
|
||||
bool show_background = ar->alignment != RGN_ALIGN_FLOAT;
|
||||
bool show_background = region->alignment != RGN_ALIGN_FLOAT;
|
||||
if (show_background) {
|
||||
if (block->panel->type && (block->panel->type->flag & PNL_NO_HEADER)) {
|
||||
if (ar->regiontype == RGN_TYPE_TOOLS) {
|
||||
if (region->regiontype == RGN_TYPE_TOOLS) {
|
||||
/* We never want a background around active tools. */
|
||||
show_background = false;
|
||||
}
|
||||
else {
|
||||
/* Without a header there is no background except for region overlap. */
|
||||
show_background = ar->overlap != 0;
|
||||
show_background = region->overlap != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
ui_draw_aligned_panel(&style, block, &rect, UI_panel_category_is_visible(ar), show_background);
|
||||
ui_draw_aligned_panel(
|
||||
&style, block, &rect, UI_panel_category_is_visible(region), show_background);
|
||||
}
|
||||
|
||||
BLF_batch_draw_begin();
|
||||
@@ -1908,12 +1912,12 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
/* widgets */
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (!(but->flag & (UI_HIDDEN | UI_SCROLLED))) {
|
||||
ui_but_to_pixelrect(&rect, ar, block, but);
|
||||
ui_but_to_pixelrect(&rect, region, block, but);
|
||||
|
||||
/* XXX: figure out why invalid coordinates happen when closing render window */
|
||||
/* and material preview is redrawn in main window (temp fix for bug #23848) */
|
||||
if (rect.xmin < rect.xmax && rect.ymin < rect.ymax) {
|
||||
ui_draw_but(C, ar, &style, but, &rect);
|
||||
ui_draw_but(C, region, &style, but, &rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1927,7 +1931,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
|
||||
static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlock *block)
|
||||
static void ui_block_message_subscribe(ARegion *region, struct wmMsgBus *mbus, uiBlock *block)
|
||||
{
|
||||
uiBut *but_prev = NULL;
|
||||
/* possibly we should keep the region this block is contained in? */
|
||||
@@ -1943,8 +1947,8 @@ static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlo
|
||||
&but->rnapoin,
|
||||
but->rnaprop,
|
||||
&(const wmMsgSubscribeValue){
|
||||
.owner = ar,
|
||||
.user_data = ar,
|
||||
.owner = region,
|
||||
.user_data = region,
|
||||
.notify = ED_region_do_msg_notify_tag_redraw,
|
||||
},
|
||||
__func__);
|
||||
@@ -1954,10 +1958,10 @@ static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlo
|
||||
}
|
||||
}
|
||||
|
||||
void UI_region_message_subscribe(ARegion *ar, struct wmMsgBus *mbus)
|
||||
void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus)
|
||||
{
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
ui_block_message_subscribe(ar, mbus, block);
|
||||
for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
ui_block_message_subscribe(region, mbus, block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,9 +122,9 @@ bool ui_but_can_align(const uiBut *but)
|
||||
(BLI_rctf_size_y(&but->rect) > 0.0f));
|
||||
}
|
||||
|
||||
int ui_but_align_opposite_to_area_align_get(const ARegion *ar)
|
||||
int ui_but_align_opposite_to_area_align_get(const ARegion *region)
|
||||
{
|
||||
switch (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment)) {
|
||||
switch (RGN_ALIGN_ENUM_FROM_MASK(region->alignment)) {
|
||||
case RGN_ALIGN_TOP:
|
||||
return UI_BUT_ALIGN_DOWN;
|
||||
case RGN_ALIGN_BOTTOM:
|
||||
|
||||
@@ -160,7 +160,7 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
|
||||
shortcut_free_operator_property(prop);
|
||||
}
|
||||
|
||||
static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
|
||||
static uiBlock *menu_change_shortcut(bContext *C, ARegion *region, void *arg)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
uiBlock *block;
|
||||
@@ -186,7 +186,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
|
||||
|
||||
RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
|
||||
|
||||
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
|
||||
block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
|
||||
UI_block_func_handle_set(block, but_shortcut_name_func, but);
|
||||
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
|
||||
UI_block_direction_set(block, UI_DIR_CENTER_Y);
|
||||
@@ -216,7 +216,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
|
||||
static int g_kmi_id_hack;
|
||||
#endif
|
||||
|
||||
static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
|
||||
static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
uiBlock *block;
|
||||
@@ -248,7 +248,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
|
||||
|
||||
RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
|
||||
|
||||
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
|
||||
block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
|
||||
UI_block_func_handle_set(block, but_shortcut_name_func, but);
|
||||
UI_block_direction_set(block, UI_DIR_CENTER_Y);
|
||||
|
||||
@@ -1194,22 +1194,22 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
|
||||
|
||||
/* Show header tools for header buttons. */
|
||||
if (ui_block_is_popup_any(but->block) == false) {
|
||||
const ARegion *ar = CTX_wm_region(C);
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
|
||||
if (!ar) {
|
||||
if (!region) {
|
||||
/* skip */
|
||||
}
|
||||
else if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
else if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL);
|
||||
}
|
||||
else if (ar->regiontype == RGN_TYPE_NAV_BAR) {
|
||||
else if (region->regiontype == RGN_TYPE_NAV_BAR) {
|
||||
uiItemMenuF(layout,
|
||||
IFACE_("Navigation Bar"),
|
||||
ICON_NONE,
|
||||
ED_screens_navigation_bar_tools_menu_create,
|
||||
NULL);
|
||||
}
|
||||
else if (ar->regiontype == RGN_TYPE_FOOTER) {
|
||||
else if (region->regiontype == RGN_TYPE_FOOTER) {
|
||||
uiItemMenuF(layout, IFACE_("Footer"), ICON_NONE, ED_screens_footer_tools_menu_create, NULL);
|
||||
}
|
||||
}
|
||||
@@ -1231,10 +1231,10 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
|
||||
/**
|
||||
* menu to show when right clicking on the panel header
|
||||
*/
|
||||
void ui_popup_context_menu_for_panel(bContext *C, ARegion *ar, Panel *pa)
|
||||
void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *pa)
|
||||
{
|
||||
bScreen *sc = CTX_wm_screen(C);
|
||||
const bool has_panel_category = UI_panel_category_is_visible(ar);
|
||||
const bool has_panel_category = UI_panel_category_is_visible(region);
|
||||
const bool any_item_visible = has_panel_category;
|
||||
PointerRNA ptr;
|
||||
uiPopupMenu *pup;
|
||||
|
||||
@@ -692,7 +692,7 @@ void ui_draw_but_TAB_outline(const rcti *rect,
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
void ui_draw_but_IMAGE(ARegion *UNUSED(ar),
|
||||
void ui_draw_but_IMAGE(ARegion *UNUSED(region),
|
||||
uiBut *but,
|
||||
const uiWidgetColors *UNUSED(wcol),
|
||||
const rcti *rect)
|
||||
@@ -872,7 +872,7 @@ static void histogram_draw_one(float r,
|
||||
|
||||
#define HISTOGRAM_TOT_GRID_LINES 4
|
||||
|
||||
void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar),
|
||||
void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
|
||||
uiBut *but,
|
||||
const uiWidgetColors *UNUSED(wcol),
|
||||
const rcti *recti)
|
||||
@@ -985,7 +985,7 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3])
|
||||
GPU_batch_discard(batch);
|
||||
}
|
||||
|
||||
void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar),
|
||||
void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
|
||||
uiBut *but,
|
||||
const uiWidgetColors *UNUSED(wcol),
|
||||
const rcti *recti)
|
||||
@@ -1330,7 +1330,7 @@ static void vectorscope_draw_target(
|
||||
immEnd();
|
||||
}
|
||||
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar),
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region),
|
||||
uiBut *but,
|
||||
const uiWidgetColors *UNUSED(wcol),
|
||||
const rcti *recti)
|
||||
@@ -1848,7 +1848,7 @@ static void gl_shaded_color(const uchar *color, int shade)
|
||||
immUniformColor3ubv(color_shaded);
|
||||
}
|
||||
|
||||
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
|
||||
void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
|
||||
{
|
||||
CurveMapping *cumap;
|
||||
|
||||
@@ -1889,7 +1889,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
|
||||
.xmax = rect->xmax,
|
||||
.ymax = rect->ymax,
|
||||
};
|
||||
rcti scissor_region = {0, ar->winx, 0, ar->winy};
|
||||
rcti scissor_region = {0, region->winx, 0, region->winy};
|
||||
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
|
||||
GPU_scissor(scissor_new.xmin,
|
||||
scissor_new.ymin,
|
||||
@@ -2124,7 +2124,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
|
||||
}
|
||||
|
||||
/** Used to draw a curve profile widget. Somewhat similar to ui_draw_but_CURVE */
|
||||
void ui_draw_but_CURVEPROFILE(ARegion *ar,
|
||||
void ui_draw_but_CURVEPROFILE(ARegion *region,
|
||||
uiBut *but,
|
||||
const uiWidgetColors *wcol,
|
||||
const rcti *rect)
|
||||
@@ -2159,7 +2159,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *ar,
|
||||
.xmax = rect->xmax,
|
||||
.ymax = rect->ymax,
|
||||
};
|
||||
rcti scissor_region = {0, ar->winx, 0, ar->winy};
|
||||
rcti scissor_region = {0, region->winx, 0, region->winy};
|
||||
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
|
||||
GPU_scissor(scissor_new.xmin,
|
||||
scissor_new.ymin,
|
||||
@@ -2348,7 +2348,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *ar,
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar),
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
|
||||
uiBut *but,
|
||||
const uiWidgetColors *UNUSED(wcol),
|
||||
const rcti *recti)
|
||||
|
||||
@@ -106,7 +106,7 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig *keyconf)
|
||||
/** \name Generic Shared Functions
|
||||
* \{ */
|
||||
|
||||
void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *ar, const char *name)
|
||||
void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *region, const char *name)
|
||||
{
|
||||
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
@@ -115,12 +115,12 @@ void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *ar, co
|
||||
const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
|
||||
|
||||
if ((name[0] == '\0') || (BLI_rcti_isect_pt(&ar->winrct, x, y) == false)) {
|
||||
if ((name[0] == '\0') || (BLI_rcti_isect_pt(®ion->winrct, x, y) == false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
x = x - ar->winrct.xmin;
|
||||
y = y - ar->winrct.ymin;
|
||||
x = x - region->winrct.xmin;
|
||||
y = y - region->winrct.ymin;
|
||||
|
||||
y += U.widget_unit;
|
||||
|
||||
@@ -140,9 +140,9 @@ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *ev
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y);
|
||||
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_ANY, event->x, event->y);
|
||||
ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_ANY, event->x, event->y);
|
||||
|
||||
uiBut *but = ui_but_find_mouse_over(ar, event);
|
||||
uiBut *but = ui_but_find_mouse_over(region, event);
|
||||
|
||||
if (ELEM(NULL, but, but->rnapoin.data, but->rnaprop)) {
|
||||
return NULL;
|
||||
|
||||
@@ -143,34 +143,34 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3])
|
||||
|
||||
if (sa) {
|
||||
if (sa->spacetype == SPACE_IMAGE) {
|
||||
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (ar) {
|
||||
ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (region) {
|
||||
SpaceImage *sima = sa->spacedata.first;
|
||||
int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
|
||||
int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
|
||||
|
||||
if (ED_space_image_color_sample(sima, ar, mval, r_col)) {
|
||||
if (ED_space_image_color_sample(sima, region, mval, r_col)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sa->spacetype == SPACE_NODE) {
|
||||
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (ar) {
|
||||
ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (region) {
|
||||
SpaceNode *snode = sa->spacedata.first;
|
||||
int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
|
||||
int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
|
||||
|
||||
if (ED_space_node_color_sample(bmain, snode, ar, mval, r_col)) {
|
||||
if (ED_space_node_color_sample(bmain, snode, region, mval, r_col)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sa->spacetype == SPACE_CLIP) {
|
||||
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (ar) {
|
||||
ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (region) {
|
||||
SpaceClip *sc = sa->spacedata.first;
|
||||
int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
|
||||
int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
|
||||
|
||||
if (ED_space_clip_color_sample(sc, ar, mval, r_col)) {
|
||||
if (ED_space_clip_color_sample(sc, region, mval, r_col)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ typedef struct DataDropper {
|
||||
char name[200];
|
||||
} DataDropper;
|
||||
|
||||
static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg)
|
||||
static void datadropper_draw_cb(const struct bContext *C, ARegion *region, void *arg)
|
||||
{
|
||||
DataDropper *ddr = arg;
|
||||
eyedropper_draw_cursor_text(C, ar, ddr->name);
|
||||
eyedropper_draw_cursor_text(C, region, ddr->name);
|
||||
}
|
||||
|
||||
static int datadropper_init(bContext *C, wmOperator *op)
|
||||
@@ -161,16 +161,16 @@ static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int
|
||||
|
||||
if (sa) {
|
||||
if (ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_OUTLINER)) {
|
||||
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (ar) {
|
||||
const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
|
||||
ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (region) {
|
||||
const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
|
||||
Base *base;
|
||||
|
||||
CTX_wm_area_set(C, sa);
|
||||
CTX_wm_region_set(C, ar);
|
||||
CTX_wm_region_set(C, region);
|
||||
|
||||
/* grr, always draw else we leave stale text */
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
if (sa->spacetype == SPACE_VIEW3D) {
|
||||
base = ED_view3d_give_base_under_cursor(C, mval);
|
||||
@@ -259,8 +259,8 @@ static void datadropper_set_draw_callback_region(bContext *C,
|
||||
ED_region_draw_cb_exit(ddr->art, ddr->draw_handle_pixel);
|
||||
|
||||
/* Redraw old area */
|
||||
ARegion *ar = BKE_area_find_region_type(ddr->cursor_area, RGN_TYPE_WINDOW);
|
||||
ED_region_tag_redraw(ar);
|
||||
ARegion *region = BKE_area_find_region_type(ddr->cursor_area, RGN_TYPE_WINDOW);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
/* Set draw callback in new region */
|
||||
ARegionType *art = BKE_regiontype_from_id(sa->type, RGN_TYPE_WINDOW);
|
||||
|
||||
@@ -77,10 +77,10 @@ typedef struct DepthDropper {
|
||||
char name[200];
|
||||
} DepthDropper;
|
||||
|
||||
static void depthdropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg)
|
||||
static void depthdropper_draw_cb(const struct bContext *C, ARegion *region, void *arg)
|
||||
{
|
||||
DepthDropper *ddr = arg;
|
||||
eyedropper_draw_cursor_text(C, ar, ddr->name);
|
||||
eyedropper_draw_cursor_text(C, region, ddr->name);
|
||||
}
|
||||
|
||||
static int depthdropper_init(bContext *C, wmOperator *op)
|
||||
@@ -166,30 +166,30 @@ static void depthdropper_depth_sample_pt(
|
||||
|
||||
if (sa) {
|
||||
if (sa->spacetype == SPACE_VIEW3D) {
|
||||
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (ar) {
|
||||
ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
|
||||
if (region) {
|
||||
struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
View3D *v3d = sa->spacedata.first;
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
/* weak, we could pass in some reference point */
|
||||
const float *view_co = v3d->camera ? v3d->camera->obmat[3] : rv3d->viewinv[3];
|
||||
const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
|
||||
const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
|
||||
float co[3];
|
||||
|
||||
CTX_wm_area_set(C, sa);
|
||||
CTX_wm_region_set(C, ar);
|
||||
CTX_wm_region_set(C, region);
|
||||
|
||||
/* grr, always draw else we leave stale text */
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
if (ED_view3d_autodist(depsgraph, ar, v3d, mval, co, true, NULL)) {
|
||||
const float mval_center_fl[2] = {(float)ar->winx / 2, (float)ar->winy / 2};
|
||||
if (ED_view3d_autodist(depsgraph, region, v3d, mval, co, true, NULL)) {
|
||||
const float mval_center_fl[2] = {(float)region->winx / 2, (float)region->winy / 2};
|
||||
float co_align[3];
|
||||
|
||||
/* quick way to get view-center aligned point */
|
||||
ED_view3d_win_to_3d(v3d, ar, co, mval_center_fl, co_align);
|
||||
ED_view3d_win_to_3d(v3d, region, co, mval_center_fl, co_align);
|
||||
|
||||
*r_depth = len_v3v3(view_co, co_align);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
/* interface_eyedropper.c */
|
||||
void eyedropper_draw_cursor_text(const struct bContext *C,
|
||||
const struct ARegion *ar,
|
||||
const struct ARegion *region,
|
||||
const char *name);
|
||||
uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -456,23 +456,29 @@ typedef struct uiSafetyRct {
|
||||
|
||||
void ui_fontscale(short *points, float aspect);
|
||||
|
||||
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
|
||||
extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
|
||||
extern void ui_block_to_window_rctf(const struct ARegion *ar,
|
||||
extern void ui_block_to_window_fl(const struct ARegion *region,
|
||||
uiBlock *block,
|
||||
float *x,
|
||||
float *y);
|
||||
extern void ui_block_to_window(const struct ARegion *region, uiBlock *block, int *x, int *y);
|
||||
extern void ui_block_to_window_rctf(const struct ARegion *region,
|
||||
uiBlock *block,
|
||||
rctf *rct_dst,
|
||||
const rctf *rct_src);
|
||||
extern float ui_block_to_window_scale(const struct ARegion *ar, uiBlock *block);
|
||||
extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
|
||||
extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
|
||||
extern void ui_window_to_block_rctf(const struct ARegion *ar,
|
||||
extern float ui_block_to_window_scale(const struct ARegion *region, uiBlock *block);
|
||||
extern void ui_window_to_block_fl(const struct ARegion *region,
|
||||
uiBlock *block,
|
||||
float *x,
|
||||
float *y);
|
||||
extern void ui_window_to_block(const struct ARegion *region, uiBlock *block, int *x, int *y);
|
||||
extern void ui_window_to_block_rctf(const struct ARegion *region,
|
||||
uiBlock *block,
|
||||
rctf *rct_dst,
|
||||
const rctf *rct_src);
|
||||
extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
|
||||
extern void ui_window_to_region_rcti(const ARegion *ar, rcti *rect_dst, const rcti *rct_src);
|
||||
extern void ui_region_to_window(const struct ARegion *ar, int *x, int *y);
|
||||
extern void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect);
|
||||
extern void ui_window_to_region(const ARegion *region, int *x, int *y);
|
||||
extern void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src);
|
||||
extern void ui_region_to_window(const struct ARegion *region, int *x, int *y);
|
||||
extern void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect);
|
||||
|
||||
extern double ui_but_value_get(uiBut *but);
|
||||
extern void ui_but_value_set(uiBut *but, double value);
|
||||
@@ -642,16 +648,16 @@ ColorPicker *ui_block_colorpicker_create(struct uiBlock *block);
|
||||
/* Searchbox for string button */
|
||||
ARegion *ui_searchbox_create_generic(struct bContext *C, struct ARegion *butregion, uiBut *but);
|
||||
ARegion *ui_searchbox_create_operator(struct bContext *C, struct ARegion *butregion, uiBut *but);
|
||||
bool ui_searchbox_inside(struct ARegion *ar, int x, int y);
|
||||
int ui_searchbox_find_index(struct ARegion *ar, const char *name);
|
||||
void ui_searchbox_update(struct bContext *C, struct ARegion *ar, uiBut *but, const bool reset);
|
||||
int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but, char *str);
|
||||
bool ui_searchbox_inside(struct ARegion *region, int x, int y);
|
||||
int ui_searchbox_find_index(struct ARegion *region, const char *name);
|
||||
void ui_searchbox_update(struct bContext *C, struct ARegion *region, uiBut *but, const bool reset);
|
||||
int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *region, uiBut *but, char *str);
|
||||
void ui_searchbox_event(struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
uiBut *but,
|
||||
const struct wmEvent *event);
|
||||
bool ui_searchbox_apply(uiBut *but, struct ARegion *ar);
|
||||
void ui_searchbox_free(struct bContext *C, struct ARegion *ar);
|
||||
bool ui_searchbox_apply(uiBut *but, struct ARegion *region);
|
||||
void ui_searchbox_free(struct bContext *C, struct ARegion *region);
|
||||
void ui_but_search_refresh(uiBut *but);
|
||||
|
||||
/* interface_region_menu_popup.c */
|
||||
@@ -696,7 +702,7 @@ void ui_pie_menu_level_create(uiBlock *block,
|
||||
int flag);
|
||||
|
||||
/* interface_region_popup.c */
|
||||
void ui_popup_translate(struct ARegion *ar, const int mdiff[2]);
|
||||
void ui_popup_translate(struct ARegion *region, const int mdiff[2]);
|
||||
void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle);
|
||||
void ui_popup_block_scrolltest(struct uiBlock *block);
|
||||
|
||||
@@ -705,7 +711,7 @@ void ui_popup_block_scrolltest(struct uiBlock *block);
|
||||
/* interface_panel.c */
|
||||
extern int ui_handler_panel_region(struct bContext *C,
|
||||
const struct wmEvent *event,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const uiBut *active_but);
|
||||
extern void ui_draw_aligned_panel(struct uiStyle *style,
|
||||
uiBlock *block,
|
||||
@@ -723,33 +729,33 @@ void ui_draw_but_TAB_outline(const rcti *rect,
|
||||
float rad,
|
||||
uchar highlight[3],
|
||||
uchar highlight_fade[3]);
|
||||
void ui_draw_but_HISTOGRAM(ARegion *ar,
|
||||
void ui_draw_but_HISTOGRAM(ARegion *region,
|
||||
uiBut *but,
|
||||
const struct uiWidgetColors *wcol,
|
||||
const rcti *rect);
|
||||
void ui_draw_but_WAVEFORM(ARegion *ar,
|
||||
void ui_draw_but_WAVEFORM(ARegion *region,
|
||||
uiBut *but,
|
||||
const struct uiWidgetColors *wcol,
|
||||
const rcti *rect);
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *ar,
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *region,
|
||||
uiBut *but,
|
||||
const struct uiWidgetColors *wcol,
|
||||
const rcti *rect);
|
||||
void ui_draw_but_COLORBAND(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_UNITVEC(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_CURVE(ARegion *ar,
|
||||
void ui_draw_but_CURVE(ARegion *region,
|
||||
uiBut *but,
|
||||
const struct uiWidgetColors *wcol,
|
||||
const rcti *rect);
|
||||
void ui_draw_but_CURVEPROFILE(ARegion *ar,
|
||||
void ui_draw_but_CURVEPROFILE(ARegion *region,
|
||||
uiBut *but,
|
||||
const struct uiWidgetColors *wcol,
|
||||
const rcti *rect);
|
||||
void ui_draw_but_IMAGE(ARegion *ar,
|
||||
void ui_draw_but_IMAGE(ARegion *region,
|
||||
uiBut *but,
|
||||
const struct uiWidgetColors *wcol,
|
||||
const rcti *rect);
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *ar,
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *region,
|
||||
uiBut *but,
|
||||
const struct uiWidgetColors *wcol,
|
||||
const rcti *rect);
|
||||
@@ -759,14 +765,14 @@ PointerRNA *ui_handle_afterfunc_add_operator(struct wmOperatorType *ot,
|
||||
int opcontext,
|
||||
bool create_props);
|
||||
extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val);
|
||||
extern void ui_but_activate_event(struct bContext *C, struct ARegion *ar, uiBut *but);
|
||||
extern void ui_but_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but);
|
||||
extern void ui_but_activate_event(struct bContext *C, struct ARegion *region, uiBut *but);
|
||||
extern void ui_but_activate_over(struct bContext *C, struct ARegion *region, uiBut *but);
|
||||
extern void ui_but_execute_begin(struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
uiBut *but,
|
||||
void **active_back);
|
||||
extern void ui_but_execute_end(struct bContext *C,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
uiBut *but,
|
||||
void *active_back);
|
||||
extern void ui_but_active_free(const struct bContext *C, uiBut *but);
|
||||
@@ -826,7 +832,7 @@ struct GPUBatch *ui_batch_roundbox_shadow_get(void);
|
||||
|
||||
void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4]);
|
||||
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
|
||||
void ui_draw_popover_back(ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect);
|
||||
void ui_draw_popover_back(ARegion *region, struct uiStyle *style, uiBlock *block, rcti *rect);
|
||||
void ui_draw_pie_center(uiBlock *block);
|
||||
const struct uiWidgetColors *ui_tooltip_get_theme(void);
|
||||
|
||||
@@ -835,7 +841,7 @@ void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow);
|
||||
void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
|
||||
|
||||
extern void ui_draw_but(
|
||||
const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
|
||||
const struct bContext *C, ARegion *region, struct uiStyle *style, uiBut *but, rcti *rect);
|
||||
|
||||
void ui_draw_menu_item(const struct uiFontStyle *fstyle,
|
||||
rcti *rect,
|
||||
@@ -884,7 +890,7 @@ void ui_item_paneltype_func(struct bContext *C, struct uiLayout *layout, void *a
|
||||
|
||||
/* interface_align.c */
|
||||
bool ui_but_can_align(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
|
||||
int ui_but_align_opposite_to_area_align_get(const ARegion *ar) ATTR_WARN_UNUSED_RESULT;
|
||||
int ui_but_align_opposite_to_area_align_get(const ARegion *region) ATTR_WARN_UNUSED_RESULT;
|
||||
void ui_block_align_calc(uiBlock *block, const ARegion *region);
|
||||
|
||||
/* interface_anim.c */
|
||||
@@ -913,24 +919,24 @@ bool ui_but_is_cursor_warp(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_but_contains_pt(const uiBut *but, float mx, float my) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_but_contains_rect(const uiBut *but, const rctf *rect);
|
||||
bool ui_but_contains_point_px_icon(const uiBut *but,
|
||||
struct ARegion *ar,
|
||||
struct ARegion *region,
|
||||
const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_but_contains_point_px(const uiBut *but, const struct ARegion *ar, int x, int y)
|
||||
bool ui_but_contains_point_px(const uiBut *but, const struct ARegion *region, int x, int y)
|
||||
ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
uiBut *ui_list_find_mouse_over(struct ARegion *ar,
|
||||
uiBut *ui_list_find_mouse_over(struct ARegion *region,
|
||||
const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
uiBut *ui_but_find_mouse_over_ex(struct ARegion *ar,
|
||||
uiBut *ui_but_find_mouse_over_ex(struct ARegion *region,
|
||||
const int x,
|
||||
const int y,
|
||||
const bool labeledit) ATTR_WARN_UNUSED_RESULT;
|
||||
uiBut *ui_but_find_mouse_over(struct ARegion *ar,
|
||||
uiBut *ui_but_find_mouse_over(struct ARegion *region,
|
||||
const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT;
|
||||
uiBut *ui_but_find_rect_over(const struct ARegion *ar,
|
||||
uiBut *ui_but_find_rect_over(const struct ARegion *region,
|
||||
const rcti *rect_px) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
uiBut *ui_list_find_mouse_over_ex(struct ARegion *ar, int x, int y) ATTR_WARN_UNUSED_RESULT;
|
||||
uiBut *ui_list_find_mouse_over_ex(struct ARegion *region, int x, int y) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
bool ui_but_contains_password(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
@@ -944,17 +950,21 @@ bool ui_block_is_popover(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_block_is_popup_any(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
uiBut *ui_region_find_first_but_test_flag(struct ARegion *ar, int flag_include, int flag_exclude);
|
||||
uiBut *ui_region_find_active_but(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_region_contains_point_px(const struct ARegion *ar, int x, int y) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_region_contains_rect_px(const struct ARegion *ar, const rcti *rect_px);
|
||||
uiBut *ui_region_find_first_but_test_flag(struct ARegion *region,
|
||||
int flag_include,
|
||||
int flag_exclude);
|
||||
uiBut *ui_region_find_active_but(struct ARegion *region) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_region_contains_point_px(const struct ARegion *region,
|
||||
int x,
|
||||
int y) ATTR_WARN_UNUSED_RESULT;
|
||||
bool ui_region_contains_rect_px(const struct ARegion *region, const rcti *rect_px);
|
||||
|
||||
ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y);
|
||||
ARegion *ui_screen_region_find_mouse_over(bScreen *screen, const struct wmEvent *event);
|
||||
|
||||
/* interface_context_menu.c */
|
||||
bool ui_popup_context_menu_for_button(struct bContext *C, uiBut *but);
|
||||
void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *ar, struct Panel *pa);
|
||||
void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *region, struct Panel *pa);
|
||||
|
||||
/* interface_eyedropper.c */
|
||||
struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf);
|
||||
|
||||
@@ -1067,7 +1067,7 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C,
|
||||
PropertyRNA **r_prop,
|
||||
bool *r_is_undo)
|
||||
{
|
||||
ARegion *ar = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
|
||||
uiBlock *block;
|
||||
uiBut *but, *prevbut = NULL;
|
||||
|
||||
@@ -1075,11 +1075,11 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C,
|
||||
*r_prop = NULL;
|
||||
*r_is_undo = false;
|
||||
|
||||
if (!ar) {
|
||||
if (!region) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (but && but->rnapoin.data) {
|
||||
if (RNA_property_type(but->rnaprop) == PROP_STRING) {
|
||||
|
||||
@@ -1329,7 +1329,7 @@ static int editsource_exec(bContext *C, wmOperator *op)
|
||||
GHashIterator ghi;
|
||||
struct uiEditSourceButStore *but_store = NULL;
|
||||
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
int ret;
|
||||
|
||||
/* needed else the active button does not get tested */
|
||||
@@ -1341,9 +1341,9 @@ static int editsource_exec(bContext *C, wmOperator *op)
|
||||
ui_editsource_active_but_set(but);
|
||||
|
||||
/* redraw and get active button python info */
|
||||
ED_region_do_layout(C, ar);
|
||||
ED_region_do_draw(C, ar);
|
||||
ar->do_draw = false;
|
||||
ED_region_do_layout(C, region);
|
||||
ED_region_do_draw(C, region);
|
||||
region->do_draw = false;
|
||||
|
||||
for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
|
||||
BLI_ghashIterator_done(&ghi) == false;
|
||||
@@ -1620,17 +1620,17 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
||||
bScreen *sc = CTX_wm_screen(C);
|
||||
const bool skip_depressed = RNA_boolean_get(op->ptr, "skip_depressed");
|
||||
ARegion *ar_prev = CTX_wm_region(C);
|
||||
ARegion *ar = sc ? BKE_screen_find_region_xy(sc, RGN_TYPE_ANY, event->x, event->y) : NULL;
|
||||
ARegion *region = sc ? BKE_screen_find_region_xy(sc, RGN_TYPE_ANY, event->x, event->y) : NULL;
|
||||
|
||||
if (ar == NULL) {
|
||||
ar = ar_prev;
|
||||
if (region == NULL) {
|
||||
region = ar_prev;
|
||||
}
|
||||
|
||||
if (ar == NULL) {
|
||||
if (region == NULL) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
CTX_wm_region_set(C, ar);
|
||||
CTX_wm_region_set(C, region);
|
||||
uiBut *but = UI_context_active_but_get(C);
|
||||
CTX_wm_region_set(C, ar_prev);
|
||||
|
||||
@@ -1645,7 +1645,7 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
||||
* having this avoids a minor drawing glitch. */
|
||||
void *but_optype = but->optype;
|
||||
|
||||
UI_but_execute(C, ar, but);
|
||||
UI_but_execute(C, region, but);
|
||||
|
||||
but->optype = but_optype;
|
||||
|
||||
@@ -1709,14 +1709,14 @@ bool UI_drop_color_poll(struct bContext *C,
|
||||
* return true always */
|
||||
if (drag->type == WM_DRAG_COLOR) {
|
||||
SpaceImage *sima = CTX_wm_space_image(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
if (UI_but_active_drop_color(C)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (sima && (sima->mode == SI_MODE_PAINT) && sima->image &&
|
||||
(ar && ar->regiontype == RGN_TYPE_WINDOW)) {
|
||||
(region && region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1734,7 +1734,7 @@ void UI_drop_color_copy(wmDrag *drag, wmDropBox *drop)
|
||||
|
||||
static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
uiBut *but = NULL;
|
||||
float color[4];
|
||||
bool gamma;
|
||||
@@ -1744,7 +1744,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
/* find button under mouse, check if it has RNA color property and
|
||||
* if it does copy the data */
|
||||
but = ui_region_find_active_but(ar);
|
||||
but = ui_region_find_active_but(region);
|
||||
|
||||
if (but && but->type == UI_BTYPE_COLOR && but->rnaprop) {
|
||||
const int color_len = RNA_property_array_length(&but->rnapoin, but->rnaprop);
|
||||
@@ -1778,7 +1778,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
ED_imapaint_bucket_fill(C, color, op, event->mval);
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -131,21 +131,21 @@ typedef enum eSpaceButtons_Align {
|
||||
BUT_AUTO = 2,
|
||||
} eSpaceButtons_Align;
|
||||
|
||||
static int panel_aligned(const ScrArea *sa, const ARegion *ar)
|
||||
static int panel_aligned(const ScrArea *sa, const ARegion *region)
|
||||
{
|
||||
if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
|
||||
return BUT_VERTICAL;
|
||||
}
|
||||
else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
else if (sa->spacetype == SPACE_USERPREF && region->regiontype == RGN_TYPE_WINDOW) {
|
||||
return BUT_VERTICAL;
|
||||
}
|
||||
else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) {
|
||||
else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) {
|
||||
return BUT_VERTICAL;
|
||||
}
|
||||
else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) {
|
||||
else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) {
|
||||
return BUT_VERTICAL;
|
||||
}
|
||||
else if (ELEM(ar->regiontype,
|
||||
else if (ELEM(region->regiontype,
|
||||
RGN_TYPE_UI,
|
||||
RGN_TYPE_TOOLS,
|
||||
RGN_TYPE_TOOL_PROPS,
|
||||
@@ -196,28 +196,28 @@ static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, b
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **r_pa_animate)
|
||||
static bool panels_need_realign(ScrArea *sa, ARegion *region, Panel **r_pa_animate)
|
||||
{
|
||||
*r_pa_animate = NULL;
|
||||
|
||||
if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
|
||||
SpaceProperties *sbuts = sa->spacedata.first;
|
||||
|
||||
if (sbuts->mainbo != sbuts->mainb) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) {
|
||||
else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) {
|
||||
return true;
|
||||
}
|
||||
else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) {
|
||||
else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Detect if a panel was added or removed. */
|
||||
Panel *pa_animation = NULL;
|
||||
bool no_animation = false;
|
||||
if (panel_active_animation_changed(&ar->panels, &pa_animation, &no_animation)) {
|
||||
if (panel_active_animation_changed(®ion->panels, &pa_animation, &no_animation)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -234,15 +234,15 @@ static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **r_pa_animate)
|
||||
|
||||
/****************************** panels ******************************/
|
||||
|
||||
static void panels_collapse_all(ScrArea *sa, ARegion *ar, const Panel *from_pa)
|
||||
static void panels_collapse_all(ScrArea *sa, ARegion *region, const Panel *from_pa)
|
||||
{
|
||||
const bool has_category_tabs = UI_panel_category_is_visible(ar);
|
||||
const char *category = has_category_tabs ? UI_panel_category_active_get(ar, false) : NULL;
|
||||
const int flag = ((panel_aligned(sa, ar) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
|
||||
const bool has_category_tabs = UI_panel_category_is_visible(region);
|
||||
const char *category = has_category_tabs ? UI_panel_category_active_get(region, false) : NULL;
|
||||
const int flag = ((panel_aligned(sa, region) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
|
||||
const PanelType *from_pt = from_pa->type;
|
||||
Panel *pa;
|
||||
|
||||
for (pa = ar->panels.first; pa; pa = pa->next) {
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
PanelType *pt = pa->type;
|
||||
|
||||
/* close panels with headers in the same context */
|
||||
@@ -274,14 +274,19 @@ Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt)
|
||||
/**
|
||||
* \note \a pa should be return value from #UI_panel_find_by_type and can be NULL.
|
||||
*/
|
||||
Panel *UI_panel_begin(
|
||||
ScrArea *sa, ARegion *ar, ListBase *lb, uiBlock *block, PanelType *pt, Panel *pa, bool *r_open)
|
||||
Panel *UI_panel_begin(ScrArea *sa,
|
||||
ARegion *region,
|
||||
ListBase *lb,
|
||||
uiBlock *block,
|
||||
PanelType *pt,
|
||||
Panel *pa,
|
||||
bool *r_open)
|
||||
{
|
||||
Panel *palast, *panext;
|
||||
const char *drawname = CTX_IFACE_(pt->translation_context, pt->label);
|
||||
const char *idname = pt->idname;
|
||||
const bool newpanel = (pa == NULL);
|
||||
int align = panel_aligned(sa, ar);
|
||||
int align = panel_aligned(sa, region);
|
||||
|
||||
if (!newpanel) {
|
||||
pa->type = pt;
|
||||
@@ -352,7 +357,7 @@ Panel *UI_panel_begin(
|
||||
/* assign to block */
|
||||
block->panel = pa;
|
||||
pa->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED;
|
||||
if (ar->alignment == RGN_ALIGN_FLOAT) {
|
||||
if (region->alignment == RGN_ALIGN_FLOAT) {
|
||||
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
|
||||
}
|
||||
|
||||
@@ -367,10 +372,11 @@ Panel *UI_panel_begin(
|
||||
return pa;
|
||||
}
|
||||
|
||||
static float panel_region_offset_x_get(const ARegion *ar, int align)
|
||||
static float panel_region_offset_x_get(const ARegion *region, int align)
|
||||
{
|
||||
if (UI_panel_category_is_visible(ar)) {
|
||||
if (align == BUT_VERTICAL && (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT)) {
|
||||
if (UI_panel_category_is_visible(region)) {
|
||||
if (align == BUT_VERTICAL &&
|
||||
(RGN_ALIGN_ENUM_FROM_MASK(region->alignment) != RGN_ALIGN_RIGHT)) {
|
||||
return UI_PANEL_CATEGORY_MARGIN_WIDTH;
|
||||
}
|
||||
}
|
||||
@@ -379,7 +385,7 @@ static float panel_region_offset_x_get(const ARegion *ar, int align)
|
||||
}
|
||||
|
||||
void UI_panel_end(
|
||||
const ScrArea *sa, const ARegion *ar, uiBlock *block, int width, int height, bool open)
|
||||
const ScrArea *sa, const ARegion *region, uiBlock *block, int width, int height, bool open)
|
||||
{
|
||||
Panel *pa = block->panel;
|
||||
|
||||
@@ -419,8 +425,8 @@ void UI_panel_end(
|
||||
pa->ofsy += old_sizey - pa->sizey;
|
||||
}
|
||||
|
||||
int align = panel_aligned(sa, ar);
|
||||
if (old_region_ofsx != panel_region_offset_x_get(ar, align)) {
|
||||
int align = panel_aligned(sa, region);
|
||||
if (old_region_ofsx != panel_region_offset_x_get(region, align)) {
|
||||
pa->runtime_flag |= PNL_ANIM_ALIGN;
|
||||
}
|
||||
}
|
||||
@@ -1015,16 +1021,16 @@ static void align_sub_panels(Panel *pa)
|
||||
|
||||
/* this doesn't draw */
|
||||
/* returns 1 when it did something */
|
||||
static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bool drag)
|
||||
static bool uiAlignPanelStep(ScrArea *sa, ARegion *region, const float fac, const bool drag)
|
||||
{
|
||||
Panel *pa;
|
||||
PanelSort *ps, *panelsort, *psnext;
|
||||
int a, tot = 0;
|
||||
bool done;
|
||||
int align = panel_aligned(sa, ar);
|
||||
int align = panel_aligned(sa, region);
|
||||
|
||||
/* count active, not tabbed panels */
|
||||
for (pa = ar->panels.first; pa; pa = pa->next) {
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
tot++;
|
||||
}
|
||||
@@ -1035,7 +1041,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
|
||||
}
|
||||
|
||||
/* extra; change close direction? */
|
||||
for (pa = ar->panels.first; pa; pa = pa->next) {
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
if ((pa->flag & PNL_CLOSEDX) && (align == BUT_VERTICAL)) {
|
||||
pa->flag ^= PNL_CLOSED;
|
||||
@@ -1050,7 +1056,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
|
||||
panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort");
|
||||
|
||||
ps = panelsort;
|
||||
for (pa = ar->panels.first; pa; pa = pa->next) {
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
ps->pa = MEM_dupallocN(pa);
|
||||
ps->orig = pa;
|
||||
@@ -1078,7 +1084,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
|
||||
|
||||
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
|
||||
ps = panelsort;
|
||||
ps->pa->runtime.region_ofsx = panel_region_offset_x_get(ar, align);
|
||||
ps->pa->runtime.region_ofsx = panel_region_offset_x_get(region, align);
|
||||
ps->pa->ofsx = 0;
|
||||
ps->pa->ofsy = -get_panel_size_y(ps->pa);
|
||||
ps->pa->ofsx += ps->pa->runtime.region_ofsx;
|
||||
@@ -1112,7 +1118,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
|
||||
}
|
||||
|
||||
/* set locations for tabbed and sub panels */
|
||||
for (pa = ar->panels.first; pa; pa = pa->next) {
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
if (pa->children.first) {
|
||||
align_sub_panels(pa);
|
||||
@@ -1129,15 +1135,15 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
|
||||
return done;
|
||||
}
|
||||
|
||||
static void ui_panels_size(ScrArea *sa, ARegion *ar, int *r_x, int *r_y)
|
||||
static void ui_panels_size(ScrArea *sa, ARegion *region, int *r_x, int *r_y)
|
||||
{
|
||||
Panel *pa;
|
||||
int align = panel_aligned(sa, ar);
|
||||
int align = panel_aligned(sa, region);
|
||||
int sizex = 0;
|
||||
int sizey = 0;
|
||||
|
||||
/* compute size taken up by panels, for setting in view2d */
|
||||
for (pa = ar->panels.first; pa; pa = pa->next) {
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
int pa_sizex, pa_sizey;
|
||||
|
||||
@@ -1170,15 +1176,15 @@ static void ui_do_animate(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiHandlePanelData *data = panel->activedata;
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
float fac;
|
||||
|
||||
fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME;
|
||||
fac = min_ff(sqrtf(fac), 1.0f);
|
||||
|
||||
/* for max 1 second, interpolate positions */
|
||||
if (uiAlignPanelStep(sa, ar, fac, false)) {
|
||||
ED_region_tag_redraw(ar);
|
||||
if (uiAlignPanelStep(sa, region, fac, false)) {
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
else {
|
||||
fac = 1.0f;
|
||||
@@ -1206,38 +1212,38 @@ static void panel_list_clear_active(ListBase *lb)
|
||||
}
|
||||
}
|
||||
|
||||
void UI_panels_begin(const bContext *UNUSED(C), ARegion *ar)
|
||||
void UI_panels_begin(const bContext *UNUSED(C), ARegion *region)
|
||||
{
|
||||
panel_list_clear_active(&ar->panels);
|
||||
panel_list_clear_active(®ion->panels);
|
||||
}
|
||||
|
||||
/* only draws blocks with panels */
|
||||
void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y)
|
||||
void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
uiBlock *block;
|
||||
Panel *pa, *firstpa;
|
||||
|
||||
/* offset contents */
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
if (block->active && block->panel) {
|
||||
ui_offset_panel_block(block);
|
||||
}
|
||||
}
|
||||
|
||||
/* re-align, possibly with animation */
|
||||
if (panels_need_realign(sa, ar, &pa)) {
|
||||
if (panels_need_realign(sa, region, &pa)) {
|
||||
if (pa) {
|
||||
panel_activate_state(C, pa, PANEL_STATE_ANIMATION);
|
||||
}
|
||||
else {
|
||||
uiAlignPanelStep(sa, ar, 1.0, false);
|
||||
uiAlignPanelStep(sa, region, 1.0, false);
|
||||
}
|
||||
}
|
||||
|
||||
/* tag first panel */
|
||||
firstpa = NULL;
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
if (block->active && block->panel) {
|
||||
if (!firstpa || block->panel->sortorder < firstpa->sortorder) {
|
||||
firstpa = block->panel;
|
||||
@@ -1250,39 +1256,39 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y)
|
||||
}
|
||||
|
||||
/* compute size taken up by panel */
|
||||
ui_panels_size(sa, ar, r_x, r_y);
|
||||
ui_panels_size(sa, region, r_x, r_y);
|
||||
}
|
||||
|
||||
void UI_panels_draw(const bContext *C, ARegion *ar)
|
||||
void UI_panels_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
uiBlock *block;
|
||||
|
||||
if (ar->alignment != RGN_ALIGN_FLOAT) {
|
||||
if (region->alignment != RGN_ALIGN_FLOAT) {
|
||||
UI_ThemeClearColor(TH_BACK);
|
||||
}
|
||||
|
||||
/* Draw panels, selected on top. Also in reverse order, because
|
||||
* UI blocks are added in reverse order and we need child panels
|
||||
* to draw on top. */
|
||||
for (block = ar->uiblocks.last; block; block = block->prev) {
|
||||
for (block = region->uiblocks.last; block; block = block->prev) {
|
||||
if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
|
||||
UI_block_draw(C, block);
|
||||
}
|
||||
}
|
||||
|
||||
for (block = ar->uiblocks.last; block; block = block->prev) {
|
||||
for (block = region->uiblocks.last; block; block = block->prev) {
|
||||
if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
|
||||
UI_block_draw(C, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UI_panels_scale(ARegion *ar, float new_width)
|
||||
void UI_panels_scale(ARegion *region, float new_width)
|
||||
{
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
if (block->panel) {
|
||||
float fac = new_width / (float)block->panel->sizex;
|
||||
block->panel->sizex = new_width;
|
||||
@@ -1297,13 +1303,13 @@ void UI_panels_scale(ARegion *ar, float new_width)
|
||||
|
||||
/* ------------ panel merging ---------------- */
|
||||
|
||||
static void check_panel_overlap(ARegion *ar, Panel *panel)
|
||||
static void check_panel_overlap(ARegion *region, Panel *panel)
|
||||
{
|
||||
Panel *pa;
|
||||
|
||||
/* also called with (panel == NULL) for clear */
|
||||
|
||||
for (pa = ar->panels.first; pa; pa = pa->next) {
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
pa->flag &= ~PNL_OVERLAP;
|
||||
if (panel && (pa != panel)) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
@@ -1342,19 +1348,19 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
|
||||
{
|
||||
uiHandlePanelData *data = panel->activedata;
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
short align = panel_aligned(sa, ar), dx = 0, dy = 0;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
short align = panel_aligned(sa, region), dx = 0, dy = 0;
|
||||
|
||||
/* first clip for window, no dragging outside */
|
||||
if (!BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) {
|
||||
if (!BLI_rcti_isect_pt_v(®ion->winrct, &event->x)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dx = (event->x - data->startx) & ~(PNL_GRID - 1);
|
||||
dy = (event->y - data->starty) & ~(PNL_GRID - 1);
|
||||
|
||||
dx *= (float)BLI_rctf_size_x(&ar->v2d.cur) / (float)BLI_rcti_size_x(&ar->winrct);
|
||||
dy *= (float)BLI_rctf_size_y(&ar->v2d.cur) / (float)BLI_rcti_size_y(&ar->winrct);
|
||||
dx *= (float)BLI_rctf_size_x(®ion->v2d.cur) / (float)BLI_rcti_size_x(®ion->winrct);
|
||||
dy *= (float)BLI_rctf_size_y(®ion->v2d.cur) / (float)BLI_rcti_size_y(®ion->winrct);
|
||||
|
||||
if (data->state == PANEL_STATE_DRAG_SCALE) {
|
||||
panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX);
|
||||
@@ -1372,14 +1378,14 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
|
||||
|
||||
panel->ofsx = data->startofsx + dx;
|
||||
panel->ofsy = data->startofsy + dy;
|
||||
check_panel_overlap(ar, panel);
|
||||
check_panel_overlap(region, panel);
|
||||
|
||||
if (align) {
|
||||
uiAlignPanelStep(sa, ar, 0.2, true);
|
||||
uiAlignPanelStep(sa, region, 0.2, true);
|
||||
}
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
|
||||
/******************* region level panel interaction *****************/
|
||||
@@ -1436,16 +1442,16 @@ static void ui_panel_drag_collapse(bContext *C,
|
||||
const int xy_dst[2])
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
uiBlock *block;
|
||||
Panel *pa;
|
||||
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
float xy_a_block[2] = {UNPACK2(dragcol_data->xy_init)};
|
||||
float xy_b_block[2] = {UNPACK2(xy_dst)};
|
||||
rctf rect = block->rect;
|
||||
int oldflag;
|
||||
const bool is_horizontal = (panel_aligned(sa, ar) == BUT_HORIZONTAL);
|
||||
const bool is_horizontal = (panel_aligned(sa, region) == BUT_HORIZONTAL);
|
||||
|
||||
if ((pa = block->panel) == 0 || (pa->type && (pa->type->flag & PNL_NO_HEADER))) {
|
||||
continue;
|
||||
@@ -1461,8 +1467,8 @@ static void ui_panel_drag_collapse(bContext *C,
|
||||
}
|
||||
|
||||
/* use cursor coords in block space */
|
||||
ui_window_to_block_fl(ar, block, &xy_a_block[0], &xy_a_block[1]);
|
||||
ui_window_to_block_fl(ar, block, &xy_b_block[0], &xy_b_block[1]);
|
||||
ui_window_to_block_fl(region, block, &xy_a_block[0], &xy_a_block[1]);
|
||||
ui_window_to_block_fl(region, block, &xy_b_block[0], &xy_b_block[1]);
|
||||
|
||||
/* set up rect to match header size */
|
||||
rect.ymin = rect.ymax;
|
||||
@@ -1548,17 +1554,18 @@ static void ui_handle_panel_header(
|
||||
const bContext *C, uiBlock *block, int mx, int my, int event, short ctrl, short shift)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
#ifdef USE_PIN_HIDDEN
|
||||
const bool show_pin = UI_panel_category_is_visible(ar) && (block->panel->type->parent == NULL) &&
|
||||
(block->panel->flag & PNL_PIN);
|
||||
const bool show_pin = UI_panel_category_is_visible(region) &&
|
||||
(block->panel->type->parent == NULL) && (block->panel->flag & PNL_PIN);
|
||||
#else
|
||||
const bool show_pin = UI_panel_category_is_visible(ar) && (block->panel->type->parent == NULL);
|
||||
const bool show_pin = UI_panel_category_is_visible(region) &&
|
||||
(block->panel->type->parent == NULL);
|
||||
#endif
|
||||
const bool is_subpanel = (block->panel->type && block->panel->type->parent);
|
||||
const bool show_drag = !is_subpanel;
|
||||
|
||||
int align = panel_aligned(sa, ar), button = 0;
|
||||
int align = panel_aligned(sa, region), button = 0;
|
||||
|
||||
rctf rect_drag, rect_pin;
|
||||
float rect_leftmost;
|
||||
@@ -1609,14 +1616,14 @@ static void ui_handle_panel_header(
|
||||
|
||||
if (button) {
|
||||
if (button == 2) { /* close */
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
else { /* collapse */
|
||||
if (ctrl) {
|
||||
panels_collapse_all(sa, ar, block->panel);
|
||||
panels_collapse_all(sa, region, block->panel);
|
||||
|
||||
/* reset the view - we don't want to display a view without content */
|
||||
UI_view2d_offset(&ar->v2d, 0.0f, 1.0f);
|
||||
UI_view2d_offset(®ion->v2d, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (block->panel->flag & PNL_CLOSED) {
|
||||
@@ -1657,42 +1664,44 @@ static void ui_handle_panel_header(
|
||||
/* FIXME: this doesn't update the panel drawing, assert to avoid debugging why this is.
|
||||
* We could fix this in the future if it's ever needed. */
|
||||
BLI_assert(0);
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
}
|
||||
else if (show_drag && BLI_rctf_isect_x(&rect_drag, mx)) {
|
||||
/* XXX, for now don't allow dragging in floating windows yet. */
|
||||
if (ar->alignment == RGN_ALIGN_FLOAT) {
|
||||
if (region->alignment == RGN_ALIGN_FLOAT) {
|
||||
return;
|
||||
}
|
||||
panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
|
||||
}
|
||||
else if (show_pin && BLI_rctf_isect_x(&rect_pin, mx)) {
|
||||
block->panel->flag ^= PNL_PIN;
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
}
|
||||
|
||||
bool UI_panel_category_is_visible(const ARegion *ar)
|
||||
bool UI_panel_category_is_visible(const ARegion *region)
|
||||
{
|
||||
/* more than one */
|
||||
return ar->panels_category.first && ar->panels_category.first != ar->panels_category.last;
|
||||
return region->panels_category.first &&
|
||||
region->panels_category.first != region->panels_category.last;
|
||||
}
|
||||
|
||||
PanelCategoryDyn *UI_panel_category_find(ARegion *ar, const char *idname)
|
||||
PanelCategoryDyn *UI_panel_category_find(ARegion *region, const char *idname)
|
||||
{
|
||||
return BLI_findstring(&ar->panels_category, idname, offsetof(PanelCategoryDyn, idname));
|
||||
return BLI_findstring(®ion->panels_category, idname, offsetof(PanelCategoryDyn, idname));
|
||||
}
|
||||
|
||||
PanelCategoryStack *UI_panel_category_active_find(ARegion *ar, const char *idname)
|
||||
PanelCategoryStack *UI_panel_category_active_find(ARegion *region, const char *idname)
|
||||
{
|
||||
return BLI_findstring(&ar->panels_category_active, idname, offsetof(PanelCategoryStack, idname));
|
||||
return BLI_findstring(
|
||||
®ion->panels_category_active, idname, offsetof(PanelCategoryStack, idname));
|
||||
}
|
||||
|
||||
static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool fallback)
|
||||
static void ui_panel_category_active_set(ARegion *region, const char *idname, bool fallback)
|
||||
{
|
||||
ListBase *lb = &ar->panels_category_active;
|
||||
PanelCategoryStack *pc_act = UI_panel_category_active_find(ar, idname);
|
||||
ListBase *lb = ®ion->panels_category_active;
|
||||
PanelCategoryStack *pc_act = UI_panel_category_active_find(region, idname);
|
||||
|
||||
if (pc_act) {
|
||||
BLI_remlink(lb, pc_act);
|
||||
@@ -1719,7 +1728,8 @@ static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool f
|
||||
pc_act_next = pc_act->next;
|
||||
while ((pc_act = pc_act_next)) {
|
||||
pc_act_next = pc_act->next;
|
||||
if (!BLI_findstring(&ar->type->paneltypes, pc_act->idname, offsetof(PanelType, category))) {
|
||||
if (!BLI_findstring(
|
||||
®ion->type->paneltypes, pc_act->idname, offsetof(PanelType, category))) {
|
||||
BLI_remlink(lb, pc_act);
|
||||
MEM_freeN(pc_act);
|
||||
}
|
||||
@@ -1727,32 +1737,32 @@ static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool f
|
||||
}
|
||||
}
|
||||
|
||||
void UI_panel_category_active_set(ARegion *ar, const char *idname)
|
||||
void UI_panel_category_active_set(ARegion *region, const char *idname)
|
||||
{
|
||||
ui_panel_category_active_set(ar, idname, false);
|
||||
ui_panel_category_active_set(region, idname, false);
|
||||
}
|
||||
|
||||
void UI_panel_category_active_set_default(ARegion *ar, const char *idname)
|
||||
void UI_panel_category_active_set_default(ARegion *region, const char *idname)
|
||||
{
|
||||
if (!UI_panel_category_active_find(ar, idname)) {
|
||||
ui_panel_category_active_set(ar, idname, true);
|
||||
if (!UI_panel_category_active_find(region, idname)) {
|
||||
ui_panel_category_active_set(region, idname, true);
|
||||
}
|
||||
}
|
||||
|
||||
const char *UI_panel_category_active_get(ARegion *ar, bool set_fallback)
|
||||
const char *UI_panel_category_active_get(ARegion *region, bool set_fallback)
|
||||
{
|
||||
PanelCategoryStack *pc_act;
|
||||
|
||||
for (pc_act = ar->panels_category_active.first; pc_act; pc_act = pc_act->next) {
|
||||
if (UI_panel_category_find(ar, pc_act->idname)) {
|
||||
for (pc_act = region->panels_category_active.first; pc_act; pc_act = pc_act->next) {
|
||||
if (UI_panel_category_find(region, pc_act->idname)) {
|
||||
return pc_act->idname;
|
||||
}
|
||||
}
|
||||
|
||||
if (set_fallback) {
|
||||
PanelCategoryDyn *pc_dyn = ar->panels_category.first;
|
||||
PanelCategoryDyn *pc_dyn = region->panels_category.first;
|
||||
if (pc_dyn) {
|
||||
ui_panel_category_active_set(ar, pc_dyn->idname, true);
|
||||
ui_panel_category_active_set(region, pc_dyn->idname, true);
|
||||
return pc_dyn->idname;
|
||||
}
|
||||
}
|
||||
@@ -1760,11 +1770,11 @@ const char *UI_panel_category_active_get(ARegion *ar, bool set_fallback)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *ar, const int x, const int y)
|
||||
PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const int x, const int y)
|
||||
{
|
||||
PanelCategoryDyn *ptd;
|
||||
|
||||
for (ptd = ar->panels_category.first; ptd; ptd = ptd->next) {
|
||||
for (ptd = region->panels_category.first; ptd; ptd = ptd->next) {
|
||||
if (BLI_rcti_isect_pt(&ptd->rect, x, y)) {
|
||||
return ptd;
|
||||
}
|
||||
@@ -1773,24 +1783,24 @@ PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *ar, const int x,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *ar, const wmEvent *event)
|
||||
PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *region, const wmEvent *event)
|
||||
{
|
||||
return UI_panel_category_find_mouse_over_ex(ar, event->mval[0], event->mval[1]);
|
||||
return UI_panel_category_find_mouse_over_ex(region, event->mval[0], event->mval[1]);
|
||||
}
|
||||
|
||||
void UI_panel_category_add(ARegion *ar, const char *name)
|
||||
void UI_panel_category_add(ARegion *region, const char *name)
|
||||
{
|
||||
PanelCategoryDyn *pc_dyn = MEM_callocN(sizeof(*pc_dyn), __func__);
|
||||
BLI_addtail(&ar->panels_category, pc_dyn);
|
||||
BLI_addtail(®ion->panels_category, pc_dyn);
|
||||
|
||||
BLI_strncpy(pc_dyn->idname, name, sizeof(pc_dyn->idname));
|
||||
|
||||
/* 'pc_dyn->rect' must be set on draw */
|
||||
}
|
||||
|
||||
void UI_panel_category_clear_all(ARegion *ar)
|
||||
void UI_panel_category_clear_all(ARegion *region)
|
||||
{
|
||||
BLI_freelistN(&ar->panels_category);
|
||||
BLI_freelistN(®ion->panels_category);
|
||||
}
|
||||
|
||||
static void imm_buf_append(
|
||||
@@ -1922,18 +1932,18 @@ static void ui_panel_category_draw_tab(bool filled,
|
||||
* Draw vertical tabs on the left side of the region,
|
||||
* one tab per category.
|
||||
*/
|
||||
void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
|
||||
void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
|
||||
{
|
||||
/* no tab outlines for */
|
||||
// #define USE_FLAT_INACTIVE
|
||||
const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment != RGN_ALIGN_RIGHT);
|
||||
View2D *v2d = &ar->v2d;
|
||||
const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(region->alignment != RGN_ALIGN_RIGHT);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
uiStyle *style = UI_style_get();
|
||||
const uiFontStyle *fstyle = &style->widget;
|
||||
const int fontid = fstyle->uifont_id;
|
||||
short fstyle_points = fstyle->points;
|
||||
PanelCategoryDyn *pc_dyn;
|
||||
const float aspect = ((uiBlock *)ar->uiblocks.first)->aspect;
|
||||
const float aspect = ((uiBlock *)region->uiblocks.first)->aspect;
|
||||
const float zoom = 1.0f / aspect;
|
||||
const int px = max_ii(1, round_fl_to_int(U.pixelsize));
|
||||
const int px_x_sign = is_left ? px : -px;
|
||||
@@ -1990,7 +2000,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
|
||||
interp_v3_v3v3_uchar(
|
||||
theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f);
|
||||
|
||||
is_alpha = (ar->overlap && (theme_col_back[3] != 255));
|
||||
is_alpha = (region->overlap && (theme_col_back[3] != 255));
|
||||
|
||||
if (fstyle->kerning == 1) {
|
||||
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
||||
@@ -2004,12 +2014,12 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
|
||||
|
||||
/* Check the region type supports categories to avoid an assert
|
||||
* for showing 3D view panels in the properties space. */
|
||||
if ((1 << ar->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) {
|
||||
BLI_assert(UI_panel_category_is_visible(ar));
|
||||
if ((1 << region->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) {
|
||||
BLI_assert(UI_panel_category_is_visible(region));
|
||||
}
|
||||
|
||||
/* calculate tab rect's and check if we need to scale down */
|
||||
for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
|
||||
for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
|
||||
rcti *rct = &pc_dyn->rect;
|
||||
const char *category_id = pc_dyn->idname;
|
||||
const char *category_id_draw = IFACE_(category_id);
|
||||
@@ -2027,7 +2037,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
|
||||
if (y_ofs > BLI_rcti_size_y(&v2d->mask)) {
|
||||
scaletabs = (float)BLI_rcti_size_y(&v2d->mask) / (float)y_ofs;
|
||||
|
||||
for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
|
||||
for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
|
||||
rcti *rct = &pc_dyn->rect;
|
||||
rct->ymin = ((rct->ymin - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax;
|
||||
rct->ymax = ((rct->ymax - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax;
|
||||
@@ -2072,7 +2082,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
|
||||
const int divider_xmax = is_left ? (v2d->mask.xmin + category_tabs_width) :
|
||||
(v2d->mask.xmax - (category_tabs_width + px)) + px;
|
||||
|
||||
for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
|
||||
for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
|
||||
const rcti *rct = &pc_dyn->rect;
|
||||
const char *category_id = pc_dyn->idname;
|
||||
const char *category_id_draw = IFACE_(category_id);
|
||||
@@ -2209,14 +2219,14 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
|
||||
}
|
||||
|
||||
static int ui_handle_panel_category_cycling(const wmEvent *event,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
const uiBut *active_but)
|
||||
{
|
||||
const bool is_mousewheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE);
|
||||
const bool inside_tabregion =
|
||||
((RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT) ?
|
||||
(event->mval[0] < ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmax) :
|
||||
(event->mval[0] > ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmin));
|
||||
((RGN_ALIGN_ENUM_FROM_MASK(region->alignment) != RGN_ALIGN_RIGHT) ?
|
||||
(event->mval[0] < ((PanelCategoryDyn *)region->panels_category.first)->rect.xmax) :
|
||||
(event->mval[0] > ((PanelCategoryDyn *)region->panels_category.first)->rect.xmin));
|
||||
|
||||
/* if mouse is inside non-tab region, ctrl key is required */
|
||||
if (is_mousewheel && !event->ctrl && !inside_tabregion) {
|
||||
@@ -2228,9 +2238,9 @@ static int ui_handle_panel_category_cycling(const wmEvent *event,
|
||||
* using ctrl+mousewheel work in tabbed regions */
|
||||
}
|
||||
else {
|
||||
const char *category = UI_panel_category_active_get(ar, false);
|
||||
const char *category = UI_panel_category_active_get(region, false);
|
||||
if (LIKELY(category)) {
|
||||
PanelCategoryDyn *pc_dyn = UI_panel_category_find(ar, category);
|
||||
PanelCategoryDyn *pc_dyn = UI_panel_category_find(region, category);
|
||||
if (LIKELY(pc_dyn)) {
|
||||
if (is_mousewheel) {
|
||||
/* we can probably get rid of this and only allow ctrl+tabbing */
|
||||
@@ -2242,15 +2252,15 @@ static int ui_handle_panel_category_cycling(const wmEvent *event,
|
||||
if (!pc_dyn) {
|
||||
/* proper cyclic behavior,
|
||||
* back to first/last category (only used for ctrl+tab) */
|
||||
pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first;
|
||||
pc_dyn = backwards ? region->panels_category.last : region->panels_category.first;
|
||||
}
|
||||
}
|
||||
|
||||
if (pc_dyn) {
|
||||
/* intentionally don't reset scroll in this case,
|
||||
* this allows for quick browsing between tabs */
|
||||
UI_panel_category_active_set(ar, pc_dyn->idname);
|
||||
ED_region_tag_redraw(ar);
|
||||
UI_panel_category_active_set(region, pc_dyn->idname);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2265,18 +2275,18 @@ static int ui_handle_panel_category_cycling(const wmEvent *event,
|
||||
|
||||
int ui_handler_panel_region(bContext *C,
|
||||
const wmEvent *event,
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
const uiBut *active_but)
|
||||
{
|
||||
uiBlock *block;
|
||||
Panel *pa;
|
||||
int retval, mx, my;
|
||||
bool has_category_tabs = UI_panel_category_is_visible(ar);
|
||||
bool has_category_tabs = UI_panel_category_is_visible(region);
|
||||
|
||||
retval = WM_UI_HANDLER_CONTINUE;
|
||||
|
||||
/* Scrollbars can overlap panels now, they have handling priority. */
|
||||
if (UI_view2d_mouse_in_scrollers(ar, &ar->v2d, event->x, event->y)) {
|
||||
if (UI_view2d_mouse_in_scrollers(region, ®ion->v2d, event->x, event->y)) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2284,13 +2294,13 @@ int ui_handler_panel_region(bContext *C,
|
||||
if (has_category_tabs) {
|
||||
if (event->val == KM_PRESS) {
|
||||
if (event->type == LEFTMOUSE) {
|
||||
PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(ar, event);
|
||||
PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(region, event);
|
||||
if (pc_dyn) {
|
||||
UI_panel_category_active_set(ar, pc_dyn->idname);
|
||||
ED_region_tag_redraw(ar);
|
||||
UI_panel_category_active_set(region, pc_dyn->idname);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
/* reset scroll to the top [#38348] */
|
||||
UI_view2d_offset(&ar->v2d, -1.0f, 1.0f);
|
||||
UI_view2d_offset(®ion->v2d, -1.0f, 1.0f);
|
||||
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
@@ -2298,7 +2308,7 @@ int ui_handler_panel_region(bContext *C,
|
||||
else if ((event->type == TABKEY && event->ctrl) ||
|
||||
ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
|
||||
/* cycle tabs */
|
||||
retval = ui_handle_panel_category_cycling(event, ar, active_but);
|
||||
retval = ui_handle_panel_category_cycling(event, region, active_but);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2307,12 +2317,12 @@ int ui_handler_panel_region(bContext *C,
|
||||
return retval;
|
||||
}
|
||||
|
||||
for (block = ar->uiblocks.last; block; block = block->prev) {
|
||||
for (block = region->uiblocks.last; block; block = block->prev) {
|
||||
uiPanelMouseState mouse_state;
|
||||
|
||||
mx = event->x;
|
||||
my = event->y;
|
||||
ui_window_to_block(ar, block, &mx, &my);
|
||||
ui_window_to_block(region, block, &mx, &my);
|
||||
|
||||
/* checks for mouse position inside */
|
||||
pa = block->panel;
|
||||
@@ -2347,7 +2357,7 @@ int ui_handler_panel_region(bContext *C,
|
||||
}
|
||||
|
||||
/* on active button, do not handle panels */
|
||||
if (ui_region_find_active_but(ar) != NULL) {
|
||||
if (ui_region_find_active_but(region) != NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2380,7 +2390,7 @@ int ui_handler_panel_region(bContext *C,
|
||||
}
|
||||
else if (event->type == RIGHTMOUSE) {
|
||||
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
|
||||
ui_popup_context_menu_for_panel(C, ar, block->panel);
|
||||
ui_popup_context_menu_for_panel(C, region, block->panel);
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
break;
|
||||
}
|
||||
@@ -2390,7 +2400,7 @@ int ui_handler_panel_region(bContext *C,
|
||||
#if 0
|
||||
if (block->handler) {
|
||||
rem_blockhandler(sa, block->handler);
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
#endif
|
||||
@@ -2423,7 +2433,7 @@ int ui_handler_panel_region(bContext *C,
|
||||
}
|
||||
CLAMP(sl->blockscale, 0.6, 1.0);
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
@@ -2448,8 +2458,8 @@ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata)
|
||||
/* verify if we can stop */
|
||||
if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
int align = panel_aligned(sa, ar);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
int align = panel_aligned(sa, region);
|
||||
|
||||
if (align) {
|
||||
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
|
||||
@@ -2493,7 +2503,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
|
||||
{
|
||||
uiHandlePanelData *data = pa->activedata;
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
if (data && data->state == state) {
|
||||
return;
|
||||
@@ -2507,8 +2517,8 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
|
||||
* is very hard to control and use, and has no real benefit." - BillRey
|
||||
* Aligorith, 2009Sep
|
||||
*/
|
||||
// test_add_new_tabs(ar); // also copies locations of tabs in dragged panel
|
||||
check_panel_overlap(ar, NULL); /* clears */
|
||||
// test_add_new_tabs(region); // also copies locations of tabs in dragged panel
|
||||
check_panel_overlap(region, NULL); /* clears */
|
||||
}
|
||||
|
||||
pa->flag &= ~PNL_SELECT;
|
||||
@@ -2552,7 +2562,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
|
||||
data->starttime = PIL_check_seconds_timer();
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
|
||||
PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname)
|
||||
|
||||
@@ -206,15 +206,15 @@ bool ui_but_contains_rect(const uiBut *but, const rctf *rect)
|
||||
return BLI_rctf_isect(&but->rect, rect, NULL);
|
||||
}
|
||||
|
||||
bool ui_but_contains_point_px(const uiBut *but, const ARegion *ar, int x, int y)
|
||||
bool ui_but_contains_point_px(const uiBut *but, const ARegion *region, int x, int y)
|
||||
{
|
||||
uiBlock *block = but->block;
|
||||
if (!ui_region_contains_point_px(ar, x, y)) {
|
||||
if (!ui_region_contains_point_px(region, x, y)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float mx = x, my = y;
|
||||
ui_window_to_block_fl(ar, block, &mx, &my);
|
||||
ui_window_to_block_fl(region, block, &mx, &my);
|
||||
|
||||
if (but->pie_dir != UI_RADIAL_NONE) {
|
||||
if (!ui_but_isect_pie_seg(block, but)) {
|
||||
@@ -228,12 +228,12 @@ bool ui_but_contains_point_px(const uiBut *but, const ARegion *ar, int x, int y)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *ar, const wmEvent *event)
|
||||
bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEvent *event)
|
||||
{
|
||||
rcti rect;
|
||||
int x = event->x, y = event->y;
|
||||
|
||||
ui_window_to_block(ar, but->block, &x, &y);
|
||||
ui_window_to_block(region, but->block, &x, &y);
|
||||
|
||||
BLI_rcti_rctf_copy(&rect, &but->rect);
|
||||
|
||||
@@ -253,16 +253,16 @@ bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *ar, const wmEvent
|
||||
}
|
||||
|
||||
/* x and y are only used in case event is NULL... */
|
||||
uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bool labeledit)
|
||||
uiBut *ui_but_find_mouse_over_ex(ARegion *region, const int x, const int y, const bool labeledit)
|
||||
{
|
||||
uiBut *butover = NULL;
|
||||
|
||||
if (!ui_region_contains_point_px(ar, x, y)) {
|
||||
if (!ui_region_contains_point_px(region, x, y)) {
|
||||
return NULL;
|
||||
}
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
float mx = x, my = y;
|
||||
ui_window_to_block_fl(ar, block, &mx, &my);
|
||||
ui_window_to_block_fl(region, block, &mx, &my);
|
||||
|
||||
for (uiBut *but = block->buttons.last; but; but = but->prev) {
|
||||
if (ui_but_is_interactive(but, labeledit)) {
|
||||
@@ -291,14 +291,14 @@ uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bo
|
||||
return butover;
|
||||
}
|
||||
|
||||
uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event)
|
||||
uiBut *ui_but_find_mouse_over(ARegion *region, const wmEvent *event)
|
||||
{
|
||||
return ui_but_find_mouse_over_ex(ar, event->x, event->y, event->ctrl != 0);
|
||||
return ui_but_find_mouse_over_ex(region, event->x, event->y, event->ctrl != 0);
|
||||
}
|
||||
|
||||
uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px)
|
||||
uiBut *ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px)
|
||||
{
|
||||
if (!ui_region_contains_rect_px(ar, rect_px)) {
|
||||
if (!ui_region_contains_rect_px(region, rect_px)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -308,9 +308,9 @@ uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px)
|
||||
BLI_rctf_rcti_copy(&rect_px_fl, rect_px);
|
||||
uiBut *butover = NULL;
|
||||
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
rctf rect_block;
|
||||
ui_window_to_block_rctf(ar, block, &rect_block, &rect_px_fl);
|
||||
ui_window_to_block_rctf(region, block, &rect_block, &rect_px_fl);
|
||||
|
||||
for (uiBut *but = block->buttons.last; but; but = but->prev) {
|
||||
if (ui_but_is_interactive(but, labeledit)) {
|
||||
@@ -334,14 +334,14 @@ uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px)
|
||||
return butover;
|
||||
}
|
||||
|
||||
uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y)
|
||||
uiBut *ui_list_find_mouse_over_ex(ARegion *region, int x, int y)
|
||||
{
|
||||
if (!ui_region_contains_point_px(ar, x, y)) {
|
||||
if (!ui_region_contains_point_px(region, x, y)) {
|
||||
return NULL;
|
||||
}
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
float mx = x, my = y;
|
||||
ui_window_to_block_fl(ar, block, &mx, &my);
|
||||
ui_window_to_block_fl(region, block, &mx, &my);
|
||||
for (uiBut *but = block->buttons.last; but; but = but->prev) {
|
||||
if (but->type == UI_BTYPE_LISTBOX && ui_but_contains_pt(but, mx, my)) {
|
||||
return but;
|
||||
@@ -352,9 +352,9 @@ uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uiBut *ui_list_find_mouse_over(ARegion *ar, const wmEvent *event)
|
||||
uiBut *ui_list_find_mouse_over(ARegion *region, const wmEvent *event)
|
||||
{
|
||||
return ui_list_find_mouse_over_ex(ar, event->x, event->y);
|
||||
return ui_list_find_mouse_over_ex(region, event->x, event->y);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -508,9 +508,9 @@ bool UI_block_can_add_separator(const uiBlock *block)
|
||||
/** \name Region (#ARegion) State
|
||||
* \{ */
|
||||
|
||||
uiBut *ui_region_find_active_but(ARegion *ar)
|
||||
uiBut *ui_region_find_active_but(ARegion *region)
|
||||
{
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
for (uiBut *but = block->buttons.first; but; but = but->next) {
|
||||
if (but->active) {
|
||||
return but;
|
||||
@@ -521,9 +521,9 @@ uiBut *ui_region_find_active_but(ARegion *ar)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uiBut *ui_region_find_first_but_test_flag(ARegion *ar, int flag_include, int flag_exclude)
|
||||
uiBut *ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude)
|
||||
{
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
for (uiBut *but = block->buttons.first; but; but = but->next) {
|
||||
if (((but->flag & flag_include) == flag_include) && ((but->flag & flag_exclude) == 0)) {
|
||||
return but;
|
||||
@@ -540,10 +540,10 @@ uiBut *ui_region_find_first_but_test_flag(ARegion *ar, int flag_include, int fla
|
||||
/** \name Region (#ARegion) Spatial
|
||||
* \{ */
|
||||
|
||||
bool ui_region_contains_point_px(const ARegion *ar, int x, int y)
|
||||
bool ui_region_contains_point_px(const ARegion *region, int x, int y)
|
||||
{
|
||||
rcti winrct;
|
||||
ui_region_winrct_get_no_margin(ar, &winrct);
|
||||
ui_region_winrct_get_no_margin(region, &winrct);
|
||||
if (!BLI_rcti_isect_pt(&winrct, x, y)) {
|
||||
return false;
|
||||
}
|
||||
@@ -553,13 +553,13 @@ bool ui_region_contains_point_px(const ARegion *ar, int x, int y)
|
||||
* even when they are not visible, so we need to make a copy of the mask to
|
||||
* use to check
|
||||
*/
|
||||
if (ar->v2d.mask.xmin != ar->v2d.mask.xmax) {
|
||||
const View2D *v2d = &ar->v2d;
|
||||
if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
|
||||
const View2D *v2d = ®ion->v2d;
|
||||
int mx = x, my = y;
|
||||
|
||||
ui_window_to_region(ar, &mx, &my);
|
||||
ui_window_to_region(region, &mx, &my);
|
||||
if (!BLI_rcti_isect_pt(&v2d->mask, mx, my) ||
|
||||
UI_view2d_mouse_in_scrollers(ar, &ar->v2d, x, y)) {
|
||||
UI_view2d_mouse_in_scrollers(region, ®ion->v2d, x, y)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -567,21 +567,21 @@ bool ui_region_contains_point_px(const ARegion *ar, int x, int y)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ui_region_contains_rect_px(const ARegion *ar, const rcti *rect_px)
|
||||
bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px)
|
||||
{
|
||||
rcti winrct;
|
||||
ui_region_winrct_get_no_margin(ar, &winrct);
|
||||
ui_region_winrct_get_no_margin(region, &winrct);
|
||||
if (!BLI_rcti_isect(&winrct, rect_px, NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* See comment in 'ui_region_contains_point_px' */
|
||||
if (ar->v2d.mask.xmin != ar->v2d.mask.xmax) {
|
||||
const View2D *v2d = &ar->v2d;
|
||||
if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
|
||||
const View2D *v2d = ®ion->v2d;
|
||||
rcti rect_region;
|
||||
ui_window_to_region_rcti(ar, &rect_region, rect_px);
|
||||
ui_window_to_region_rcti(region, &rect_region, rect_px);
|
||||
if (!BLI_rcti_isect(&v2d->mask, &rect_region, NULL) ||
|
||||
UI_view2d_rect_in_scrollers(ar, &ar->v2d, rect_px)) {
|
||||
UI_view2d_rect_in_scrollers(region, ®ion->v2d, rect_px)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -598,13 +598,13 @@ bool ui_region_contains_rect_px(const ARegion *ar, const rcti *rect_px)
|
||||
/** Check if the cursor is over any popups. */
|
||||
ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y)
|
||||
{
|
||||
for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
|
||||
for (ARegion *region = screen->regionbase.first; region; region = region->next) {
|
||||
rcti winrct;
|
||||
|
||||
ui_region_winrct_get_no_margin(ar, &winrct);
|
||||
ui_region_winrct_get_no_margin(region, &winrct);
|
||||
|
||||
if (BLI_rcti_isect_pt(&winrct, x, y)) {
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -87,12 +87,12 @@ static bool last_redo_poll(const bContext *C, short region_type)
|
||||
return success;
|
||||
}
|
||||
|
||||
static void hud_region_hide(ARegion *ar)
|
||||
static void hud_region_hide(ARegion *region)
|
||||
{
|
||||
ar->flag |= RGN_FLAG_HIDDEN;
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
/* Avoids setting 'AREA_FLAG_REGION_SIZE_UPDATE'
|
||||
* since other regions don't depend on this. */
|
||||
BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
|
||||
BLI_rcti_init(®ion->winrct, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -104,9 +104,9 @@ static void hud_region_hide(ARegion *ar)
|
||||
static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
|
||||
if (ar != NULL) {
|
||||
struct HudRegionData *hrd = ar->regiondata;
|
||||
ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
|
||||
if (region != NULL) {
|
||||
struct HudRegionData *hrd = region->regiondata;
|
||||
if (hrd != NULL) {
|
||||
return last_redo_poll(C, hrd->regionid);
|
||||
}
|
||||
@@ -156,76 +156,76 @@ static void hud_panels_register(ARegionType *art, int space_type, int region_typ
|
||||
/** \name Callbacks for Floating Region
|
||||
* \{ */
|
||||
|
||||
static void hud_region_init(wmWindowManager *wm, ARegion *ar)
|
||||
static void hud_region_init(wmWindowManager *wm, ARegion *region)
|
||||
{
|
||||
ED_region_panels_init(wm, ar);
|
||||
UI_region_handlers_add(&ar->handlers);
|
||||
ar->flag |= RGN_FLAG_TEMP_REGIONDATA;
|
||||
ED_region_panels_init(wm, region);
|
||||
UI_region_handlers_add(®ion->handlers);
|
||||
region->flag |= RGN_FLAG_TEMP_REGIONDATA;
|
||||
}
|
||||
|
||||
static void hud_region_free(ARegion *ar)
|
||||
static void hud_region_free(ARegion *region)
|
||||
{
|
||||
MEM_SAFE_FREE(ar->regiondata);
|
||||
MEM_SAFE_FREE(region->regiondata);
|
||||
}
|
||||
|
||||
static void hud_region_layout(const bContext *C, ARegion *ar)
|
||||
static void hud_region_layout(const bContext *C, ARegion *region)
|
||||
{
|
||||
struct HudRegionData *hrd = ar->regiondata;
|
||||
struct HudRegionData *hrd = region->regiondata;
|
||||
if (hrd == NULL || !last_redo_poll(C, hrd->regionid)) {
|
||||
ED_region_tag_redraw(ar);
|
||||
hud_region_hide(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
hud_region_hide(region);
|
||||
return;
|
||||
}
|
||||
|
||||
int size_y = ar->sizey;
|
||||
int size_y = region->sizey;
|
||||
|
||||
ED_region_panels_layout(C, ar);
|
||||
ED_region_panels_layout(C, region);
|
||||
|
||||
if (ar->panels.first && (ar->sizey != size_y)) {
|
||||
int winx_new = UI_DPI_FAC * (ar->sizex + 0.5f);
|
||||
int winy_new = UI_DPI_FAC * (ar->sizey + 0.5f);
|
||||
View2D *v2d = &ar->v2d;
|
||||
if (region->panels.first && (region->sizey != size_y)) {
|
||||
int winx_new = UI_DPI_FAC * (region->sizex + 0.5f);
|
||||
int winy_new = UI_DPI_FAC * (region->sizey + 0.5f);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
|
||||
if (ar->flag & RGN_FLAG_SIZE_CLAMP_X) {
|
||||
CLAMP_MAX(winx_new, ar->winx);
|
||||
if (region->flag & RGN_FLAG_SIZE_CLAMP_X) {
|
||||
CLAMP_MAX(winx_new, region->winx);
|
||||
}
|
||||
if (ar->flag & RGN_FLAG_SIZE_CLAMP_Y) {
|
||||
CLAMP_MAX(winy_new, ar->winy);
|
||||
if (region->flag & RGN_FLAG_SIZE_CLAMP_Y) {
|
||||
CLAMP_MAX(winy_new, region->winy);
|
||||
}
|
||||
|
||||
ar->winx = winx_new;
|
||||
ar->winy = winy_new;
|
||||
region->winx = winx_new;
|
||||
region->winy = winy_new;
|
||||
|
||||
ar->winrct.xmax = (ar->winrct.xmin + ar->winx) - 1;
|
||||
ar->winrct.ymax = (ar->winrct.ymin + ar->winy) - 1;
|
||||
region->winrct.xmax = (region->winrct.xmin + region->winx) - 1;
|
||||
region->winrct.ymax = (region->winrct.ymin + region->winy) - 1;
|
||||
|
||||
UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
|
||||
UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_PANELS_UI, region->winx, region->winy);
|
||||
|
||||
/* Weak, but needed to avoid glitches, especially with hi-dpi
|
||||
* (where resizing the view glitches often).
|
||||
* Fortunately this only happens occasionally. */
|
||||
ED_region_panels_layout(C, ar);
|
||||
ED_region_panels_layout(C, region);
|
||||
}
|
||||
|
||||
/* restore view matrix */
|
||||
UI_view2d_view_restore(C);
|
||||
}
|
||||
|
||||
static void hud_region_draw(const bContext *C, ARegion *ar)
|
||||
static void hud_region_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
UI_view2d_view_ortho(&ar->v2d);
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
UI_view2d_view_ortho(®ion->v2d);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
GPU_clear_color(0, 0, 0, 0.0f);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
|
||||
if ((ar->flag & RGN_FLAG_HIDDEN) == 0) {
|
||||
if ((region->flag & RGN_FLAG_HIDDEN) == 0) {
|
||||
ui_draw_menu_back(NULL,
|
||||
NULL,
|
||||
&(rcti){
|
||||
.xmax = ar->winx,
|
||||
.ymax = ar->winy,
|
||||
.xmax = region->winx,
|
||||
.ymax = region->winy,
|
||||
});
|
||||
ED_region_panels_draw(C, ar);
|
||||
ED_region_panels_draw(C, region);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,28 +252,28 @@ ARegionType *ED_area_type_hud(int space_type)
|
||||
|
||||
static ARegion *hud_region_add(ScrArea *sa)
|
||||
{
|
||||
ARegion *ar = MEM_callocN(sizeof(ARegion), "area region");
|
||||
ARegion *region = MEM_callocN(sizeof(ARegion), "area region");
|
||||
ARegion *ar_win = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
||||
if (ar_win) {
|
||||
BLI_insertlinkbefore(&sa->regionbase, ar_win, ar);
|
||||
BLI_insertlinkbefore(&sa->regionbase, ar_win, region);
|
||||
}
|
||||
else {
|
||||
BLI_addtail(&sa->regionbase, ar);
|
||||
BLI_addtail(&sa->regionbase, region);
|
||||
}
|
||||
ar->regiontype = RGN_TYPE_HUD;
|
||||
ar->alignment = RGN_ALIGN_FLOAT;
|
||||
ar->overlap = true;
|
||||
ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
|
||||
region->regiontype = RGN_TYPE_HUD;
|
||||
region->alignment = RGN_ALIGN_FLOAT;
|
||||
region->overlap = true;
|
||||
region->flag |= RGN_FLAG_DYNAMIC_SIZE;
|
||||
|
||||
if (ar_win) {
|
||||
float x, y;
|
||||
|
||||
UI_view2d_scroller_size_get(&ar_win->v2d, &x, &y);
|
||||
ar->runtime.offset_x = x;
|
||||
ar->runtime.offset_y = y;
|
||||
region->runtime.offset_x = x;
|
||||
region->runtime.offset_y = y;
|
||||
}
|
||||
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep)
|
||||
@@ -282,11 +282,11 @@ void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep)
|
||||
bScreen *screen = WM_window_get_active_screen(win);
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
if (sa != sa_keep) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->regiontype == RGN_TYPE_HUD) {
|
||||
if ((ar->flag & RGN_FLAG_HIDDEN) == 0) {
|
||||
hud_region_hide(ar);
|
||||
ED_region_tag_redraw(ar);
|
||||
for (ARegion *region = sa->regionbase.first; region; region = region->next) {
|
||||
if (region->regiontype == RGN_TYPE_HUD) {
|
||||
if ((region->flag & RGN_FLAG_HIDDEN) == 0) {
|
||||
hud_region_hide(region);
|
||||
ED_region_tag_redraw(region);
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
}
|
||||
@@ -306,49 +306,49 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
|
||||
return;
|
||||
}
|
||||
|
||||
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
|
||||
ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
|
||||
|
||||
if (ar && (ar->flag & RGN_FLAG_HIDDEN_BY_USER)) {
|
||||
if (region && (region->flag & RGN_FLAG_HIDDEN_BY_USER)) {
|
||||
/* The region is intentionally hidden by the user, don't show it. */
|
||||
hud_region_hide(ar);
|
||||
hud_region_hide(region);
|
||||
return;
|
||||
}
|
||||
|
||||
bool init = false;
|
||||
bool was_hidden = ar == NULL || ar->visible == false;
|
||||
bool was_hidden = region == NULL || region->visible == false;
|
||||
ARegion *ar_op = CTX_wm_region(C);
|
||||
BLI_assert((ar_op == NULL) || (ar_op->regiontype != RGN_TYPE_HUD));
|
||||
if (!last_redo_poll(C, ar_op ? ar_op->regiontype : -1)) {
|
||||
if (ar) {
|
||||
ED_region_tag_redraw(ar);
|
||||
hud_region_hide(ar);
|
||||
if (region) {
|
||||
ED_region_tag_redraw(region);
|
||||
hud_region_hide(region);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (ar == NULL) {
|
||||
if (region == NULL) {
|
||||
init = true;
|
||||
ar = hud_region_add(sa);
|
||||
ar->type = art;
|
||||
region = hud_region_add(sa);
|
||||
region->type = art;
|
||||
}
|
||||
|
||||
/* Let 'ED_area_update_region_sizes' do the work of placing the region.
|
||||
* Otherwise we could set the 'ar->winrct' & 'ar->winx/winy' here. */
|
||||
* Otherwise we could set the 'region->winrct' & 'region->winx/winy' here. */
|
||||
if (init) {
|
||||
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
|
||||
}
|
||||
else {
|
||||
if (ar->flag & RGN_FLAG_HIDDEN) {
|
||||
if (region->flag & RGN_FLAG_HIDDEN) {
|
||||
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
|
||||
}
|
||||
ar->flag &= ~RGN_FLAG_HIDDEN;
|
||||
region->flag &= ~RGN_FLAG_HIDDEN;
|
||||
}
|
||||
|
||||
{
|
||||
struct HudRegionData *hrd = ar->regiondata;
|
||||
struct HudRegionData *hrd = region->regiondata;
|
||||
if (hrd == NULL) {
|
||||
hrd = MEM_callocN(sizeof(*hrd), __func__);
|
||||
ar->regiondata = hrd;
|
||||
region->regiondata = hrd;
|
||||
}
|
||||
if (ar_op) {
|
||||
hrd->regionid = ar_op->regiontype;
|
||||
@@ -364,37 +364,37 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
|
||||
ED_area_update_region_sizes(wm, win, sa);
|
||||
}
|
||||
|
||||
ED_region_floating_initialize(ar);
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_floating_initialize(region);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
/* Reset zoom level (not well supported). */
|
||||
ar->v2d.cur = ar->v2d.tot = (rctf){
|
||||
.xmax = ar->winx,
|
||||
.ymax = ar->winy,
|
||||
region->v2d.cur = region->v2d.tot = (rctf){
|
||||
.xmax = region->winx,
|
||||
.ymax = region->winy,
|
||||
};
|
||||
ar->v2d.minzoom = 1.0f;
|
||||
ar->v2d.maxzoom = 1.0f;
|
||||
region->v2d.minzoom = 1.0f;
|
||||
region->v2d.maxzoom = 1.0f;
|
||||
|
||||
ar->visible = !(ar->flag & RGN_FLAG_HIDDEN);
|
||||
region->visible = !(region->flag & RGN_FLAG_HIDDEN);
|
||||
|
||||
/* We shouldn't need to do this every time :S */
|
||||
/* XXX, this is evil! - it also makes the menu show on first draw. :( */
|
||||
if (ar->visible) {
|
||||
if (region->visible) {
|
||||
ARegion *ar_prev = CTX_wm_region(C);
|
||||
CTX_wm_region_set((bContext *)C, ar);
|
||||
hud_region_layout(C, ar);
|
||||
CTX_wm_region_set((bContext *)C, region);
|
||||
hud_region_layout(C, region);
|
||||
if (was_hidden) {
|
||||
ar->winx = ar->v2d.winx;
|
||||
ar->winy = ar->v2d.winy;
|
||||
ar->v2d.cur = ar->v2d.tot = (rctf){
|
||||
.xmax = ar->winx,
|
||||
.ymax = ar->winy,
|
||||
region->winx = region->v2d.winx;
|
||||
region->winy = region->v2d.winy;
|
||||
region->v2d.cur = region->v2d.tot = (rctf){
|
||||
.xmax = region->winx,
|
||||
.ymax = region->winy,
|
||||
};
|
||||
}
|
||||
CTX_wm_region_set((bContext *)C, ar_prev);
|
||||
}
|
||||
|
||||
ar->visible = !((ar->flag & RGN_FLAG_HIDDEN) || (ar->flag & RGN_FLAG_TOO_SMALL));
|
||||
region->visible = !((region->flag & RGN_FLAG_HIDDEN) || (region->flag & RGN_FLAG_TOO_SMALL));
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -277,15 +277,15 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
|
||||
/* for a header menu we set the direction automatic */
|
||||
if (!pup->slideout && flip) {
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
if (sa && ar) {
|
||||
if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
if (sa && region) {
|
||||
if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) {
|
||||
UI_block_direction_set(block, UI_DIR_UP);
|
||||
UI_block_order_flip(block);
|
||||
}
|
||||
}
|
||||
if (ar->regiontype == RGN_TYPE_FOOTER) {
|
||||
if (region->regiontype == RGN_TYPE_FOOTER) {
|
||||
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) {
|
||||
UI_block_direction_set(block, UI_DIR_UP);
|
||||
UI_block_order_flip(block);
|
||||
@@ -669,8 +669,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
|
||||
|
||||
/* In the case we have nested popups,
|
||||
* closing one may need to redraw another, see: T48874 */
|
||||
for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
|
||||
ED_region_tag_refresh_ui(ar);
|
||||
for (ARegion *region = screen->regionbase.first; region; region = region->next) {
|
||||
ED_region_tag_refresh_ui(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -678,8 +678,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
|
||||
|
||||
bool UI_popup_block_name_exists(const bScreen *screen, const char *name)
|
||||
{
|
||||
for (const ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
|
||||
for (const uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (const ARegion *region = screen->regionbase.first; region; region = region->next) {
|
||||
for (const uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
if (STREQ(block->name, name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -172,21 +172,21 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
|
||||
|
||||
if (!slideout) {
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
if (ar && ar->panels.first) {
|
||||
if (region && region->panels.first) {
|
||||
/* For regions with panels, prefer to open to top so we can
|
||||
* see the values of the buttons below changing. */
|
||||
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
|
||||
}
|
||||
/* Prefer popover from header to be positioned into the editor. */
|
||||
else if (sa && ar) {
|
||||
if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
else if (sa && region) {
|
||||
if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
||||
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) {
|
||||
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
|
||||
}
|
||||
}
|
||||
if (ar->regiontype == RGN_TYPE_FOOTER) {
|
||||
if (region->regiontype == RGN_TYPE_FOOTER) {
|
||||
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) {
|
||||
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
|
||||
}
|
||||
|
||||
@@ -57,18 +57,18 @@
|
||||
/**
|
||||
* Translate any popup regions (so we can drag them).
|
||||
*/
|
||||
void ui_popup_translate(ARegion *ar, const int mdiff[2])
|
||||
void ui_popup_translate(ARegion *region, const int mdiff[2])
|
||||
{
|
||||
uiBlock *block;
|
||||
|
||||
BLI_rcti_translate(&ar->winrct, UNPACK2(mdiff));
|
||||
BLI_rcti_translate(®ion->winrct, UNPACK2(mdiff));
|
||||
|
||||
ED_region_update_rect(ar);
|
||||
ED_region_update_rect(region);
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
/* update blocks */
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
uiPopupBlockHandle *handle = block->handle;
|
||||
/* Make empty, will be initialized on next use, see T60608. */
|
||||
BLI_rctf_init(&handle->prev_block_rect, 0, 0, 0, 0);
|
||||
@@ -369,19 +369,19 @@ static void ui_popup_block_position(wmWindow *window,
|
||||
/** \name Menu Block Creation
|
||||
* \{ */
|
||||
|
||||
static void ui_block_region_refresh(const bContext *C, ARegion *ar)
|
||||
static void ui_block_region_refresh(const bContext *C, ARegion *region)
|
||||
{
|
||||
ScrArea *ctx_area = CTX_wm_area(C);
|
||||
ARegion *ctx_region = CTX_wm_region(C);
|
||||
uiBlock *block;
|
||||
|
||||
if (ar->do_draw & RGN_REFRESH_UI) {
|
||||
if (region->do_draw & RGN_REFRESH_UI) {
|
||||
ScrArea *handle_ctx_area;
|
||||
ARegion *handle_ctx_region;
|
||||
uiBlock *block_next;
|
||||
|
||||
ar->do_draw &= ~RGN_REFRESH_UI;
|
||||
for (block = ar->uiblocks.first; block; block = block_next) {
|
||||
region->do_draw &= ~RGN_REFRESH_UI;
|
||||
for (block = region->uiblocks.first; block; block = block_next) {
|
||||
block_next = block->next;
|
||||
uiPopupBlockHandle *handle = block->handle;
|
||||
|
||||
@@ -407,11 +407,11 @@ static void ui_block_region_refresh(const bContext *C, ARegion *ar)
|
||||
CTX_wm_region_set((bContext *)C, ctx_region);
|
||||
}
|
||||
|
||||
static void ui_block_region_draw(const bContext *C, ARegion *ar)
|
||||
static void ui_block_region_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
uiBlock *block;
|
||||
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
UI_block_draw(C, block);
|
||||
}
|
||||
}
|
||||
@@ -421,7 +421,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
|
||||
*/
|
||||
static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win),
|
||||
ScrArea *UNUSED(sa),
|
||||
ARegion *ar,
|
||||
ARegion *region,
|
||||
wmNotifier *wmn,
|
||||
const Scene *UNUSED(scene))
|
||||
{
|
||||
@@ -430,7 +430,7 @@ static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win),
|
||||
switch (wmn->action) {
|
||||
case NA_EDITED: {
|
||||
/* window resize */
|
||||
ED_region_tag_refresh_ui(ar);
|
||||
ED_region_tag_refresh_ui(region);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -573,13 +573,13 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
{
|
||||
const int margin = UI_POPUP_MARGIN;
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
ARegion *ar = handle->region;
|
||||
ARegion *region = handle->region;
|
||||
|
||||
uiBlockCreateFunc create_func = handle->popup_create_vars.create_func;
|
||||
uiBlockHandleCreateFunc handle_create_func = handle->popup_create_vars.handle_create_func;
|
||||
void *arg = handle->popup_create_vars.arg;
|
||||
|
||||
uiBlock *block_old = ar->uiblocks.first;
|
||||
uiBlock *block_old = region->uiblocks.first;
|
||||
uiBlock *block;
|
||||
|
||||
handle->refresh = (block_old != NULL);
|
||||
@@ -592,7 +592,7 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
|
||||
/* create ui block */
|
||||
if (create_func) {
|
||||
block = create_func(C, ar, arg);
|
||||
block = create_func(C, region, arg);
|
||||
}
|
||||
else {
|
||||
block = handle_create_func(C, handle, arg);
|
||||
@@ -615,7 +615,7 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
block->handle = handle;
|
||||
}
|
||||
|
||||
ar->regiondata = handle;
|
||||
region->regiondata = handle;
|
||||
|
||||
/* set UI_BLOCK_NUMSELECT before UI_block_end() so we get alphanumeric keys assigned */
|
||||
if (but == NULL) {
|
||||
@@ -689,10 +689,10 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
ar->winrct.xmin = 0;
|
||||
ar->winrct.xmax = winx;
|
||||
ar->winrct.ymin = 0;
|
||||
ar->winrct.ymax = winy;
|
||||
region->winrct.xmin = 0;
|
||||
region->winrct.xmax = winx;
|
||||
region->winrct.ymin = 0;
|
||||
region->winrct.ymax = winy;
|
||||
|
||||
ui_block_calc_pie_segment(block, block->pie_data.pie_center_init);
|
||||
|
||||
@@ -733,12 +733,12 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
/* the block and buttons were positioned in window space as in 2.4x, now
|
||||
* these menu blocks are regions so we bring it back to region space.
|
||||
* additionally we add some padding for the menu shadow or rounded menus */
|
||||
ar->winrct.xmin = block->rect.xmin - margin;
|
||||
ar->winrct.xmax = block->rect.xmax + margin;
|
||||
ar->winrct.ymin = block->rect.ymin - margin;
|
||||
ar->winrct.ymax = block->rect.ymax + UI_POPUP_MENU_TOP;
|
||||
region->winrct.xmin = block->rect.xmin - margin;
|
||||
region->winrct.xmax = block->rect.xmax + margin;
|
||||
region->winrct.ymin = block->rect.ymin - margin;
|
||||
region->winrct.ymax = block->rect.ymax + UI_POPUP_MENU_TOP;
|
||||
|
||||
UI_block_translate(block, -ar->winrct.xmin, -ar->winrct.ymin);
|
||||
UI_block_translate(block, -region->winrct.xmin, -region->winrct.ymin);
|
||||
|
||||
/* apply scroll offset */
|
||||
if (handle->scrolloffset != 0.0f) {
|
||||
@@ -752,22 +752,22 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
||||
if (block_old) {
|
||||
block->oldblock = block_old;
|
||||
UI_block_update_from_old(C, block);
|
||||
UI_blocklist_free_inactive(C, &ar->uiblocks);
|
||||
UI_blocklist_free_inactive(C, ®ion->uiblocks);
|
||||
}
|
||||
|
||||
/* checks which buttons are visible, sets flags to prevent draw (do after region init) */
|
||||
ui_popup_block_scrolltest(block);
|
||||
|
||||
/* adds subwindow */
|
||||
ED_region_floating_initialize(ar);
|
||||
ED_region_floating_initialize(region);
|
||||
|
||||
/* get winmat now that we actually have the subwindow */
|
||||
wmGetProjectionMatrix(block->winmat, &ar->winrct);
|
||||
wmGetProjectionMatrix(block->winmat, ®ion->winrct);
|
||||
|
||||
/* notify change and redraw */
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
ED_region_update_rect(ar);
|
||||
ED_region_update_rect(region);
|
||||
|
||||
#ifdef DEBUG
|
||||
window->eventstate = event_back;
|
||||
@@ -787,7 +787,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C,
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
uiBut *activebut = UI_context_active_but_get(C);
|
||||
static ARegionType type;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
uiBlock *block;
|
||||
uiPopupBlockHandle *handle;
|
||||
|
||||
@@ -818,16 +818,16 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C,
|
||||
handle->can_refresh = false;
|
||||
|
||||
/* create area region */
|
||||
ar = ui_region_temp_add(CTX_wm_screen(C));
|
||||
handle->region = ar;
|
||||
region = ui_region_temp_add(CTX_wm_screen(C));
|
||||
handle->region = region;
|
||||
|
||||
memset(&type, 0, sizeof(ARegionType));
|
||||
type.draw = ui_block_region_draw;
|
||||
type.layout = ui_block_region_refresh;
|
||||
type.regionid = RGN_TYPE_TEMPORARY;
|
||||
ar->type = &type;
|
||||
region->type = &type;
|
||||
|
||||
UI_region_handlers_add(&ar->handlers);
|
||||
UI_region_handlers_add(®ion->handlers);
|
||||
|
||||
block = ui_popup_block_refresh(C, handle, butregion, but);
|
||||
handle = block->handle;
|
||||
@@ -844,9 +844,9 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
|
||||
{
|
||||
/* If this popup is created from a popover which does NOT have keep-open flag set,
|
||||
* then close the popover too. We could extend this to other popup types too. */
|
||||
ARegion *ar = handle->popup_create_vars.butregion;
|
||||
if (ar != NULL) {
|
||||
for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
|
||||
ARegion *region = handle->popup_create_vars.butregion;
|
||||
if (region != NULL) {
|
||||
for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
|
||||
if (block->handle && (block->flag & UI_BLOCK_POPOVER) &&
|
||||
(block->flag & UI_BLOCK_KEEP_OPEN) == 0) {
|
||||
uiPopupBlockHandle *menu = block->handle;
|
||||
|
||||
@@ -161,10 +161,10 @@ int UI_search_items_find_index(uiSearchItems *items, const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ar is the search box itself */
|
||||
static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
|
||||
/* region is the search box itself */
|
||||
static void ui_searchbox_select(bContext *C, ARegion *region, uiBut *but, int step)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
|
||||
/* apply step */
|
||||
data->active += step;
|
||||
@@ -176,7 +176,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
|
||||
if (data->items.more) {
|
||||
data->items.offset++;
|
||||
data->active = data->items.totitem - 1;
|
||||
ui_searchbox_update(C, ar, but, false);
|
||||
ui_searchbox_update(C, region, but, false);
|
||||
}
|
||||
else {
|
||||
data->active = data->items.totitem - 1;
|
||||
@@ -186,7 +186,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
|
||||
if (data->items.offset) {
|
||||
data->items.offset--;
|
||||
data->active = 0;
|
||||
ui_searchbox_update(C, ar, but, false);
|
||||
ui_searchbox_update(C, region, but, false);
|
||||
}
|
||||
else {
|
||||
/* only let users step into an 'unset' state for unlink buttons */
|
||||
@@ -194,7 +194,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
|
||||
}
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
|
||||
static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr)
|
||||
@@ -229,24 +229,24 @@ static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr
|
||||
}
|
||||
}
|
||||
|
||||
int ui_searchbox_find_index(ARegion *ar, const char *name)
|
||||
int ui_searchbox_find_index(ARegion *region, const char *name)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
return UI_search_items_find_index(&data->items, name);
|
||||
}
|
||||
|
||||
/* x and y in screencoords */
|
||||
bool ui_searchbox_inside(ARegion *ar, int x, int y)
|
||||
bool ui_searchbox_inside(ARegion *region, int x, int y)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
|
||||
return BLI_rcti_isect_pt(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin);
|
||||
return BLI_rcti_isect_pt(&data->bbox, x - region->winrct.xmin, y - region->winrct.ymin);
|
||||
}
|
||||
|
||||
/* string validated to be of correct length (but->hardmax) */
|
||||
bool ui_searchbox_apply(uiBut *but, ARegion *ar)
|
||||
bool ui_searchbox_apply(uiBut *but, ARegion *region)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
|
||||
but->func_arg2 = NULL;
|
||||
|
||||
@@ -272,9 +272,9 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
|
||||
}
|
||||
}
|
||||
|
||||
void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *event)
|
||||
void ui_searchbox_event(bContext *C, ARegion *region, uiBut *but, const wmEvent *event)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
int type = event->type, val = event->val;
|
||||
|
||||
if (type == MOUSEPAN) {
|
||||
@@ -284,23 +284,24 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *eve
|
||||
switch (type) {
|
||||
case WHEELUPMOUSE:
|
||||
case UPARROWKEY:
|
||||
ui_searchbox_select(C, ar, but, -1);
|
||||
ui_searchbox_select(C, region, but, -1);
|
||||
break;
|
||||
case WHEELDOWNMOUSE:
|
||||
case DOWNARROWKEY:
|
||||
ui_searchbox_select(C, ar, but, 1);
|
||||
ui_searchbox_select(C, region, but, 1);
|
||||
break;
|
||||
case MOUSEMOVE:
|
||||
if (BLI_rcti_isect_pt(&ar->winrct, event->x, event->y)) {
|
||||
if (BLI_rcti_isect_pt(®ion->winrct, event->x, event->y)) {
|
||||
rcti rect;
|
||||
int a;
|
||||
|
||||
for (a = 0; a < data->items.totitem; a++) {
|
||||
ui_searchbox_butrect(&rect, data, a);
|
||||
if (BLI_rcti_isect_pt(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
|
||||
if (BLI_rcti_isect_pt(
|
||||
&rect, event->x - region->winrct.xmin, event->y - region->winrct.ymin)) {
|
||||
if (data->active != a) {
|
||||
data->active = a;
|
||||
ui_searchbox_select(C, ar, but, 0);
|
||||
ui_searchbox_select(C, region, but, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -310,10 +311,10 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *eve
|
||||
}
|
||||
}
|
||||
|
||||
/* ar is the search box itself */
|
||||
void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
|
||||
/* region is the search box itself */
|
||||
void ui_searchbox_update(bContext *C, ARegion *region, uiBut *but, const bool reset)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
|
||||
/* reset vars */
|
||||
data->items.totitem = 0;
|
||||
@@ -379,14 +380,14 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
|
||||
}
|
||||
|
||||
/* validate selected item */
|
||||
ui_searchbox_select(C, ar, but, 0);
|
||||
ui_searchbox_select(C, region, but, 0);
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
|
||||
int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
|
||||
int ui_searchbox_autocomplete(bContext *C, ARegion *region, uiBut *but, char *str)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
int match = AUTOCOMPLETE_NO_MATCH;
|
||||
|
||||
if (str[0]) {
|
||||
@@ -401,12 +402,12 @@ int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
|
||||
return match;
|
||||
}
|
||||
|
||||
static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
|
||||
static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *region)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
|
||||
/* pixel space */
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
|
||||
if (data->noback == false) {
|
||||
ui_draw_widget_menu_back(&data->bbox, true);
|
||||
@@ -477,9 +478,9 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_searchbox_region_free_cb(ARegion *ar)
|
||||
static void ui_searchbox_region_free_cb(ARegion *region)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
int a;
|
||||
|
||||
/* free search data */
|
||||
@@ -491,7 +492,7 @@ static void ui_searchbox_region_free_cb(ARegion *ar)
|
||||
MEM_freeN(data->items.icons);
|
||||
|
||||
MEM_freeN(data);
|
||||
ar->regiondata = NULL;
|
||||
region->regiondata = NULL;
|
||||
}
|
||||
|
||||
ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but)
|
||||
@@ -499,7 +500,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
uiStyle *style = UI_style_get();
|
||||
static ARegionType type;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
uiSearchboxData *data;
|
||||
float aspect = but->block->aspect;
|
||||
rctf rect_fl;
|
||||
@@ -509,13 +510,13 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
|
||||
int i;
|
||||
|
||||
/* create area region */
|
||||
ar = ui_region_temp_add(CTX_wm_screen(C));
|
||||
region = ui_region_temp_add(CTX_wm_screen(C));
|
||||
|
||||
memset(&type, 0, sizeof(ARegionType));
|
||||
type.draw = ui_searchbox_region_draw_cb;
|
||||
type.free = ui_searchbox_region_free_cb;
|
||||
type.regionid = RGN_TYPE_TEMPORARY;
|
||||
ar->type = &type;
|
||||
region->type = &type;
|
||||
|
||||
/* create searchbox data */
|
||||
data = MEM_callocN(sizeof(uiSearchboxData), "uiSearchboxData");
|
||||
@@ -525,7 +526,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
|
||||
ui_fontscale(&data->fstyle.points, aspect);
|
||||
UI_fontstyle_set(&data->fstyle);
|
||||
|
||||
ar->regiondata = data;
|
||||
region->regiondata = data;
|
||||
|
||||
/* special case, hardcoded feature, not draw backdrop when called from menus,
|
||||
* assume for design that popup already added it */
|
||||
@@ -553,13 +554,13 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
|
||||
/* this case is search menu inside other menu */
|
||||
/* we copy region size */
|
||||
|
||||
ar->winrct = butregion->winrct;
|
||||
region->winrct = butregion->winrct;
|
||||
|
||||
/* widget rect, in region coords */
|
||||
data->bbox.xmin = margin;
|
||||
data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - margin;
|
||||
data->bbox.xmax = BLI_rcti_size_x(®ion->winrct) - margin;
|
||||
data->bbox.ymin = margin;
|
||||
data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - margin;
|
||||
data->bbox.ymax = BLI_rcti_size_y(®ion->winrct) - margin;
|
||||
|
||||
/* check if button is lower half */
|
||||
if (but->rect.ymax < BLI_rctf_cent_y(&but->block->rect)) {
|
||||
@@ -632,17 +633,17 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
|
||||
data->bbox.ymax = BLI_rcti_size_y(&rect_i) + margin;
|
||||
|
||||
/* region bigger for shadow */
|
||||
ar->winrct.xmin = rect_i.xmin - margin;
|
||||
ar->winrct.xmax = rect_i.xmax + margin;
|
||||
ar->winrct.ymin = rect_i.ymin - margin;
|
||||
ar->winrct.ymax = rect_i.ymax;
|
||||
region->winrct.xmin = rect_i.xmin - margin;
|
||||
region->winrct.xmax = rect_i.xmax + margin;
|
||||
region->winrct.ymin = rect_i.ymin - margin;
|
||||
region->winrct.ymax = rect_i.ymax;
|
||||
}
|
||||
|
||||
/* adds subwindow */
|
||||
ED_region_floating_initialize(ar);
|
||||
ED_region_floating_initialize(region);
|
||||
|
||||
/* notify change and redraw */
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
/* prepare search data */
|
||||
if (data->preview) {
|
||||
@@ -660,7 +661,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
|
||||
data->items.names[i] = MEM_callocN(but->hardmax + 1, "search pointers");
|
||||
}
|
||||
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -688,12 +689,12 @@ static void str_tolower_titlecaps_ascii(char *str, const size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARegion *ar)
|
||||
static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARegion *region)
|
||||
{
|
||||
uiSearchboxData *data = ar->regiondata;
|
||||
uiSearchboxData *data = region->regiondata;
|
||||
|
||||
/* pixel space */
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
|
||||
if (data->noback == false) {
|
||||
ui_draw_widget_menu_back(&data->bbox, true);
|
||||
@@ -764,19 +765,19 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe
|
||||
|
||||
ARegion *ui_searchbox_create_operator(bContext *C, ARegion *butregion, uiBut *but)
|
||||
{
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
UI_but_drawflag_enable(but, UI_BUT_HAS_SHORTCUT);
|
||||
ar = ui_searchbox_create_generic(C, butregion, but);
|
||||
region = ui_searchbox_create_generic(C, butregion, but);
|
||||
|
||||
ar->type->draw = ui_searchbox_region_draw_cb__operator;
|
||||
region->type->draw = ui_searchbox_region_draw_cb__operator;
|
||||
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
void ui_searchbox_free(bContext *C, ARegion *ar)
|
||||
void ui_searchbox_free(bContext *C, ARegion *region)
|
||||
{
|
||||
ui_region_temp_remove(C, CTX_wm_screen(C), ar);
|
||||
ui_region_temp_remove(C, CTX_wm_screen(C), region);
|
||||
}
|
||||
|
||||
/* sets red alert if button holds a string it can't find */
|
||||
|
||||
@@ -148,10 +148,10 @@ static void rgb_tint(float col[3], float h, float h_strength, float v, float v_s
|
||||
hsv_to_rgb_v(col_hsv_to, col);
|
||||
}
|
||||
|
||||
static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
|
||||
static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region)
|
||||
{
|
||||
const float pad_px = UI_TIP_PADDING;
|
||||
uiTooltipData *data = ar->regiondata;
|
||||
uiTooltipData *data = region->regiondata;
|
||||
const uiWidgetColors *theme = ui_tooltip_get_theme();
|
||||
rcti bbox = data->bbox;
|
||||
float tip_colors[UI_TIP_LC_MAX][3];
|
||||
@@ -168,7 +168,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
|
||||
float tone_bg;
|
||||
int i;
|
||||
|
||||
wmOrtho2_region_pixelspace(ar);
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
|
||||
/* draw background */
|
||||
ui_draw_tooltip_background(UI_style_get(), NULL, &bbox);
|
||||
@@ -271,11 +271,11 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
|
||||
BLF_disable(blf_mono_font, BLF_WORD_WRAP);
|
||||
}
|
||||
|
||||
static void ui_tooltip_region_free_cb(ARegion *ar)
|
||||
static void ui_tooltip_region_free_cb(ARegion *region)
|
||||
{
|
||||
uiTooltipData *data;
|
||||
|
||||
data = ar->regiondata;
|
||||
data = region->regiondata;
|
||||
|
||||
for (int i = 0; i < data->fields_len; i++) {
|
||||
const uiTooltipField *field = &data->fields[i];
|
||||
@@ -286,7 +286,7 @@ static void ui_tooltip_region_free_cb(ARegion *ar)
|
||||
}
|
||||
MEM_freeN(data->fields);
|
||||
MEM_freeN(data);
|
||||
ar->regiondata = NULL;
|
||||
region->regiondata = NULL;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -1160,20 +1160,20 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
|
||||
const int winy = WM_window_pixels_y(win);
|
||||
uiStyle *style = UI_style_get();
|
||||
static ARegionType type;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
int fonth, fontw;
|
||||
int h, i;
|
||||
rcti rect_i;
|
||||
int font_flag = 0;
|
||||
|
||||
/* create area region */
|
||||
ar = ui_region_temp_add(CTX_wm_screen(C));
|
||||
region = ui_region_temp_add(CTX_wm_screen(C));
|
||||
|
||||
memset(&type, 0, sizeof(ARegionType));
|
||||
type.draw = ui_tooltip_region_draw_cb;
|
||||
type.free = ui_tooltip_region_free_cb;
|
||||
type.regionid = RGN_TYPE_TEMPORARY;
|
||||
ar->type = &type;
|
||||
region->type = &type;
|
||||
|
||||
/* set font, get bb */
|
||||
data->fstyle = style->widget; /* copy struct */
|
||||
@@ -1237,7 +1237,7 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
|
||||
BLF_disable(data->fstyle.uifont_id, font_flag);
|
||||
BLF_disable(blf_mono_font, font_flag);
|
||||
|
||||
ar->regiondata = data;
|
||||
region->regiondata = data;
|
||||
|
||||
data->toth = fonth;
|
||||
data->lineh = h;
|
||||
@@ -1384,19 +1384,19 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
|
||||
data->bbox.ymax = BLI_rcti_size_y(&rect_i);
|
||||
|
||||
/* region bigger for shadow */
|
||||
ar->winrct.xmin = rect_i.xmin - margin;
|
||||
ar->winrct.xmax = rect_i.xmax + margin;
|
||||
ar->winrct.ymin = rect_i.ymin - margin;
|
||||
ar->winrct.ymax = rect_i.ymax + margin;
|
||||
region->winrct.xmin = rect_i.xmin - margin;
|
||||
region->winrct.xmax = rect_i.xmax + margin;
|
||||
region->winrct.ymin = rect_i.ymin - margin;
|
||||
region->winrct.ymax = rect_i.ymax + margin;
|
||||
}
|
||||
|
||||
/* adds subwindow */
|
||||
ED_region_floating_initialize(ar);
|
||||
ED_region_floating_initialize(region);
|
||||
|
||||
/* notify change and redraw */
|
||||
ED_region_tag_redraw(ar);
|
||||
ED_region_tag_redraw(region);
|
||||
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -1457,10 +1457,10 @@ ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *b
|
||||
}
|
||||
}
|
||||
|
||||
ARegion *ar = ui_tooltip_create_with_data(
|
||||
ARegion *region = ui_tooltip_create_with_data(
|
||||
C, data, init_position, is_no_overlap ? &init_rect : NULL, aspect);
|
||||
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
|
||||
@@ -1480,9 +1480,9 @@ ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
|
||||
return ui_tooltip_create_with_data(C, data, init_position, NULL, aspect);
|
||||
}
|
||||
|
||||
void UI_tooltip_free(bContext *C, bScreen *sc, ARegion *ar)
|
||||
void UI_tooltip_free(bContext *C, bScreen *sc, ARegion *region)
|
||||
{
|
||||
ui_region_temp_remove(C, sc, ar);
|
||||
ui_region_temp_remove(C, sc, region);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -41,28 +41,28 @@
|
||||
|
||||
ARegion *ui_region_temp_add(bScreen *sc)
|
||||
{
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
ar = MEM_callocN(sizeof(ARegion), "area region");
|
||||
BLI_addtail(&sc->regionbase, ar);
|
||||
region = MEM_callocN(sizeof(ARegion), "area region");
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
|
||||
ar->regiontype = RGN_TYPE_TEMPORARY;
|
||||
ar->alignment = RGN_ALIGN_FLOAT;
|
||||
region->regiontype = RGN_TYPE_TEMPORARY;
|
||||
region->alignment = RGN_ALIGN_FLOAT;
|
||||
|
||||
return ar;
|
||||
return region;
|
||||
}
|
||||
|
||||
void ui_region_temp_remove(bContext *C, bScreen *sc, ARegion *ar)
|
||||
void ui_region_temp_remove(bContext *C, bScreen *sc, ARegion *region)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
BLI_assert(ar->regiontype == RGN_TYPE_TEMPORARY);
|
||||
BLI_assert(BLI_findindex(&sc->regionbase, ar) != -1);
|
||||
BLI_assert(region->regiontype == RGN_TYPE_TEMPORARY);
|
||||
BLI_assert(BLI_findindex(&sc->regionbase, region) != -1);
|
||||
if (win) {
|
||||
wm_draw_region_clear(win, ar);
|
||||
wm_draw_region_clear(win, region);
|
||||
}
|
||||
|
||||
ED_region_exit(C, ar);
|
||||
BKE_area_region_free(NULL, ar); /* NULL: no spacetype */
|
||||
BLI_freelinkN(&sc->regionbase, ar);
|
||||
ED_region_exit(C, region);
|
||||
BKE_area_region_free(NULL, region); /* NULL: no spacetype */
|
||||
BLI_freelinkN(&sc->regionbase, region);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ uint ui_popup_menu_hash(const char *str);
|
||||
|
||||
/* interface_regions_intern.h */
|
||||
ARegion *ui_region_temp_add(bScreen *sc);
|
||||
void ui_region_temp_remove(struct bContext *C, bScreen *sc, ARegion *ar);
|
||||
void ui_region_temp_remove(struct bContext *C, bScreen *sc, ARegion *region);
|
||||
|
||||
#endif /* __INTERFACE_REGIONS_INTERN_H__ */
|
||||
|
||||
@@ -444,7 +444,7 @@ static void id_search_cb_objects_from_scene(const bContext *C,
|
||||
}
|
||||
|
||||
/* ID Search browse menu, open */
|
||||
static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
|
||||
static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem)
|
||||
{
|
||||
static TemplateID template_ui;
|
||||
PointerRNA active_item_ptr;
|
||||
@@ -464,7 +464,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
|
||||
}
|
||||
|
||||
return template_common_search_menu(C,
|
||||
ar,
|
||||
region,
|
||||
id_search_cb_p,
|
||||
&template_ui,
|
||||
template_ID_set_property_cb,
|
||||
@@ -2723,7 +2723,7 @@ void uiTemplatePreview(uiLayout *layout,
|
||||
uiLayout *row, *col;
|
||||
uiBlock *block;
|
||||
uiPreview *ui_preview = NULL;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
|
||||
Material *ma = NULL;
|
||||
Tex *tex = (Tex *)id;
|
||||
@@ -2774,14 +2774,14 @@ void uiTemplatePreview(uiLayout *layout,
|
||||
}
|
||||
|
||||
/* Find or add the uiPreview to the current Region. */
|
||||
ar = CTX_wm_region(C);
|
||||
ui_preview = BLI_findstring(&ar->ui_previews, preview_id, offsetof(uiPreview, preview_id));
|
||||
region = CTX_wm_region(C);
|
||||
ui_preview = BLI_findstring(®ion->ui_previews, preview_id, offsetof(uiPreview, preview_id));
|
||||
|
||||
if (!ui_preview) {
|
||||
ui_preview = MEM_callocN(sizeof(uiPreview), "uiPreview");
|
||||
BLI_strncpy(ui_preview->preview_id, preview_id, sizeof(ui_preview->preview_id));
|
||||
ui_preview->height = (short)(UI_UNIT_Y * 7.6f);
|
||||
BLI_addtail(&ar->ui_previews, ui_preview);
|
||||
BLI_addtail(®ion->ui_previews, ui_preview);
|
||||
}
|
||||
|
||||
if (ui_preview->height < UI_UNIT_Y) {
|
||||
@@ -3047,14 +3047,14 @@ static void colorband_tools_dofunc(bContext *C, void *coba_v, int event)
|
||||
ED_region_tag_redraw(CTX_wm_region(C));
|
||||
}
|
||||
|
||||
static uiBlock *colorband_tools_func(bContext *C, ARegion *ar, void *coba_v)
|
||||
static uiBlock *colorband_tools_func(bContext *C, ARegion *region, void *coba_v)
|
||||
{
|
||||
uiStyle *style = UI_style_get_dpi();
|
||||
ColorBand *coba = coba_v;
|
||||
uiBlock *block;
|
||||
short yco = 0, menuwidth = 10 * UI_UNIT_X;
|
||||
|
||||
block = UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN);
|
||||
block = UI_block_begin(C, region, __func__, UI_EMBOSS_PULLDOWN);
|
||||
UI_block_func_butmenu_set(block, colorband_tools_dofunc, coba);
|
||||
|
||||
uiLayout *layout = UI_block_layout(block,
|
||||
@@ -3443,7 +3443,7 @@ typedef struct IconViewMenuArgs {
|
||||
} IconViewMenuArgs;
|
||||
|
||||
/* ID Search browse menu, open */
|
||||
static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem)
|
||||
static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_litem)
|
||||
{
|
||||
static IconViewMenuArgs args;
|
||||
uiBlock *block;
|
||||
@@ -3459,7 +3459,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem)
|
||||
w = UI_UNIT_X * (args.icon_scale);
|
||||
h = UI_UNIT_X * (args.icon_scale + args.show_labels);
|
||||
|
||||
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS_PULLDOWN);
|
||||
block = UI_block_begin(C, region, "_popup", UI_EMBOSS_PULLDOWN);
|
||||
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NO_FLIP);
|
||||
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
|
||||
|
||||
@@ -3867,14 +3867,14 @@ static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v)
|
||||
}
|
||||
|
||||
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
|
||||
static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
|
||||
static uiBlock *curvemap_clipping_func(bContext *C, ARegion *region, void *cumap_v)
|
||||
{
|
||||
CurveMapping *cumap = cumap_v;
|
||||
uiBlock *block;
|
||||
uiBut *bt;
|
||||
float width = 8 * UI_UNIT_X;
|
||||
|
||||
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
||||
block = UI_block_begin(C, region, __func__, UI_EMBOSS);
|
||||
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT);
|
||||
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
|
||||
|
||||
@@ -4015,12 +4015,12 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
|
||||
}
|
||||
|
||||
static uiBlock *curvemap_tools_func(
|
||||
bContext *C, ARegion *ar, CurveMapping *cumap, bool show_extend, int reset_mode)
|
||||
bContext *C, ARegion *region, CurveMapping *cumap, bool show_extend, int reset_mode)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco = 0, menuwidth = 10 * UI_UNIT_X;
|
||||
|
||||
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
||||
block = UI_block_begin(C, region, __func__, UI_EMBOSS);
|
||||
UI_block_func_butmenu_set(block, curvemap_tools_dofunc, cumap);
|
||||
|
||||
{
|
||||
@@ -4143,24 +4143,24 @@ static uiBlock *curvemap_tools_func(
|
||||
return block;
|
||||
}
|
||||
|
||||
static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *ar, void *cumap_v)
|
||||
static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *region, void *cumap_v)
|
||||
{
|
||||
return curvemap_tools_func(C, ar, cumap_v, true, UICURVE_FUNC_RESET_POS);
|
||||
return curvemap_tools_func(C, region, cumap_v, true, UICURVE_FUNC_RESET_POS);
|
||||
}
|
||||
|
||||
static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *ar, void *cumap_v)
|
||||
static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *region, void *cumap_v)
|
||||
{
|
||||
return curvemap_tools_func(C, ar, cumap_v, true, UICURVE_FUNC_RESET_NEG);
|
||||
return curvemap_tools_func(C, region, cumap_v, true, UICURVE_FUNC_RESET_NEG);
|
||||
}
|
||||
|
||||
static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_v)
|
||||
static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *region, void *cumap_v)
|
||||
{
|
||||
return curvemap_tools_func(C, ar, cumap_v, false, UICURVE_FUNC_RESET_NEG);
|
||||
return curvemap_tools_func(C, region, cumap_v, false, UICURVE_FUNC_RESET_NEG);
|
||||
}
|
||||
|
||||
static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *ar, void *cumap_v)
|
||||
static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *region, void *cumap_v)
|
||||
{
|
||||
return curvemap_tools_func(C, ar, cumap_v, false, UICURVE_FUNC_RESET_POS);
|
||||
return curvemap_tools_func(C, region, cumap_v, false, UICURVE_FUNC_RESET_POS);
|
||||
}
|
||||
|
||||
static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
|
||||
@@ -4563,14 +4563,14 @@ static void CurveProfile_presets_dofunc(bContext *C, void *profile_v, int event)
|
||||
ED_region_tag_redraw(CTX_wm_region(C));
|
||||
}
|
||||
|
||||
static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *ar, CurveProfile *profile)
|
||||
static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *region, CurveProfile *profile)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco = 0;
|
||||
short menuwidth = 12 * UI_UNIT_X;
|
||||
menuwidth = 0;
|
||||
|
||||
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
||||
block = UI_block_begin(C, region, __func__, UI_EMBOSS);
|
||||
UI_block_func_butmenu_set(block, CurveProfile_presets_dofunc, profile);
|
||||
|
||||
uiDefIconTextBut(block,
|
||||
@@ -4655,9 +4655,9 @@ static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *ar, CurveProfile
|
||||
return block;
|
||||
}
|
||||
|
||||
static uiBlock *CurveProfile_buttons_presets(bContext *C, ARegion *ar, void *profile_v)
|
||||
static uiBlock *CurveProfile_buttons_presets(bContext *C, ARegion *region, void *profile_v)
|
||||
{
|
||||
return CurveProfile_presets_func(C, ar, (CurveProfile *)profile_v);
|
||||
return CurveProfile_presets_func(C, region, (CurveProfile *)profile_v);
|
||||
}
|
||||
|
||||
/* Only for CurveProfile tools block */
|
||||
@@ -4683,13 +4683,13 @@ static void CurveProfile_tools_dofunc(bContext *C, void *profile_v, int event)
|
||||
ED_region_tag_redraw(CTX_wm_region(C));
|
||||
}
|
||||
|
||||
static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *ar, CurveProfile *profile)
|
||||
static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *region, CurveProfile *profile)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco = 0;
|
||||
short menuwidth = 10 * UI_UNIT_X;
|
||||
|
||||
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
||||
block = UI_block_begin(C, region, __func__, UI_EMBOSS);
|
||||
UI_block_func_butmenu_set(block, CurveProfile_tools_dofunc, profile);
|
||||
|
||||
uiDefIconTextBut(block,
|
||||
@@ -4729,9 +4729,9 @@ static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *ar, CurveProfile *
|
||||
return block;
|
||||
}
|
||||
|
||||
static uiBlock *CurveProfile_buttons_tools(bContext *C, ARegion *ar, void *profile_v)
|
||||
static uiBlock *CurveProfile_buttons_tools(bContext *C, ARegion *region, void *profile_v)
|
||||
{
|
||||
return CurveProfile_tools_func(C, ar, (CurveProfile *)profile_v);
|
||||
return CurveProfile_tools_func(C, region, (CurveProfile *)profile_v);
|
||||
}
|
||||
|
||||
static void CurveProfile_buttons_zoom_in(bContext *C, void *profile_v, void *UNUSED(arg))
|
||||
@@ -5934,7 +5934,7 @@ void uiTemplateList(uiLayout *layout,
|
||||
uiListType *ui_list_type;
|
||||
uiList *ui_list = NULL;
|
||||
uiListDyn *dyn_data;
|
||||
ARegion *ar;
|
||||
ARegion *region;
|
||||
uiListDrawItemFunc draw_item;
|
||||
uiListDrawFilterFunc draw_filter;
|
||||
uiListFilterItemsFunc filter_items;
|
||||
@@ -6026,16 +6026,16 @@ void uiTemplateList(uiLayout *layout,
|
||||
ui_list_id, sizeof(ui_list_id), "%s_%s", ui_list_type->idname, list_id ? list_id : "");
|
||||
|
||||
/* Allows to work in popups. */
|
||||
ar = CTX_wm_menu(C);
|
||||
if (ar == NULL) {
|
||||
ar = CTX_wm_region(C);
|
||||
region = CTX_wm_menu(C);
|
||||
if (region == NULL) {
|
||||
region = CTX_wm_region(C);
|
||||
}
|
||||
ui_list = BLI_findstring(&ar->ui_lists, ui_list_id, offsetof(uiList, list_id));
|
||||
ui_list = BLI_findstring(®ion->ui_lists, ui_list_id, offsetof(uiList, list_id));
|
||||
|
||||
if (!ui_list) {
|
||||
ui_list = MEM_callocN(sizeof(uiList), "uiList");
|
||||
BLI_strncpy(ui_list->list_id, ui_list_id, sizeof(ui_list->list_id));
|
||||
BLI_addtail(&ar->ui_lists, ui_list);
|
||||
BLI_addtail(®ion->ui_lists, ui_list);
|
||||
ui_list->list_grip = -UI_LIST_AUTO_SIZE_THRESHOLD; /* Force auto size by default. */
|
||||
if (sort_reverse) {
|
||||
ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE;
|
||||
@@ -7416,13 +7416,13 @@ typedef struct ComponentMenuArgs {
|
||||
char propname[64]; /* XXX arbitrary */
|
||||
} ComponentMenuArgs;
|
||||
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
|
||||
static uiBlock *component_menu(bContext *C, ARegion *ar, void *args_v)
|
||||
static uiBlock *component_menu(bContext *C, ARegion *region, void *args_v)
|
||||
{
|
||||
ComponentMenuArgs *args = (ComponentMenuArgs *)args_v;
|
||||
uiBlock *block;
|
||||
uiLayout *layout;
|
||||
|
||||
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
||||
block = UI_block_begin(C, region, __func__, UI_EMBOSS);
|
||||
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN);
|
||||
|
||||
layout = uiLayoutColumn(UI_block_layout(block,
|
||||
|
||||
@@ -4597,7 +4597,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
|
||||
* \{ */
|
||||
|
||||
/* conversion from old to new buttons, so still messy */
|
||||
void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
|
||||
void ui_draw_but(const bContext *C, ARegion *region, uiStyle *style, uiBut *but, rcti *rect)
|
||||
{
|
||||
bTheme *btheme = UI_GetTheme();
|
||||
const ThemeUI *tui = &btheme->tui;
|
||||
@@ -4790,30 +4790,30 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
||||
break;
|
||||
|
||||
case UI_BTYPE_IMAGE:
|
||||
ui_draw_but_IMAGE(ar, but, &tui->wcol_regular, rect);
|
||||
ui_draw_but_IMAGE(region, but, &tui->wcol_regular, rect);
|
||||
break;
|
||||
|
||||
case UI_BTYPE_HISTOGRAM:
|
||||
ui_draw_but_HISTOGRAM(ar, but, &tui->wcol_regular, rect);
|
||||
ui_draw_but_HISTOGRAM(region, but, &tui->wcol_regular, rect);
|
||||
break;
|
||||
|
||||
case UI_BTYPE_WAVEFORM:
|
||||
ui_draw_but_WAVEFORM(ar, but, &tui->wcol_regular, rect);
|
||||
ui_draw_but_WAVEFORM(region, but, &tui->wcol_regular, rect);
|
||||
break;
|
||||
|
||||
case UI_BTYPE_VECTORSCOPE:
|
||||
ui_draw_but_VECTORSCOPE(ar, but, &tui->wcol_regular, rect);
|
||||
ui_draw_but_VECTORSCOPE(region, but, &tui->wcol_regular, rect);
|
||||
break;
|
||||
|
||||
case UI_BTYPE_CURVE:
|
||||
/* do not draw right to edge of rect */
|
||||
rect->xmin += (0.2f * UI_UNIT_X);
|
||||
rect->xmax -= (0.2f * UI_UNIT_X);
|
||||
ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect);
|
||||
ui_draw_but_CURVE(region, but, &tui->wcol_regular, rect);
|
||||
break;
|
||||
|
||||
case UI_BTYPE_CURVEPROFILE:
|
||||
ui_draw_but_CURVEPROFILE(ar, but, &tui->wcol_regular, rect);
|
||||
ui_draw_but_CURVEPROFILE(region, but, &tui->wcol_regular, rect);
|
||||
break;
|
||||
|
||||
case UI_BTYPE_PROGRESS_BAR:
|
||||
@@ -4830,7 +4830,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
||||
break;
|
||||
|
||||
case UI_BTYPE_TRACK_PREVIEW:
|
||||
ui_draw_but_TRACKPREVIEW(ar, but, &tui->wcol_regular, rect);
|
||||
ui_draw_but_TRACKPREVIEW(region, but, &tui->wcol_regular, rect);
|
||||
break;
|
||||
|
||||
case UI_BTYPE_NODE_SOCKET:
|
||||
@@ -5012,13 +5012,13 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol,
|
||||
GPU_blend(false);
|
||||
}
|
||||
|
||||
void ui_draw_popover_back(ARegion *ar, uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
|
||||
void ui_draw_popover_back(ARegion *region, uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
|
||||
{
|
||||
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_BACK);
|
||||
|
||||
if (block) {
|
||||
float mval_origin[2] = {UNPACK2(block->bounds_offset)};
|
||||
ui_window_to_block_fl(ar, block, &mval_origin[0], &mval_origin[1]);
|
||||
ui_window_to_block_fl(region, block, &mval_origin[0], &mval_origin[1]);
|
||||
ui_draw_popover_back_impl(
|
||||
wt->wcol_theme, rect, block->direction, U.widget_unit / block->aspect, mval_origin);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user