Sequencer: ensure Strip is the default active panel
This commit is contained in:
@@ -159,13 +159,16 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
|
||||
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->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);
|
||||
if (builtin_template) {
|
||||
/* 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);
|
||||
|
||||
/* Reset size so it uses consistent defaults from the region types. */
|
||||
ar->sizex = 0;
|
||||
ar->sizey = 0;
|
||||
/* Reset size so it uses consistent defaults from the region types. */
|
||||
ar->sizex = 0;
|
||||
ar->sizey = 0;
|
||||
}
|
||||
|
||||
/* some toolbars have been saved as initialized,
|
||||
* we don't want them to have odd zoom-level or scrolling set, see: T47047 */
|
||||
|
||||
@@ -1641,6 +1641,7 @@ struct PanelCategoryDyn *UI_panel_category_find(struct ARegion *ar, const char *
|
||||
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,
|
||||
const int x,
|
||||
const int y);
|
||||
|
||||
@@ -1676,28 +1676,7 @@ PanelCategoryStack *UI_panel_category_active_find(ARegion *ar, const char *idnam
|
||||
return BLI_findstring(&ar->panels_category_active, idname, offsetof(PanelCategoryStack, idname));
|
||||
}
|
||||
|
||||
const char *UI_panel_category_active_get(ARegion *ar, 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)) {
|
||||
return pc_act->idname;
|
||||
}
|
||||
}
|
||||
|
||||
if (set_fallback) {
|
||||
PanelCategoryDyn *pc_dyn = ar->panels_category.first;
|
||||
if (pc_dyn) {
|
||||
UI_panel_category_active_set(ar, pc_dyn->idname);
|
||||
return pc_dyn->idname;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void UI_panel_category_active_set(ARegion *ar, const char *idname)
|
||||
static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool fallback)
|
||||
{
|
||||
ListBase *lb = &ar->panels_category_active;
|
||||
PanelCategoryStack *pc_act = UI_panel_category_active_find(ar, idname);
|
||||
@@ -1710,7 +1689,13 @@ void UI_panel_category_active_set(ARegion *ar, const char *idname)
|
||||
BLI_strncpy(pc_act->idname, idname, sizeof(pc_act->idname));
|
||||
}
|
||||
|
||||
BLI_addhead(lb, pc_act);
|
||||
if (fallback) {
|
||||
/* For fallbacks, add at the end so explicitly chosen categories have priority. */
|
||||
BLI_addtail(lb, pc_act);
|
||||
}
|
||||
else {
|
||||
BLI_addhead(lb, pc_act);
|
||||
}
|
||||
|
||||
/* validate all active panels, we could do this on load,
|
||||
* they are harmless - but we should remove somewhere.
|
||||
@@ -1729,6 +1714,39 @@ void UI_panel_category_active_set(ARegion *ar, const char *idname)
|
||||
}
|
||||
}
|
||||
|
||||
void UI_panel_category_active_set(ARegion *ar, const char *idname)
|
||||
{
|
||||
ui_panel_category_active_set(ar, idname, false);
|
||||
}
|
||||
|
||||
void UI_panel_category_active_set_default(ARegion *ar, const char *idname)
|
||||
{
|
||||
if (!UI_panel_category_active_find(ar, idname)) {
|
||||
ui_panel_category_active_set(ar, idname, true);
|
||||
}
|
||||
}
|
||||
|
||||
const char *UI_panel_category_active_get(ARegion *ar, 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)) {
|
||||
return pc_act->idname;
|
||||
}
|
||||
}
|
||||
|
||||
if (set_fallback) {
|
||||
PanelCategoryDyn *pc_dyn = ar->panels_category.first;
|
||||
if (pc_dyn) {
|
||||
ui_panel_category_active_set(ar, pc_dyn->idname, true);
|
||||
return pc_dyn->idname;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *ar, const int x, const int y)
|
||||
{
|
||||
PanelCategoryDyn *ptd;
|
||||
|
||||
@@ -729,6 +729,7 @@ static void sequencer_buttons_region_init(wmWindowManager *wm, ARegion *ar)
|
||||
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
|
||||
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
||||
|
||||
UI_panel_category_active_set_default(ar, "Strip");
|
||||
ED_region_panels_init(wm, ar);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user