Cleanup: Rename Panel * variables from pa to panel
This commit is contained in:
parent
7c0e285948
commit
6fa904765a
|
@ -222,11 +222,11 @@ typedef struct PanelType {
|
|||
/* verify if the panel should draw or not */
|
||||
bool (*poll)(const struct bContext *C, struct PanelType *pt);
|
||||
/* draw header (optional) */
|
||||
void (*draw_header)(const struct bContext *C, struct Panel *pa);
|
||||
void (*draw_header)(const struct bContext *C, struct Panel *panel);
|
||||
/* draw header preset (optional) */
|
||||
void (*draw_header_preset)(const struct bContext *C, struct Panel *pa);
|
||||
void (*draw_header_preset)(const struct bContext *C, struct Panel *panel);
|
||||
/* draw entirely, view changes should be handled here */
|
||||
void (*draw)(const struct bContext *C, struct Panel *pa);
|
||||
void (*draw)(const struct bContext *C, struct Panel *panel);
|
||||
|
||||
/* sub panels */
|
||||
struct PanelType *parent;
|
||||
|
|
|
@ -230,11 +230,11 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb)
|
|||
BLI_duplicatelist(newlb, lb);
|
||||
|
||||
/* copy panel pointers */
|
||||
Panel *newpa = newlb->first;
|
||||
Panel *pa = lb->first;
|
||||
for (; newpa; newpa = newpa->next, pa = pa->next) {
|
||||
newpa->activedata = NULL;
|
||||
panel_list_copy(&newpa->children, &pa->children);
|
||||
Panel *new_panel = newlb->first;
|
||||
Panel *panel = lb->first;
|
||||
for (; new_panel; new_panel = new_panel->next, panel = panel->next) {
|
||||
new_panel->activedata = NULL;
|
||||
panel_list_copy(&new_panel->children, &panel->children);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,13 +418,13 @@ void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *)
|
|||
|
||||
void BKE_area_region_panels_free(ListBase *lb)
|
||||
{
|
||||
Panel *pa, *pa_next;
|
||||
for (pa = lb->first; pa; pa = pa_next) {
|
||||
pa_next = pa->next;
|
||||
if (pa->activedata) {
|
||||
MEM_freeN(pa->activedata);
|
||||
Panel *panel, *panel_next;
|
||||
for (panel = lb->first; panel; panel = panel_next) {
|
||||
panel_next = panel->next;
|
||||
if (panel->activedata) {
|
||||
MEM_freeN(panel->activedata);
|
||||
}
|
||||
BKE_area_region_panels_free(&pa->children);
|
||||
BKE_area_region_panels_free(&panel->children);
|
||||
}
|
||||
|
||||
BLI_freelistN(lb);
|
||||
|
|
|
@ -7197,11 +7197,11 @@ static void direct_link_panel_list(FileData *fd, ListBase *lb)
|
|||
{
|
||||
link_list(fd, lb);
|
||||
|
||||
LISTBASE_FOREACH (Panel *, pa, lb) {
|
||||
pa->runtime_flag = 0;
|
||||
pa->activedata = NULL;
|
||||
pa->type = NULL;
|
||||
direct_link_panel_list(fd, &pa->children);
|
||||
LISTBASE_FOREACH (Panel *, panel, lb) {
|
||||
panel->runtime_flag = 0;
|
||||
panel->activedata = NULL;
|
||||
panel->type = NULL;
|
||||
direct_link_panel_list(fd, &panel->children);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2943,9 +2943,9 @@ static void write_soops(WriteData *wd, SpaceOutliner *so)
|
|||
|
||||
static void write_panel_list(WriteData *wd, ListBase *lb)
|
||||
{
|
||||
LISTBASE_FOREACH (Panel *, pa, lb) {
|
||||
writestruct(wd, DATA, Panel, 1, pa);
|
||||
write_panel_list(wd, &pa->children);
|
||||
LISTBASE_FOREACH (Panel *, panel, lb) {
|
||||
writestruct(wd, DATA, Panel, 1, panel);
|
||||
write_panel_list(wd, &panel->children);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1655,7 +1655,7 @@ struct Panel *UI_panel_begin(struct ScrArea *area,
|
|||
struct ListBase *lb,
|
||||
uiBlock *block,
|
||||
struct PanelType *pt,
|
||||
struct Panel *pa,
|
||||
struct Panel *panel,
|
||||
bool *r_open);
|
||||
void UI_panel_end(const struct ScrArea *area,
|
||||
const struct ARegion *region,
|
||||
|
@ -1665,7 +1665,7 @@ void UI_panel_end(const struct ScrArea *area,
|
|||
bool open);
|
||||
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);
|
||||
int UI_panel_size_y(const struct Panel *panel);
|
||||
|
||||
bool UI_panel_category_is_visible(const struct ARegion *region);
|
||||
void UI_panel_category_add(struct ARegion *region, const char *name);
|
||||
|
|
|
@ -1231,7 +1231,7 @@ 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 *region, Panel *pa)
|
||||
void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *panel)
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
const bool has_panel_category = UI_panel_category_is_visible(region);
|
||||
|
@ -1243,11 +1243,11 @@ void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *pa)
|
|||
if (!any_item_visible) {
|
||||
return;
|
||||
}
|
||||
if (pa->type->parent != NULL) {
|
||||
if (panel->type->parent != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
RNA_pointer_create(&screen->id, &RNA_Panel, pa, &ptr);
|
||||
RNA_pointer_create(&screen->id, &RNA_Panel, panel, &ptr);
|
||||
|
||||
pup = UI_popup_menu_begin(C, IFACE_("Panel"), ICON_NONE);
|
||||
layout = UI_popup_menu_layout(pup);
|
||||
|
|
|
@ -975,7 +975,9 @@ ARegion *ui_screen_region_find_mouse_over(bScreen *screen, const struct wmEvent
|
|||
|
||||
/* 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 *region, struct Panel *pa);
|
||||
void ui_popup_context_menu_for_panel(struct bContext *C,
|
||||
struct ARegion *region,
|
||||
struct Panel *panel);
|
||||
|
||||
/* interface_eyedropper.c */
|
||||
struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf);
|
||||
|
|
|
@ -105,8 +105,8 @@ typedef struct uiHandlePanelData {
|
|||
int startsizex, startsizey;
|
||||
} uiHandlePanelData;
|
||||
|
||||
static int get_panel_real_size_y(const Panel *pa);
|
||||
static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelState state);
|
||||
static int get_panel_real_size_y(const Panel *panel);
|
||||
static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelState state);
|
||||
|
||||
static void panel_title_color_get(bool show_background, uchar color[4])
|
||||
{
|
||||
|
@ -160,45 +160,45 @@ static int panel_aligned(const ScrArea *area, const ARegion *region)
|
|||
|
||||
static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, bool *no_animation)
|
||||
{
|
||||
LISTBASE_FOREACH (Panel *, pa, lb) {
|
||||
LISTBASE_FOREACH (Panel *, panel, lb) {
|
||||
/* Detect panel active flag changes. */
|
||||
if (!(pa->type && pa->type->parent)) {
|
||||
if ((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE)) {
|
||||
if (!(panel->type && panel->type->parent)) {
|
||||
if ((panel->runtime_flag & PNL_WAS_ACTIVE) && !(panel->runtime_flag & PNL_ACTIVE)) {
|
||||
return true;
|
||||
}
|
||||
if (!(pa->runtime_flag & PNL_WAS_ACTIVE) && (pa->runtime_flag & PNL_ACTIVE)) {
|
||||
if (!(panel->runtime_flag & PNL_WAS_ACTIVE) && (panel->runtime_flag & PNL_ACTIVE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((pa->runtime_flag & PNL_ACTIVE) && !(pa->flag & PNL_CLOSED)) {
|
||||
if (panel_active_animation_changed(&pa->children, pa_animation, no_animation)) {
|
||||
if ((panel->runtime_flag & PNL_ACTIVE) && !(panel->flag & PNL_CLOSED)) {
|
||||
if (panel_active_animation_changed(&panel->children, pa_animation, no_animation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect animation. */
|
||||
if (pa->activedata) {
|
||||
uiHandlePanelData *data = pa->activedata;
|
||||
if (panel->activedata) {
|
||||
uiHandlePanelData *data = panel->activedata;
|
||||
if (data->state == PANEL_STATE_ANIMATION) {
|
||||
*pa_animation = pa;
|
||||
*pa_animation = panel;
|
||||
}
|
||||
else {
|
||||
/* Don't animate while handling other interaction. */
|
||||
*no_animation = true;
|
||||
}
|
||||
}
|
||||
if ((pa->runtime_flag & PNL_ANIM_ALIGN) && !(*pa_animation)) {
|
||||
*pa_animation = pa;
|
||||
if ((panel->runtime_flag & PNL_ANIM_ALIGN) && !(*pa_animation)) {
|
||||
*pa_animation = panel;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool panels_need_realign(ScrArea *area, ARegion *region, Panel **r_pa_animate)
|
||||
static bool panels_need_realign(ScrArea *area, ARegion *region, Panel **r_panel_animation)
|
||||
{
|
||||
*r_pa_animate = NULL;
|
||||
*r_panel_animation = NULL;
|
||||
|
||||
if (area->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
|
||||
SpaceProperties *sbuts = area->spacedata.first;
|
||||
|
@ -215,16 +215,16 @@ static bool panels_need_realign(ScrArea *area, ARegion *region, Panel **r_pa_ani
|
|||
}
|
||||
|
||||
/* Detect if a panel was added or removed. */
|
||||
Panel *pa_animation = NULL;
|
||||
Panel *panel_animation = NULL;
|
||||
bool no_animation = false;
|
||||
if (panel_active_animation_changed(®ion->panels, &pa_animation, &no_animation)) {
|
||||
if (panel_active_animation_changed(®ion->panels, &panel_animation, &no_animation)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Detect panel marked for animation, if we're not already animating. */
|
||||
if (pa_animation) {
|
||||
if (panel_animation) {
|
||||
if (!no_animation) {
|
||||
*r_pa_animate = pa_animation;
|
||||
*r_panel_animation = panel_animation;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -234,24 +234,24 @@ static bool panels_need_realign(ScrArea *area, ARegion *region, Panel **r_pa_ani
|
|||
|
||||
/****************************** panels ******************************/
|
||||
|
||||
static void panels_collapse_all(ScrArea *area, ARegion *region, const Panel *from_pa)
|
||||
static void panels_collapse_all(ScrArea *area, ARegion *region, const Panel *from_panel)
|
||||
{
|
||||
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(area, region) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
|
||||
const PanelType *from_pt = from_pa->type;
|
||||
Panel *pa;
|
||||
const PanelType *from_pt = from_panel->type;
|
||||
Panel *panel;
|
||||
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
PanelType *pt = pa->type;
|
||||
for (panel = region->panels.first; panel; panel = panel->next) {
|
||||
PanelType *pt = panel->type;
|
||||
|
||||
/* close panels with headers in the same context */
|
||||
if (pt && from_pt && !(pt->flag & PNL_NO_HEADER)) {
|
||||
if (!pt->context[0] || !from_pt->context[0] || STREQ(pt->context, from_pt->context)) {
|
||||
if ((pa->flag & PNL_PIN) || !category || !pt->category[0] ||
|
||||
if ((panel->flag & PNL_PIN) || !category || !pt->category[0] ||
|
||||
STREQ(pt->category, category)) {
|
||||
pa->flag &= ~PNL_CLOSED;
|
||||
pa->flag |= flag;
|
||||
panel->flag &= ~PNL_CLOSED;
|
||||
panel->flag |= flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,116 +260,116 @@ static void panels_collapse_all(ScrArea *area, ARegion *region, const Panel *fro
|
|||
|
||||
Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt)
|
||||
{
|
||||
Panel *pa;
|
||||
Panel *panel;
|
||||
const char *idname = pt->idname;
|
||||
|
||||
for (pa = lb->first; pa; pa = pa->next) {
|
||||
if (STREQLEN(pa->panelname, idname, sizeof(pa->panelname))) {
|
||||
return pa;
|
||||
for (panel = lb->first; panel; panel = panel->next) {
|
||||
if (STREQLEN(panel->panelname, idname, sizeof(panel->panelname))) {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \note \a pa should be return value from #UI_panel_find_by_type and can be NULL.
|
||||
* \note \a panel should be return value from #UI_panel_find_by_type and can be NULL.
|
||||
*/
|
||||
Panel *UI_panel_begin(ScrArea *area,
|
||||
ARegion *region,
|
||||
ListBase *lb,
|
||||
uiBlock *block,
|
||||
PanelType *pt,
|
||||
Panel *pa,
|
||||
Panel *panel,
|
||||
bool *r_open)
|
||||
{
|
||||
Panel *palast, *panext;
|
||||
Panel *panel_last, *panel_next;
|
||||
const char *drawname = CTX_IFACE_(pt->translation_context, pt->label);
|
||||
const char *idname = pt->idname;
|
||||
const bool newpanel = (pa == NULL);
|
||||
const bool newpanel = (panel == NULL);
|
||||
int align = panel_aligned(area, region);
|
||||
|
||||
if (!newpanel) {
|
||||
pa->type = pt;
|
||||
panel->type = pt;
|
||||
}
|
||||
else {
|
||||
/* new panel */
|
||||
pa = MEM_callocN(sizeof(Panel), "new panel");
|
||||
pa->type = pt;
|
||||
BLI_strncpy(pa->panelname, idname, sizeof(pa->panelname));
|
||||
panel = MEM_callocN(sizeof(Panel), "new panel");
|
||||
panel->type = pt;
|
||||
BLI_strncpy(panel->panelname, idname, sizeof(panel->panelname));
|
||||
|
||||
if (pt->flag & PNL_DEFAULT_CLOSED) {
|
||||
if (align == BUT_VERTICAL) {
|
||||
pa->flag |= PNL_CLOSEDY;
|
||||
panel->flag |= PNL_CLOSEDY;
|
||||
}
|
||||
else {
|
||||
pa->flag |= PNL_CLOSEDX;
|
||||
panel->flag |= PNL_CLOSEDX;
|
||||
}
|
||||
}
|
||||
|
||||
pa->ofsx = 0;
|
||||
pa->ofsy = 0;
|
||||
pa->sizex = 0;
|
||||
pa->sizey = 0;
|
||||
pa->blocksizex = 0;
|
||||
pa->blocksizey = 0;
|
||||
pa->runtime_flag |= PNL_NEW_ADDED;
|
||||
panel->ofsx = 0;
|
||||
panel->ofsy = 0;
|
||||
panel->sizex = 0;
|
||||
panel->sizey = 0;
|
||||
panel->blocksizex = 0;
|
||||
panel->blocksizey = 0;
|
||||
panel->runtime_flag |= PNL_NEW_ADDED;
|
||||
|
||||
BLI_addtail(lb, pa);
|
||||
BLI_addtail(lb, panel);
|
||||
}
|
||||
|
||||
/* Do not allow closed panels without headers! Else user could get "disappeared" UI! */
|
||||
if ((pt->flag & PNL_NO_HEADER) && (pa->flag & PNL_CLOSED)) {
|
||||
pa->flag &= ~PNL_CLOSED;
|
||||
if ((pt->flag & PNL_NO_HEADER) && (panel->flag & PNL_CLOSED)) {
|
||||
panel->flag &= ~PNL_CLOSED;
|
||||
/* Force update of panels' positions! */
|
||||
pa->sizex = 0;
|
||||
pa->sizey = 0;
|
||||
pa->blocksizex = 0;
|
||||
pa->blocksizey = 0;
|
||||
panel->sizex = 0;
|
||||
panel->sizey = 0;
|
||||
panel->blocksizex = 0;
|
||||
panel->blocksizey = 0;
|
||||
}
|
||||
|
||||
BLI_strncpy(pa->drawname, drawname, sizeof(pa->drawname));
|
||||
BLI_strncpy(panel->drawname, drawname, sizeof(panel->drawname));
|
||||
|
||||
/* if a new panel is added, we insert it right after the panel
|
||||
* that was last added. this way new panels are inserted in the
|
||||
* right place between versions */
|
||||
for (palast = lb->first; palast; palast = palast->next) {
|
||||
if (palast->runtime_flag & PNL_LAST_ADDED) {
|
||||
BLI_remlink(lb, pa);
|
||||
BLI_insertlinkafter(lb, palast, pa);
|
||||
for (panel_last = lb->first; panel_last; panel_last = panel_last->next) {
|
||||
if (panel_last->runtime_flag & PNL_LAST_ADDED) {
|
||||
BLI_remlink(lb, panel);
|
||||
BLI_insertlinkafter(lb, panel_last, panel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newpanel) {
|
||||
pa->sortorder = (palast) ? palast->sortorder + 1 : 0;
|
||||
panel->sortorder = (panel_last) ? panel_last->sortorder + 1 : 0;
|
||||
|
||||
for (panext = lb->first; panext; panext = panext->next) {
|
||||
if (panext != pa && panext->sortorder >= pa->sortorder) {
|
||||
panext->sortorder++;
|
||||
for (panel_next = lb->first; panel_next; panel_next = panel_next->next) {
|
||||
if (panel_next != panel && panel_next->sortorder >= panel->sortorder) {
|
||||
panel_next->sortorder++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (palast) {
|
||||
palast->runtime_flag &= ~PNL_LAST_ADDED;
|
||||
if (panel_last) {
|
||||
panel_last->runtime_flag &= ~PNL_LAST_ADDED;
|
||||
}
|
||||
|
||||
/* assign to block */
|
||||
block->panel = pa;
|
||||
pa->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED;
|
||||
block->panel = panel;
|
||||
panel->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED;
|
||||
if (region->alignment == RGN_ALIGN_FLOAT) {
|
||||
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
|
||||
}
|
||||
|
||||
*r_open = false;
|
||||
|
||||
if (pa->flag & PNL_CLOSED) {
|
||||
return pa;
|
||||
if (panel->flag & PNL_CLOSED) {
|
||||
return panel;
|
||||
}
|
||||
|
||||
*r_open = true;
|
||||
|
||||
return pa;
|
||||
return panel;
|
||||
}
|
||||
|
||||
static float panel_region_offset_x_get(const ARegion *region, int align)
|
||||
|
@ -387,14 +387,14 @@ static float panel_region_offset_x_get(const ARegion *region, int align)
|
|||
void UI_panel_end(
|
||||
const ScrArea *area, const ARegion *region, uiBlock *block, int width, int height, bool open)
|
||||
{
|
||||
Panel *pa = block->panel;
|
||||
Panel *panel = block->panel;
|
||||
|
||||
/* Set panel size excluding children. */
|
||||
pa->blocksizex = width;
|
||||
pa->blocksizey = height;
|
||||
panel->blocksizex = width;
|
||||
panel->blocksizey = height;
|
||||
|
||||
/* Compute total panel size including children. */
|
||||
LISTBASE_FOREACH (Panel *, pachild, &pa->children) {
|
||||
LISTBASE_FOREACH (Panel *, pachild, &panel->children) {
|
||||
if (pachild->runtime_flag & PNL_ACTIVE) {
|
||||
width = max_ii(width, pachild->sizex);
|
||||
height += get_panel_real_size_y(pachild);
|
||||
|
@ -402,32 +402,32 @@ void UI_panel_end(
|
|||
}
|
||||
|
||||
/* Update total panel size. */
|
||||
if (pa->runtime_flag & PNL_NEW_ADDED) {
|
||||
pa->runtime_flag &= ~PNL_NEW_ADDED;
|
||||
pa->sizex = width;
|
||||
pa->sizey = height;
|
||||
if (panel->runtime_flag & PNL_NEW_ADDED) {
|
||||
panel->runtime_flag &= ~PNL_NEW_ADDED;
|
||||
panel->sizex = width;
|
||||
panel->sizey = height;
|
||||
}
|
||||
else {
|
||||
int old_sizex = pa->sizex, old_sizey = pa->sizey;
|
||||
int old_region_ofsx = pa->runtime.region_ofsx;
|
||||
int old_sizex = panel->sizex, old_sizey = panel->sizey;
|
||||
int old_region_ofsx = panel->runtime.region_ofsx;
|
||||
|
||||
/* update width/height if non-zero */
|
||||
if (width != 0) {
|
||||
pa->sizex = width;
|
||||
panel->sizex = width;
|
||||
}
|
||||
if (height != 0 || open) {
|
||||
pa->sizey = height;
|
||||
panel->sizey = height;
|
||||
}
|
||||
|
||||
/* check if we need to do an animation */
|
||||
if (pa->sizex != old_sizex || pa->sizey != old_sizey) {
|
||||
pa->runtime_flag |= PNL_ANIM_ALIGN;
|
||||
pa->ofsy += old_sizey - pa->sizey;
|
||||
if (panel->sizex != old_sizex || panel->sizey != old_sizey) {
|
||||
panel->runtime_flag |= PNL_ANIM_ALIGN;
|
||||
panel->ofsy += old_sizey - panel->sizey;
|
||||
}
|
||||
|
||||
int align = panel_aligned(area, region);
|
||||
if (old_region_ofsx != panel_region_offset_x_get(region, align)) {
|
||||
pa->runtime_flag |= PNL_ANIM_ALIGN;
|
||||
panel->runtime_flag |= PNL_ANIM_ALIGN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -867,64 +867,64 @@ void ui_draw_aligned_panel(uiStyle *style,
|
|||
|
||||
/************************** panel alignment *************************/
|
||||
|
||||
static int get_panel_header(const Panel *pa)
|
||||
static int get_panel_header(const Panel *panel)
|
||||
{
|
||||
if (pa->type && (pa->type->flag & PNL_NO_HEADER)) {
|
||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return PNL_HEADER;
|
||||
}
|
||||
|
||||
static int get_panel_size_y(const Panel *pa)
|
||||
static int get_panel_size_y(const Panel *panel)
|
||||
{
|
||||
if (pa->type && (pa->type->flag & PNL_NO_HEADER)) {
|
||||
return pa->sizey;
|
||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
|
||||
return panel->sizey;
|
||||
}
|
||||
|
||||
return PNL_HEADER + pa->sizey;
|
||||
return PNL_HEADER + panel->sizey;
|
||||
}
|
||||
|
||||
static int get_panel_real_size_y(const Panel *pa)
|
||||
static int get_panel_real_size_y(const Panel *panel)
|
||||
{
|
||||
int sizey = (pa->flag & PNL_CLOSED) ? 0 : pa->sizey;
|
||||
int sizey = (panel->flag & PNL_CLOSED) ? 0 : panel->sizey;
|
||||
|
||||
if (pa->type && (pa->type->flag & PNL_NO_HEADER)) {
|
||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
|
||||
return sizey;
|
||||
}
|
||||
|
||||
return PNL_HEADER + sizey;
|
||||
}
|
||||
|
||||
int UI_panel_size_y(const Panel *pa)
|
||||
int UI_panel_size_y(const Panel *panel)
|
||||
{
|
||||
return get_panel_real_size_y(pa);
|
||||
return get_panel_real_size_y(panel);
|
||||
}
|
||||
|
||||
/* this function is needed because uiBlock and Panel itself don't
|
||||
* change sizey or location when closed */
|
||||
static int get_panel_real_ofsy(Panel *pa)
|
||||
static int get_panel_real_ofsy(Panel *panel)
|
||||
{
|
||||
if (pa->flag & PNL_CLOSEDY) {
|
||||
return pa->ofsy + pa->sizey;
|
||||
if (panel->flag & PNL_CLOSEDY) {
|
||||
return panel->ofsy + panel->sizey;
|
||||
}
|
||||
else {
|
||||
return pa->ofsy;
|
||||
return panel->ofsy;
|
||||
}
|
||||
}
|
||||
|
||||
static int get_panel_real_ofsx(Panel *pa)
|
||||
static int get_panel_real_ofsx(Panel *panel)
|
||||
{
|
||||
if (pa->flag & PNL_CLOSEDX) {
|
||||
return pa->ofsx + get_panel_header(pa);
|
||||
if (panel->flag & PNL_CLOSEDX) {
|
||||
return panel->ofsx + get_panel_header(panel);
|
||||
}
|
||||
else {
|
||||
return pa->ofsx + pa->sizex;
|
||||
return panel->ofsx + panel->sizex;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct PanelSort {
|
||||
Panel *pa, *orig;
|
||||
Panel *panel, *orig;
|
||||
} PanelSort;
|
||||
|
||||
/**
|
||||
|
@ -939,16 +939,16 @@ static int find_leftmost_panel(const void *a1, const void *a2)
|
|||
{
|
||||
const PanelSort *ps1 = a1, *ps2 = a2;
|
||||
|
||||
if (ps1->pa->ofsx > ps2->pa->ofsx) {
|
||||
if (ps1->panel->ofsx > ps2->panel->ofsx) {
|
||||
return 1;
|
||||
}
|
||||
else if (ps1->pa->ofsx < ps2->pa->ofsx) {
|
||||
else if (ps1->panel->ofsx < ps2->panel->ofsx) {
|
||||
return -1;
|
||||
}
|
||||
else if (ps1->pa->sortorder > ps2->pa->sortorder) {
|
||||
else if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
||||
return 1;
|
||||
}
|
||||
else if (ps1->pa->sortorder < ps2->pa->sortorder) {
|
||||
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -961,26 +961,26 @@ static int find_highest_panel(const void *a1, const void *a2)
|
|||
|
||||
/* stick uppermost header-less panels to the top of the region -
|
||||
* prevent them from being sorted (multiple header-less panels have to be sorted though) */
|
||||
if (ps1->pa->type->flag & PNL_NO_HEADER && ps2->pa->type->flag & PNL_NO_HEADER) {
|
||||
if (ps1->panel->type->flag & PNL_NO_HEADER && ps2->panel->type->flag & PNL_NO_HEADER) {
|
||||
/* skip and check for ofs and sortorder below */
|
||||
}
|
||||
else if (ps1->pa->type->flag & PNL_NO_HEADER) {
|
||||
else if (ps1->panel->type->flag & PNL_NO_HEADER) {
|
||||
return -1;
|
||||
}
|
||||
else if (ps2->pa->type->flag & PNL_NO_HEADER) {
|
||||
else if (ps2->panel->type->flag & PNL_NO_HEADER) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ps1->pa->ofsy + ps1->pa->sizey < ps2->pa->ofsy + ps2->pa->sizey) {
|
||||
if (ps1->panel->ofsy + ps1->panel->sizey < ps2->panel->ofsy + ps2->panel->sizey) {
|
||||
return 1;
|
||||
}
|
||||
else if (ps1->pa->ofsy + ps1->pa->sizey > ps2->pa->ofsy + ps2->pa->sizey) {
|
||||
else if (ps1->panel->ofsy + ps1->panel->sizey > ps2->panel->ofsy + ps2->panel->sizey) {
|
||||
return -1;
|
||||
}
|
||||
else if (ps1->pa->sortorder > ps2->pa->sortorder) {
|
||||
else if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
||||
return 1;
|
||||
}
|
||||
else if (ps1->pa->sortorder < ps2->pa->sortorder) {
|
||||
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -991,24 +991,24 @@ static int compare_panel(const void *a1, const void *a2)
|
|||
{
|
||||
const PanelSort *ps1 = a1, *ps2 = a2;
|
||||
|
||||
if (ps1->pa->sortorder > ps2->pa->sortorder) {
|
||||
if (ps1->panel->sortorder > ps2->panel->sortorder) {
|
||||
return 1;
|
||||
}
|
||||
else if (ps1->pa->sortorder < ps2->pa->sortorder) {
|
||||
else if (ps1->panel->sortorder < ps2->panel->sortorder) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void align_sub_panels(Panel *pa)
|
||||
static void align_sub_panels(Panel *panel)
|
||||
{
|
||||
/* Position sub panels. */
|
||||
int ofsy = pa->ofsy + pa->sizey - pa->blocksizey;
|
||||
int ofsy = panel->ofsy + panel->sizey - panel->blocksizey;
|
||||
|
||||
LISTBASE_FOREACH (Panel *, pachild, &pa->children) {
|
||||
LISTBASE_FOREACH (Panel *, pachild, &panel->children) {
|
||||
if (pachild->runtime_flag & PNL_ACTIVE) {
|
||||
pachild->ofsx = pa->ofsx;
|
||||
pachild->ofsx = panel->ofsx;
|
||||
pachild->ofsy = ofsy - get_panel_size_y(pachild);
|
||||
ofsy -= get_panel_real_size_y(pachild);
|
||||
|
||||
|
@ -1023,15 +1023,15 @@ static void align_sub_panels(Panel *pa)
|
|||
/* returns 1 when it did something */
|
||||
static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, const bool drag)
|
||||
{
|
||||
Panel *pa;
|
||||
Panel *panel;
|
||||
PanelSort *ps, *panelsort, *psnext;
|
||||
int a, tot = 0;
|
||||
bool done;
|
||||
int align = panel_aligned(area, region);
|
||||
|
||||
/* count active, not tabbed panels */
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
for (panel = region->panels.first; panel; panel = panel->next) {
|
||||
if (panel->runtime_flag & PNL_ACTIVE) {
|
||||
tot++;
|
||||
}
|
||||
}
|
||||
|
@ -1041,13 +1041,13 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co
|
|||
}
|
||||
|
||||
/* extra; change close direction? */
|
||||
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;
|
||||
for (panel = region->panels.first; panel; panel = panel->next) {
|
||||
if (panel->runtime_flag & PNL_ACTIVE) {
|
||||
if ((panel->flag & PNL_CLOSEDX) && (align == BUT_VERTICAL)) {
|
||||
panel->flag ^= PNL_CLOSED;
|
||||
}
|
||||
else if ((pa->flag & PNL_CLOSEDY) && (align == BUT_HORIZONTAL)) {
|
||||
pa->flag ^= PNL_CLOSED;
|
||||
else if ((panel->flag & PNL_CLOSEDY) && (align == BUT_HORIZONTAL)) {
|
||||
panel->flag ^= PNL_CLOSED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1056,10 +1056,10 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co
|
|||
panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort");
|
||||
|
||||
ps = panelsort;
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
ps->pa = MEM_dupallocN(pa);
|
||||
ps->orig = pa;
|
||||
for (panel = region->panels.first; panel; panel = panel->next) {
|
||||
if (panel->runtime_flag & PNL_ACTIVE) {
|
||||
ps->panel = MEM_dupallocN(panel);
|
||||
ps->orig = panel;
|
||||
ps++;
|
||||
}
|
||||
}
|
||||
|
@ -1084,21 +1084,22 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co
|
|||
|
||||
/* 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(region, align);
|
||||
ps->pa->ofsx = 0;
|
||||
ps->pa->ofsy = -get_panel_size_y(ps->pa);
|
||||
ps->pa->ofsx += ps->pa->runtime.region_ofsx;
|
||||
ps->panel->runtime.region_ofsx = panel_region_offset_x_get(region, align);
|
||||
ps->panel->ofsx = 0;
|
||||
ps->panel->ofsy = -get_panel_size_y(ps->panel);
|
||||
ps->panel->ofsx += ps->panel->runtime.region_ofsx;
|
||||
|
||||
for (a = 0; a < tot - 1; a++, ps++) {
|
||||
psnext = ps + 1;
|
||||
|
||||
if (align == BUT_VERTICAL) {
|
||||
psnext->pa->ofsx = ps->pa->ofsx;
|
||||
psnext->pa->ofsy = get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
|
||||
psnext->panel->ofsx = ps->panel->ofsx;
|
||||
psnext->panel->ofsy = get_panel_real_ofsy(ps->panel) - get_panel_size_y(psnext->panel);
|
||||
}
|
||||
else {
|
||||
psnext->pa->ofsx = get_panel_real_ofsx(ps->pa);
|
||||
psnext->pa->ofsy = ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
|
||||
psnext->panel->ofsx = get_panel_real_ofsx(ps->panel);
|
||||
psnext->panel->ofsy = ps->panel->ofsy + get_panel_size_y(ps->panel) -
|
||||
get_panel_size_y(psnext->panel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,11 +1107,11 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co
|
|||
done = false;
|
||||
ps = panelsort;
|
||||
for (a = 0; a < tot; a++, ps++) {
|
||||
if ((ps->pa->flag & PNL_SELECT) == 0) {
|
||||
if ((ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
|
||||
ps->orig->ofsx = round_fl_to_int(fac * (float)ps->pa->ofsx +
|
||||
if ((ps->panel->flag & PNL_SELECT) == 0) {
|
||||
if ((ps->orig->ofsx != ps->panel->ofsx) || (ps->orig->ofsy != ps->panel->ofsy)) {
|
||||
ps->orig->ofsx = round_fl_to_int(fac * (float)ps->panel->ofsx +
|
||||
(1.0f - fac) * (float)ps->orig->ofsx);
|
||||
ps->orig->ofsy = round_fl_to_int(fac * (float)ps->pa->ofsy +
|
||||
ps->orig->ofsy = round_fl_to_int(fac * (float)ps->panel->ofsy +
|
||||
(1.0f - fac) * (float)ps->orig->ofsy);
|
||||
done = true;
|
||||
}
|
||||
|
@ -1118,17 +1119,17 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co
|
|||
}
|
||||
|
||||
/* set locations for tabbed and sub panels */
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
if (pa->children.first) {
|
||||
align_sub_panels(pa);
|
||||
for (panel = region->panels.first; panel; panel = panel->next) {
|
||||
if (panel->runtime_flag & PNL_ACTIVE) {
|
||||
if (panel->children.first) {
|
||||
align_sub_panels(panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* free panelsort array */
|
||||
for (ps = panelsort, a = 0; a < tot; a++, ps++) {
|
||||
MEM_freeN(ps->pa);
|
||||
MEM_freeN(ps->panel);
|
||||
}
|
||||
MEM_freeN(panelsort);
|
||||
|
||||
|
@ -1137,23 +1138,23 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co
|
|||
|
||||
static void ui_panels_size(ScrArea *area, ARegion *region, int *r_x, int *r_y)
|
||||
{
|
||||
Panel *pa;
|
||||
Panel *panel;
|
||||
int align = panel_aligned(area, region);
|
||||
int sizex = 0;
|
||||
int sizey = 0;
|
||||
|
||||
/* compute size taken up by panels, for setting in view2d */
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
for (panel = region->panels.first; panel; panel = panel->next) {
|
||||
if (panel->runtime_flag & PNL_ACTIVE) {
|
||||
int pa_sizex, pa_sizey;
|
||||
|
||||
if (align == BUT_VERTICAL) {
|
||||
pa_sizex = pa->ofsx + pa->sizex;
|
||||
pa_sizey = get_panel_real_ofsy(pa);
|
||||
pa_sizex = panel->ofsx + panel->sizex;
|
||||
pa_sizey = get_panel_real_ofsy(panel);
|
||||
}
|
||||
else {
|
||||
pa_sizex = get_panel_real_ofsx(pa) + pa->sizex;
|
||||
pa_sizey = pa->ofsy + get_panel_size_y(pa);
|
||||
pa_sizex = get_panel_real_ofsx(panel) + panel->sizex;
|
||||
pa_sizey = panel->ofsy + get_panel_size_y(panel);
|
||||
}
|
||||
|
||||
sizex = max_ii(sizex, pa_sizex);
|
||||
|
@ -1200,15 +1201,15 @@ static void panel_list_clear_active(ListBase *lb)
|
|||
{
|
||||
/* set all panels as inactive, so that at the end we know
|
||||
* which ones were used */
|
||||
LISTBASE_FOREACH (Panel *, pa, lb) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
pa->runtime_flag = PNL_WAS_ACTIVE;
|
||||
LISTBASE_FOREACH (Panel *, panel, lb) {
|
||||
if (panel->runtime_flag & PNL_ACTIVE) {
|
||||
panel->runtime_flag = PNL_WAS_ACTIVE;
|
||||
}
|
||||
else {
|
||||
pa->runtime_flag = 0;
|
||||
panel->runtime_flag = 0;
|
||||
}
|
||||
|
||||
panel_list_clear_active(&pa->children);
|
||||
panel_list_clear_active(&panel->children);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1222,7 +1223,7 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y)
|
|||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
uiBlock *block;
|
||||
Panel *pa, *firstpa;
|
||||
Panel *panel, *panel_first;
|
||||
|
||||
/* offset contents */
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
|
@ -1232,9 +1233,9 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y)
|
|||
}
|
||||
|
||||
/* re-align, possibly with animation */
|
||||
if (panels_need_realign(area, region, &pa)) {
|
||||
if (pa) {
|
||||
panel_activate_state(C, pa, PANEL_STATE_ANIMATION);
|
||||
if (panels_need_realign(area, region, &panel)) {
|
||||
if (panel) {
|
||||
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
|
||||
}
|
||||
else {
|
||||
uiAlignPanelStep(area, region, 1.0, false);
|
||||
|
@ -1242,17 +1243,17 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y)
|
|||
}
|
||||
|
||||
/* tag first panel */
|
||||
firstpa = NULL;
|
||||
panel_first = NULL;
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
if (block->active && block->panel) {
|
||||
if (!firstpa || block->panel->sortorder < firstpa->sortorder) {
|
||||
firstpa = block->panel;
|
||||
if (!panel_first || block->panel->sortorder < panel_first->sortorder) {
|
||||
panel_first = block->panel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (firstpa) {
|
||||
firstpa->runtime_flag |= PNL_FIRST;
|
||||
if (panel_first) {
|
||||
panel_first->runtime_flag |= PNL_FIRST;
|
||||
}
|
||||
|
||||
/* compute size taken up by panel */
|
||||
|
@ -1305,20 +1306,20 @@ void UI_panels_scale(ARegion *region, float new_width)
|
|||
|
||||
static void check_panel_overlap(ARegion *region, Panel *panel)
|
||||
{
|
||||
Panel *pa;
|
||||
Panel *panel_list;
|
||||
|
||||
/* also called with (panel == NULL) for clear */
|
||||
|
||||
for (pa = region->panels.first; pa; pa = pa->next) {
|
||||
pa->flag &= ~PNL_OVERLAP;
|
||||
if (panel && (pa != panel)) {
|
||||
if (pa->runtime_flag & PNL_ACTIVE) {
|
||||
for (panel_list = region->panels.first; panel_list; panel_list = panel_list->next) {
|
||||
panel_list->flag &= ~PNL_OVERLAP;
|
||||
if (panel && (panel_list != panel)) {
|
||||
if (panel_list->runtime_flag & PNL_ACTIVE) {
|
||||
float safex = 0.2, safey = 0.2;
|
||||
|
||||
if (pa->flag & PNL_CLOSEDX) {
|
||||
if (panel_list->flag & PNL_CLOSEDX) {
|
||||
safex = 0.05;
|
||||
}
|
||||
else if (pa->flag & PNL_CLOSEDY) {
|
||||
else if (panel_list->flag & PNL_CLOSEDY) {
|
||||
safey = 0.05;
|
||||
}
|
||||
else if (panel->flag & PNL_CLOSEDX) {
|
||||
|
@ -1328,11 +1329,12 @@ static void check_panel_overlap(ARegion *region, Panel *panel)
|
|||
safey = 0.05;
|
||||
}
|
||||
|
||||
if (pa->ofsx > panel->ofsx - safex * panel->sizex) {
|
||||
if (pa->ofsx + pa->sizex < panel->ofsx + (1.0f + safex) * panel->sizex) {
|
||||
if (pa->ofsy > panel->ofsy - safey * panel->sizey) {
|
||||
if (pa->ofsy + pa->sizey < panel->ofsy + (1.0f + safey) * panel->sizey) {
|
||||
pa->flag |= PNL_OVERLAP;
|
||||
if (panel_list->ofsx > panel->ofsx - safex * panel->sizex) {
|
||||
if (panel_list->ofsx + panel_list->sizex < panel->ofsx + (1.0f + safex) * panel->sizex) {
|
||||
if (panel_list->ofsy > panel->ofsy - safey * panel->sizey) {
|
||||
if (panel_list->ofsy + panel_list->sizey <
|
||||
panel->ofsy + (1.0f + safey) * panel->sizey) {
|
||||
panel_list->flag |= PNL_OVERLAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1391,12 +1393,12 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
|
|||
/******************* region level panel interaction *****************/
|
||||
|
||||
static uiPanelMouseState ui_panel_mouse_state_get(const uiBlock *block,
|
||||
const Panel *pa,
|
||||
const Panel *panel,
|
||||
const int mx,
|
||||
const int my)
|
||||
{
|
||||
/* open panel */
|
||||
if (pa->flag & PNL_CLOSEDX) {
|
||||
if (panel->flag & PNL_CLOSEDX) {
|
||||
if ((block->rect.xmin <= mx) && (block->rect.xmin + PNL_HEADER >= mx)) {
|
||||
return PANEL_MOUSE_INSIDE_HEADER;
|
||||
}
|
||||
|
@ -1409,8 +1411,8 @@ static uiPanelMouseState ui_panel_mouse_state_get(const uiBlock *block,
|
|||
return PANEL_MOUSE_INSIDE_HEADER;
|
||||
}
|
||||
/* open panel */
|
||||
else if (!(pa->flag & PNL_CLOSEDY)) {
|
||||
if (pa->control & UI_PNL_SCALE) {
|
||||
else if (!(panel->flag & PNL_CLOSEDY)) {
|
||||
if (panel->control & UI_PNL_SCALE) {
|
||||
if (block->rect.xmax - PNL_HEADER <= mx) {
|
||||
if (block->rect.ymin + PNL_HEADER >= my) {
|
||||
return PANEL_MOUSE_INSIDE_SCALE;
|
||||
|
@ -1444,7 +1446,7 @@ static void ui_panel_drag_collapse(bContext *C,
|
|||
ScrArea *area = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
uiBlock *block;
|
||||
Panel *pa;
|
||||
Panel *panel;
|
||||
|
||||
for (block = region->uiblocks.first; block; block = block->next) {
|
||||
float xy_a_block[2] = {UNPACK2(dragcol_data->xy_init)};
|
||||
|
@ -1453,10 +1455,10 @@ static void ui_panel_drag_collapse(bContext *C,
|
|||
int oldflag;
|
||||
const bool is_horizontal = (panel_aligned(area, region) == BUT_HORIZONTAL);
|
||||
|
||||
if ((pa = block->panel) == 0 || (pa->type && (pa->type->flag & PNL_NO_HEADER))) {
|
||||
if ((panel = block->panel) == 0 || (panel->type && (panel->type->flag & PNL_NO_HEADER))) {
|
||||
continue;
|
||||
}
|
||||
oldflag = pa->flag;
|
||||
oldflag = panel->flag;
|
||||
|
||||
/* lock one axis */
|
||||
if (is_horizontal) {
|
||||
|
@ -1473,7 +1475,7 @@ static void ui_panel_drag_collapse(bContext *C,
|
|||
/* set up rect to match header size */
|
||||
rect.ymin = rect.ymax;
|
||||
rect.ymax = rect.ymin + PNL_HEADER;
|
||||
if (pa->flag & PNL_CLOSEDX) {
|
||||
if (panel->flag & PNL_CLOSEDX) {
|
||||
rect.xmax = rect.xmin + PNL_HEADER;
|
||||
}
|
||||
|
||||
|
@ -1481,16 +1483,16 @@ static void ui_panel_drag_collapse(bContext *C,
|
|||
if (BLI_rctf_isect_segment(&rect, xy_a_block, xy_b_block)) {
|
||||
/* force panel to close */
|
||||
if (dragcol_data->was_first_open == true) {
|
||||
pa->flag |= (is_horizontal ? PNL_CLOSEDX : PNL_CLOSEDY);
|
||||
panel->flag |= (is_horizontal ? PNL_CLOSEDX : PNL_CLOSEDY);
|
||||
}
|
||||
/* force panel to open */
|
||||
else {
|
||||
pa->flag &= ~PNL_CLOSED;
|
||||
panel->flag &= ~PNL_CLOSED;
|
||||
}
|
||||
|
||||
/* if pa->flag has changed this means a panel was opened/closed here */
|
||||
if (pa->flag != oldflag) {
|
||||
panel_activate_state(C, pa, PANEL_STATE_ANIMATION);
|
||||
/* if panel->flag has changed this means a panel was opened/closed here */
|
||||
if (panel->flag != oldflag) {
|
||||
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2279,7 +2281,7 @@ int ui_handler_panel_region(bContext *C,
|
|||
const uiBut *active_but)
|
||||
{
|
||||
uiBlock *block;
|
||||
Panel *pa;
|
||||
Panel *panel;
|
||||
int retval, mx, my;
|
||||
bool has_category_tabs = UI_panel_category_is_visible(region);
|
||||
|
||||
|
@ -2325,17 +2327,17 @@ int ui_handler_panel_region(bContext *C,
|
|||
ui_window_to_block(region, block, &mx, &my);
|
||||
|
||||
/* checks for mouse position inside */
|
||||
pa = block->panel;
|
||||
panel = block->panel;
|
||||
|
||||
if (!pa) {
|
||||
if (!panel) {
|
||||
continue;
|
||||
}
|
||||
/* XXX - accessed freed panels when scripts reload, need to fix. */
|
||||
if (pa->type && pa->type->flag & PNL_NO_HEADER) {
|
||||
if (panel->type && panel->type->flag & PNL_NO_HEADER) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mouse_state = ui_panel_mouse_state_get(block, pa, mx, my);
|
||||
mouse_state = ui_panel_mouse_state_get(block, panel, mx, my);
|
||||
|
||||
/* XXX hardcoded key warning */
|
||||
if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER) &&
|
||||
|
@ -2343,7 +2345,7 @@ int ui_handler_panel_region(bContext *C,
|
|||
if (event->type == EVT_AKEY &&
|
||||
((event->ctrl + event->oskey + event->shift + event->alt) == 0)) {
|
||||
|
||||
if (pa->flag & PNL_CLOSEDY) {
|
||||
if (panel->flag & PNL_CLOSEDY) {
|
||||
if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) {
|
||||
ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl, event->shift);
|
||||
}
|
||||
|
@ -2383,8 +2385,8 @@ int ui_handler_panel_region(bContext *C,
|
|||
retval = WM_UI_HANDLER_BREAK;
|
||||
break;
|
||||
}
|
||||
else if ((mouse_state == PANEL_MOUSE_INSIDE_SCALE) && !(pa->flag & PNL_CLOSED)) {
|
||||
panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
|
||||
else if ((mouse_state == PANEL_MOUSE_INSIDE_SCALE) && !(panel->flag & PNL_CLOSED)) {
|
||||
panel_activate_state(C, panel, PANEL_STATE_DRAG_SCALE);
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
break;
|
||||
}
|
||||
|
@ -2411,7 +2413,7 @@ int ui_handler_panel_region(bContext *C,
|
|||
int zoom = 0;
|
||||
|
||||
/* if panel is closed, only zoom if mouse is over the header */
|
||||
if (pa->flag & (PNL_CLOSEDX | PNL_CLOSEDY)) {
|
||||
if (panel->flag & (PNL_CLOSEDX | PNL_CLOSEDY)) {
|
||||
if (inside_header) {
|
||||
zoom = 1;
|
||||
}
|
||||
|
@ -2425,7 +2427,7 @@ int ui_handler_panel_region(bContext *C,
|
|||
SpaceLink *sl = area->spacedata.first;
|
||||
|
||||
if (area->spacetype != SPACE_PROPERTIES) {
|
||||
if (!(pa->control & UI_PNL_SCALE)) {
|
||||
if (!(panel->control & UI_PNL_SCALE)) {
|
||||
if (event->type == PADPLUSKEY) {
|
||||
sl->blockscale += 0.1;
|
||||
}
|
||||
|
@ -2495,14 +2497,14 @@ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata)
|
|||
|
||||
static void ui_handler_remove_panel(bContext *C, void *userdata)
|
||||
{
|
||||
Panel *pa = userdata;
|
||||
Panel *panel = userdata;
|
||||
|
||||
panel_activate_state(C, pa, PANEL_STATE_EXIT);
|
||||
panel_activate_state(C, panel, PANEL_STATE_EXIT);
|
||||
}
|
||||
|
||||
static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelState state)
|
||||
static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelState state)
|
||||
{
|
||||
uiHandlePanelData *data = pa->activedata;
|
||||
uiHandlePanelData *data = panel->activedata;
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
|
@ -2522,10 +2524,10 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
|
|||
check_panel_overlap(region, NULL); /* clears */
|
||||
}
|
||||
|
||||
pa->flag &= ~PNL_SELECT;
|
||||
panel->flag &= ~PNL_SELECT;
|
||||
}
|
||||
else {
|
||||
pa->flag |= PNL_SELECT;
|
||||
panel->flag |= PNL_SELECT;
|
||||
}
|
||||
|
||||
if (data && data->animtimer) {
|
||||
|
@ -2535,18 +2537,18 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
|
|||
|
||||
if (state == PANEL_STATE_EXIT) {
|
||||
MEM_freeN(data);
|
||||
pa->activedata = NULL;
|
||||
panel->activedata = NULL;
|
||||
|
||||
WM_event_remove_ui_handler(
|
||||
&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, false);
|
||||
&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, panel, false);
|
||||
}
|
||||
else {
|
||||
if (!data) {
|
||||
data = MEM_callocN(sizeof(uiHandlePanelData), "uiHandlePanelData");
|
||||
pa->activedata = data;
|
||||
panel->activedata = data;
|
||||
|
||||
WM_event_add_ui_handler(
|
||||
C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, 0);
|
||||
C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, panel, 0);
|
||||
}
|
||||
|
||||
if (ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG)) {
|
||||
|
@ -2556,10 +2558,10 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
|
|||
data->state = state;
|
||||
data->startx = win->eventstate->x;
|
||||
data->starty = win->eventstate->y;
|
||||
data->startofsx = pa->ofsx;
|
||||
data->startofsy = pa->ofsy;
|
||||
data->startsizex = pa->sizex;
|
||||
data->startsizey = pa->sizey;
|
||||
data->startofsx = panel->ofsx;
|
||||
data->startofsy = panel->ofsy;
|
||||
data->startsizex = panel->sizex;
|
||||
data->startsizey = panel->sizey;
|
||||
data->starttime = PIL_check_seconds_timer();
|
||||
}
|
||||
|
||||
|
|
|
@ -114,22 +114,22 @@ static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt
|
|||
return false;
|
||||
}
|
||||
|
||||
static void hud_panel_operator_redo_draw_header(const bContext *C, Panel *pa)
|
||||
static void hud_panel_operator_redo_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
wmOperator *op = WM_operator_last_redo(C);
|
||||
BLI_strncpy(pa->drawname, WM_operatortype_name(op->type, op->ptr), sizeof(pa->drawname));
|
||||
BLI_strncpy(panel->drawname, WM_operatortype_name(op->type, op->ptr), sizeof(panel->drawname));
|
||||
}
|
||||
|
||||
static void hud_panel_operator_redo_draw(const bContext *C, Panel *pa)
|
||||
static void hud_panel_operator_redo_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
wmOperator *op = WM_operator_last_redo(C);
|
||||
if (op == NULL) {
|
||||
return;
|
||||
}
|
||||
if (!WM_operator_check_ui_enabled(C, op->type->name)) {
|
||||
uiLayoutSetEnabled(pa->layout, false);
|
||||
uiLayoutSetEnabled(panel->layout, false);
|
||||
}
|
||||
uiLayout *col = uiLayoutColumn(pa->layout, false);
|
||||
uiLayout *col = uiLayoutColumn(panel->layout, false);
|
||||
uiTemplateOperatorRedoProperties(col, C);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,20 +57,20 @@ static bool file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt))
|
|||
return (sfile && sfile->op);
|
||||
}
|
||||
|
||||
static void file_panel_operator_header(const bContext *C, Panel *pa)
|
||||
static void file_panel_operator_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
wmOperator *op = sfile->op;
|
||||
|
||||
BLI_strncpy(pa->drawname, WM_operatortype_name(op->type, op->ptr), sizeof(pa->drawname));
|
||||
BLI_strncpy(panel->drawname, WM_operatortype_name(op->type, op->ptr), sizeof(panel->drawname));
|
||||
}
|
||||
|
||||
static void file_panel_operator(const bContext *C, Panel *pa)
|
||||
static void file_panel_operator(const bContext *C, Panel *panel)
|
||||
{
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
wmOperator *op = sfile->op;
|
||||
|
||||
UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
|
||||
UI_block_func_set(uiLayoutGetBlock(panel->layout), file_draw_check_cb, NULL, NULL);
|
||||
|
||||
/* Hack: temporary hide.*/
|
||||
const char *hide[] = {"filepath", "files", "directory", "filename"};
|
||||
|
@ -82,7 +82,7 @@ static void file_panel_operator(const bContext *C, Panel *pa)
|
|||
}
|
||||
|
||||
uiTemplateOperatorPropertyButs(
|
||||
C, pa->layout, op, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_SHOW_EMPTY);
|
||||
C, panel->layout, op, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_SHOW_EMPTY);
|
||||
|
||||
/* Hack: temporary hide.*/
|
||||
for (int i = 0; i < ARRAY_SIZE(hide); i++) {
|
||||
|
@ -92,7 +92,7 @@ static void file_panel_operator(const bContext *C, Panel *pa)
|
|||
}
|
||||
}
|
||||
|
||||
UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL);
|
||||
UI_block_func_set(uiLayoutGetBlock(panel->layout), NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void file_tool_props_region_panels_register(ARegionType *art)
|
||||
|
@ -128,12 +128,12 @@ static void file_panel_execution_execute_button(uiLayout *layout, const char *ti
|
|||
uiItemO(row, title, ICON_NONE, "FILE_OT_execute");
|
||||
}
|
||||
|
||||
static void file_panel_execution_buttons_draw(const bContext *C, Panel *pa)
|
||||
static void file_panel_execution_buttons_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
||||
uiBlock *block = uiLayoutGetBlock(pa->layout);
|
||||
uiBlock *block = uiLayoutGetBlock(panel->layout);
|
||||
uiBut *but;
|
||||
uiLayout *row;
|
||||
PointerRNA params_rna_ptr, *but_extra_rna_ptr;
|
||||
|
@ -148,7 +148,7 @@ static void file_panel_execution_buttons_draw(const bContext *C, Panel *pa)
|
|||
|
||||
RNA_pointer_create(&screen->id, &RNA_FileSelectParams, params, ¶ms_rna_ptr);
|
||||
|
||||
row = uiLayoutRow(pa->layout, false);
|
||||
row = uiLayoutRow(panel->layout, false);
|
||||
uiLayoutSetScaleY(row, 1.3f);
|
||||
|
||||
/* callbacks for operator check functions */
|
||||
|
|
|
@ -111,7 +111,7 @@ static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
|
|||
|
||||
/* -------------- */
|
||||
|
||||
static void graph_panel_cursor_header(const bContext *C, Panel *pa)
|
||||
static void graph_panel_cursor_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
SpaceGraph *sipo = CTX_wm_space_graph(C);
|
||||
|
@ -124,17 +124,17 @@ static void graph_panel_cursor_header(const bContext *C, Panel *pa)
|
|||
RNA_pointer_create(&screen->id, &RNA_SpaceGraphEditor, sipo, &spaceptr);
|
||||
|
||||
/* 2D-Cursor */
|
||||
col = uiLayoutColumn(pa->layout, false);
|
||||
col = uiLayoutColumn(panel->layout, false);
|
||||
uiItemR(col, &spaceptr, "show_cursor", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void graph_panel_cursor(const bContext *C, Panel *pa)
|
||||
static void graph_panel_cursor(const bContext *C, Panel *panel)
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
SpaceGraph *sipo = CTX_wm_space_graph(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
PointerRNA spaceptr, sceneptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *col, *sub;
|
||||
|
||||
/* get RNA pointers for use when creating the UI elements */
|
||||
|
@ -164,12 +164,12 @@ static void graph_panel_cursor(const bContext *C, Panel *pa)
|
|||
|
||||
/* ******************* active F-Curve ************** */
|
||||
|
||||
static void graph_panel_properties(const bContext *C, Panel *pa)
|
||||
static void graph_panel_properties(const bContext *C, Panel *panel)
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
FCurve *fcu;
|
||||
PointerRNA fcu_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *col;
|
||||
char name[256];
|
||||
int icon = 0;
|
||||
|
@ -345,13 +345,13 @@ static void graphedit_activekey_right_handle_coord_cb(bContext *C, void *fcu_ptr
|
|||
bezt->f3 = f3;
|
||||
}
|
||||
|
||||
static void graph_panel_key_properties(const bContext *C, Panel *pa)
|
||||
static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
FCurve *fcu;
|
||||
BezTriple *bezt, *prevbezt;
|
||||
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
/* Just a width big enough so buttons use entire layout width (will be clamped by it then). */
|
||||
const int but_max_width = region->winx;
|
||||
|
@ -1227,7 +1227,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout,
|
|||
|
||||
/* Panel to show property driven by the driver (in Drivers Editor) - duplicates Active FCurve,
|
||||
* but useful for clarity. */
|
||||
static void graph_panel_driven_property(const bContext *C, Panel *pa)
|
||||
static void graph_panel_driven_property(const bContext *C, Panel *panel)
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
FCurve *fcu;
|
||||
|
@ -1236,14 +1236,14 @@ static void graph_panel_driven_property(const bContext *C, Panel *pa)
|
|||
return;
|
||||
}
|
||||
|
||||
graph_draw_driven_property_panel(pa->layout, ale->id, fcu);
|
||||
graph_draw_driven_property_panel(panel->layout, ale->id, fcu);
|
||||
|
||||
MEM_freeN(ale);
|
||||
}
|
||||
|
||||
/* driver settings for active F-Curve
|
||||
* (only for 'Drivers' mode in Graph Editor, i.e. the full "Drivers Editor") */
|
||||
static void graph_panel_drivers(const bContext *C, Panel *pa)
|
||||
static void graph_panel_drivers(const bContext *C, Panel *panel)
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
FCurve *fcu;
|
||||
|
@ -1253,7 +1253,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
|
|||
return;
|
||||
}
|
||||
|
||||
graph_draw_driver_settings_panel(pa->layout, ale->id, fcu, false);
|
||||
graph_draw_driver_settings_panel(panel->layout, ale->id, fcu, false);
|
||||
|
||||
/* cleanup */
|
||||
MEM_freeN(ale);
|
||||
|
@ -1269,9 +1269,9 @@ static bool graph_panel_drivers_popover_poll(const bContext *C, PanelType *UNUSE
|
|||
}
|
||||
|
||||
/* popover panel for driver editing anywhere in ui */
|
||||
static void graph_panel_drivers_popover(const bContext *C, Panel *pa)
|
||||
static void graph_panel_drivers_popover(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr = {NULL};
|
||||
PropertyRNA *prop = NULL;
|
||||
|
@ -1303,7 +1303,7 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *pa)
|
|||
|
||||
/* Driven Property Settings */
|
||||
uiItemL(layout, IFACE_("Driven Property:"), ICON_NONE);
|
||||
graph_draw_driven_property_panel(pa->layout, id, fcu);
|
||||
graph_draw_driven_property_panel(panel->layout, id, fcu);
|
||||
/* TODO: All vs Single */
|
||||
|
||||
uiItemS(layout);
|
||||
|
@ -1311,7 +1311,7 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *pa)
|
|||
|
||||
/* Drivers Settings */
|
||||
uiItemL(layout, IFACE_("Driver Settings:"), ICON_NONE);
|
||||
graph_draw_driver_settings_panel(pa->layout, id, fcu, true);
|
||||
graph_draw_driver_settings_panel(panel->layout, id, fcu, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int
|
|||
}
|
||||
}
|
||||
|
||||
static void graph_panel_modifiers(const bContext *C, Panel *pa)
|
||||
static void graph_panel_modifiers(const bContext *C, Panel *panel)
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
FCurve *fcu;
|
||||
|
@ -1347,12 +1347,12 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
|
|||
return;
|
||||
}
|
||||
|
||||
block = uiLayoutGetBlock(pa->layout);
|
||||
block = uiLayoutGetBlock(panel->layout);
|
||||
UI_block_func_handle_set(block, do_graph_region_modifier_buttons, NULL);
|
||||
|
||||
/* 'add modifier' button at top of panel */
|
||||
{
|
||||
row = uiLayoutRow(pa->layout, false);
|
||||
row = uiLayoutRow(panel->layout, false);
|
||||
|
||||
/* this is an operator button which calls a 'add modifier' operator...
|
||||
* a menu might be nicer but would be tricky as we need some custom filtering
|
||||
|
@ -1369,7 +1369,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
|
|||
active = !(fcu->flag & FCURVE_MOD_OFF);
|
||||
/* draw each modifier */
|
||||
for (fcm = fcu->modifiers.first; fcm; fcm = fcm->next) {
|
||||
col = uiLayoutColumn(pa->layout, true);
|
||||
col = uiLayoutColumn(panel->layout, true);
|
||||
uiLayoutSetActive(col, active);
|
||||
|
||||
ANIM_uiTemplate_fmodifier_draw(col, ale->fcurve_owner_id, &fcu->modifiers, fcm);
|
||||
|
|
|
@ -242,11 +242,11 @@ static bool nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt))
|
|||
/* -------------- */
|
||||
|
||||
/* active AnimData */
|
||||
static void nla_panel_animdata(const bContext *C, Panel *pa)
|
||||
static void nla_panel_animdata(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA adt_ptr;
|
||||
/* AnimData *adt; */
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *row;
|
||||
uiBlock *block;
|
||||
|
||||
|
@ -312,10 +312,10 @@ static void nla_panel_animdata(const bContext *C, Panel *pa)
|
|||
}
|
||||
|
||||
/* generic settings for active NLA-Strip */
|
||||
static void nla_panel_stripname(const bContext *C, Panel *pa)
|
||||
static void nla_panel_stripname(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *row;
|
||||
uiBlock *block;
|
||||
|
||||
|
@ -350,10 +350,10 @@ static void nla_panel_stripname(const bContext *C, Panel *pa)
|
|||
}
|
||||
|
||||
/* generic settings for active NLA-Strip */
|
||||
static void nla_panel_properties(const bContext *C, Panel *pa)
|
||||
static void nla_panel_properties(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *column;
|
||||
uiBlock *block;
|
||||
short showEvalProps = 1;
|
||||
|
@ -419,10 +419,10 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
|
|||
}
|
||||
|
||||
/* action-clip only settings for active NLA-Strip */
|
||||
static void nla_panel_actclip(const bContext *C, Panel *pa)
|
||||
static void nla_panel_actclip(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *column, *row;
|
||||
uiBlock *block;
|
||||
|
||||
|
@ -461,10 +461,10 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
|
|||
}
|
||||
|
||||
/* evaluation settings for active NLA-Strip */
|
||||
static void nla_panel_animated_influence_header(const bContext *C, Panel *pa)
|
||||
static void nla_panel_animated_influence_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *col;
|
||||
uiBlock *block;
|
||||
|
||||
|
@ -481,10 +481,10 @@ static void nla_panel_animated_influence_header(const bContext *C, Panel *pa)
|
|||
}
|
||||
|
||||
/* evaluation settings for active NLA-Strip */
|
||||
static void nla_panel_evaluation(const bContext *C, Panel *pa)
|
||||
static void nla_panel_evaluation(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiBlock *block;
|
||||
|
||||
/* check context and also validity of pointer */
|
||||
|
@ -500,10 +500,10 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
|
|||
uiItemR(layout, &strip_ptr, "influence", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void nla_panel_animated_strip_time_header(const bContext *C, Panel *pa)
|
||||
static void nla_panel_animated_strip_time_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiLayout *col;
|
||||
uiBlock *block;
|
||||
|
||||
|
@ -519,10 +519,10 @@ static void nla_panel_animated_strip_time_header(const bContext *C, Panel *pa)
|
|||
uiItemR(col, &strip_ptr, "use_animated_time", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void nla_panel_animated_strip_time(const bContext *C, Panel *pa)
|
||||
static void nla_panel_animated_strip_time(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
uiLayout *layout = pa->layout;
|
||||
uiLayout *layout = panel->layout;
|
||||
uiBlock *block;
|
||||
|
||||
/* check context and also validity of pointer */
|
||||
|
@ -539,7 +539,7 @@ static void nla_panel_animated_strip_time(const bContext *C, Panel *pa)
|
|||
}
|
||||
|
||||
/* F-Modifiers for active NLA-Strip */
|
||||
static void nla_panel_modifiers(const bContext *C, Panel *pa)
|
||||
static void nla_panel_modifiers(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
NlaStrip *strip;
|
||||
|
@ -553,12 +553,12 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
|
|||
}
|
||||
strip = strip_ptr.data;
|
||||
|
||||
block = uiLayoutGetBlock(pa->layout);
|
||||
block = uiLayoutGetBlock(panel->layout);
|
||||
UI_block_func_handle_set(block, do_nla_region_buttons, NULL);
|
||||
|
||||
/* 'add modifier' button at top of panel */
|
||||
{
|
||||
row = uiLayoutRow(pa->layout, false);
|
||||
row = uiLayoutRow(panel->layout, false);
|
||||
block = uiLayoutGetBlock(row);
|
||||
|
||||
// FIXME: we need to set the only-active property so that this
|
||||
|
@ -574,7 +574,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
|
|||
|
||||
/* draw each modifier */
|
||||
for (fcm = strip->modifiers.first; fcm; fcm = fcm->next) {
|
||||
col = uiLayoutColumn(pa->layout, true);
|
||||
col = uiLayoutColumn(panel->layout, true);
|
||||
|
||||
ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.owner_id, &strip->modifiers, fcm);
|
||||
}
|
||||
|
|
|
@ -66,13 +66,13 @@ static bool node_sockets_poll(const bContext *C, PanelType *UNUSED(pt))
|
|||
return (snode && snode->nodetree && G.debug_value == 777);
|
||||
}
|
||||
|
||||
static void node_sockets_panel(const bContext *C, Panel *pa)
|
||||
static void node_sockets_panel(const bContext *C, Panel *panel)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNodeTree *ntree = (snode) ? snode->edittree : NULL;
|
||||
bNode *node = (ntree) ? nodeGetActive(ntree) : NULL;
|
||||
bNodeSocket *sock;
|
||||
uiLayout *layout = pa->layout, *split;
|
||||
uiLayout *layout = panel->layout, *split;
|
||||
char name[UI_MAX_NAME_STR];
|
||||
|
||||
if (ELEM(NULL, ntree, node)) {
|
||||
|
@ -119,13 +119,13 @@ static bool node_tree_find_active_socket(bNodeTree *ntree, bNodeSocket **r_sock,
|
|||
return false;
|
||||
}
|
||||
|
||||
static void node_tree_interface_panel(const bContext *C, Panel *pa)
|
||||
static void node_tree_interface_panel(const bContext *C, Panel *panel)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNodeTree *ntree = (snode) ? snode->edittree : NULL;
|
||||
bNodeSocket *sock;
|
||||
int in_out;
|
||||
uiLayout *layout = pa->layout, *row, *split, *col;
|
||||
uiLayout *layout = panel->layout, *row, *split, *col;
|
||||
PointerRNA ptr, sockptr, opptr;
|
||||
wmOperatorType *ot;
|
||||
|
||||
|
|
|
@ -1140,9 +1140,9 @@ static bool view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
|
|||
return false;
|
||||
}
|
||||
|
||||
static void view3d_panel_vgroup(const bContext *C, Panel *pa)
|
||||
static void view3d_panel_vgroup(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiBlock *block = uiLayoutAbsoluteBlock(pa->layout);
|
||||
uiBlock *block = uiLayoutAbsoluteBlock(panel->layout);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
Object *ob = view_layer->basact->object;
|
||||
|
@ -1171,7 +1171,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
|
|||
|
||||
UI_block_func_handle_set(block, do_view3d_vgroup_buttons, NULL);
|
||||
|
||||
bcol = uiLayoutColumn(pa->layout, true);
|
||||
bcol = uiLayoutColumn(panel->layout, true);
|
||||
row = uiLayoutRow(bcol, true); /* The filter button row */
|
||||
|
||||
RNA_pointer_create(NULL, &RNA_ToolSettings, ts, &tools_ptr);
|
||||
|
@ -1269,7 +1269,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
|
|||
|
||||
yco -= 2;
|
||||
|
||||
col = uiLayoutColumn(pa->layout, true);
|
||||
col = uiLayoutColumn(panel->layout, true);
|
||||
row = uiLayoutRow(col, true);
|
||||
|
||||
ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active_vertex", 1);
|
||||
|
@ -1555,7 +1555,7 @@ static bool view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt)
|
|||
return (view_layer->basact != NULL);
|
||||
}
|
||||
|
||||
static void view3d_panel_transform(const bContext *C, Panel *pa)
|
||||
static void view3d_panel_transform(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiBlock *block;
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
@ -1563,10 +1563,10 @@ static void view3d_panel_transform(const bContext *C, Panel *pa)
|
|||
Object *obedit = OBEDIT_FROM_OBACT(ob);
|
||||
uiLayout *col;
|
||||
|
||||
block = uiLayoutGetBlock(pa->layout);
|
||||
block = uiLayoutGetBlock(panel->layout);
|
||||
UI_block_func_handle_set(block, do_view3d_region_buttons, NULL);
|
||||
|
||||
col = uiLayoutColumn(pa->layout, false);
|
||||
col = uiLayoutColumn(panel->layout, false);
|
||||
|
||||
if (ob == obedit) {
|
||||
if (ob->type == OB_ARMATURE) {
|
||||
|
|
|
@ -259,11 +259,11 @@ static bool image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt))
|
|||
return ED_uvedit_test(obedit);
|
||||
}
|
||||
|
||||
static void image_panel_uv(const bContext *C, Panel *pa)
|
||||
static void image_panel_uv(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiBlock *block;
|
||||
|
||||
block = uiLayoutAbsoluteBlock(pa->layout);
|
||||
block = uiLayoutAbsoluteBlock(panel->layout);
|
||||
UI_block_func_handle_set(block, do_uvedit_vertex, NULL);
|
||||
|
||||
uvedit_vertex_buttons(C, block);
|
||||
|
|
|
@ -128,7 +128,7 @@ static bool panel_poll(const bContext *C, PanelType *pt)
|
|||
return visible;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *pnl)
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
extern FunctionRNA rna_Panel_draw_func;
|
||||
|
||||
|
@ -136,17 +136,17 @@ static void panel_draw(const bContext *C, Panel *pnl)
|
|||
ParameterList list;
|
||||
FunctionRNA *func;
|
||||
|
||||
RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->rna_ext.srna, pnl, &ptr);
|
||||
RNA_pointer_create(&CTX_wm_screen(C)->id, panel->type->rna_ext.srna, panel, &ptr);
|
||||
func = &rna_Panel_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
|
||||
|
||||
RNA_parameter_list_create(&list, &ptr, func);
|
||||
RNA_parameter_set_lookup(&list, "context", &C);
|
||||
pnl->type->rna_ext.call((bContext *)C, &ptr, func, &list);
|
||||
panel->type->rna_ext.call((bContext *)C, &ptr, func, &list);
|
||||
|
||||
RNA_parameter_list_free(&list);
|
||||
}
|
||||
|
||||
static void panel_draw_header(const bContext *C, Panel *pnl)
|
||||
static void panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
extern FunctionRNA rna_Panel_draw_header_func;
|
||||
|
||||
|
@ -154,17 +154,17 @@ static void panel_draw_header(const bContext *C, Panel *pnl)
|
|||
ParameterList list;
|
||||
FunctionRNA *func;
|
||||
|
||||
RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->rna_ext.srna, pnl, &ptr);
|
||||
RNA_pointer_create(&CTX_wm_screen(C)->id, panel->type->rna_ext.srna, panel, &ptr);
|
||||
func = &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */
|
||||
|
||||
RNA_parameter_list_create(&list, &ptr, func);
|
||||
RNA_parameter_set_lookup(&list, "context", &C);
|
||||
pnl->type->rna_ext.call((bContext *)C, &ptr, func, &list);
|
||||
panel->type->rna_ext.call((bContext *)C, &ptr, func, &list);
|
||||
|
||||
RNA_parameter_list_free(&list);
|
||||
}
|
||||
|
||||
static void panel_draw_header_preset(const bContext *C, Panel *pnl)
|
||||
static void panel_draw_header_preset(const bContext *C, Panel *panel)
|
||||
{
|
||||
extern FunctionRNA rna_Panel_draw_header_preset_func;
|
||||
|
||||
|
@ -172,12 +172,12 @@ static void panel_draw_header_preset(const bContext *C, Panel *pnl)
|
|||
ParameterList list;
|
||||
FunctionRNA *func;
|
||||
|
||||
RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->rna_ext.srna, pnl, &ptr);
|
||||
RNA_pointer_create(&CTX_wm_screen(C)->id, panel->type->rna_ext.srna, panel, &ptr);
|
||||
func = &rna_Panel_draw_header_preset_func;
|
||||
|
||||
RNA_parameter_list_create(&list, &ptr, func);
|
||||
RNA_parameter_set_lookup(&list, "context", &C);
|
||||
pnl->type->rna_ext.call((bContext *)C, &ptr, func, &list);
|
||||
panel->type->rna_ext.call((bContext *)C, &ptr, func, &list);
|
||||
|
||||
RNA_parameter_list_free(&list);
|
||||
}
|
||||
|
@ -221,9 +221,9 @@ static void rna_Panel_unregister(Main *bmain, StructRNA *type)
|
|||
&sl->regionbase;
|
||||
LISTBASE_FOREACH (ARegion *, region, regionbase) {
|
||||
if (region->type == art) {
|
||||
LISTBASE_FOREACH (Panel *, pa, ®ion->panels) {
|
||||
if (pa->type == pt) {
|
||||
pa->type = NULL;
|
||||
LISTBASE_FOREACH (Panel *, panel, ®ion->panels) {
|
||||
if (panel->type == pt) {
|
||||
panel->type = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue