Alternative fix for crash displaying 'New Window' keymap item

rB870440dee910c9 just did NULL-check for Main pointer, actual issue is
that bContext pointer was NULL. This can be fixed by ensuring
PROP_ENUM_NO_CONTEXT flag is not set by calling
WM_operator_properties_sanitize when creating RNA buttons. Now, layout
previews are visible in keymap editor too.
This commit is contained in:
Julian Eisel
2017-03-29 12:23:15 +02:00
parent 870440dee9
commit 38d0ea4f69
2 changed files with 18 additions and 18 deletions

View File

@@ -3684,6 +3684,8 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
{ {
uiLayout *flow, *box, *row; uiLayout *flow, *box, *row;
WM_operator_properties_sanitize(ptr, false);
uiItemS(layout); uiItemS(layout);
if (title) if (title)

View File

@@ -817,25 +817,23 @@ struct EnumPropertyItem *wm_window_new_screen_itemf(
* for dynamic strings in EnumPropertyItem.name to avoid this. */ * for dynamic strings in EnumPropertyItem.name to avoid this. */
static char active_screens[20][MAX_NAME + 12]; static char active_screens[20][MAX_NAME + 12];
if (bmain) { for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) { if (screen->winid) {
if (screen->winid) { BLI_snprintf(active_screens[count_act_screens], sizeof(*active_screens), "%s (Duplicate)",
BLI_snprintf(active_screens[count_act_screens], sizeof(*active_screens), "%s (Duplicate)", screen->id.name + 2);
screen->id.name + 2); tmp.name = active_screens[count_act_screens++];
tmp.name = active_screens[count_act_screens++];
}
else {
tmp.name = screen->id.name + 2;
}
tmp.value = value;
tmp.identifier = screen->id.name;
UI_id_icon_render(C, CTX_data_scene(C), &screen->id, true, false);
tmp.icon = BKE_icon_id_ensure(&screen->id);
RNA_enum_item_add(&item, &totitem, &tmp);
value++;
} }
else {
tmp.name = screen->id.name + 2;
}
tmp.value = value;
tmp.identifier = screen->id.name;
UI_id_icon_render(C, CTX_data_scene(C), &screen->id, true, false);
tmp.icon = BKE_icon_id_ensure(&screen->id);
RNA_enum_item_add(&item, &totitem, &tmp);
value++;
} }
RNA_enum_item_end(&item, &totitem); RNA_enum_item_end(&item, &totitem);