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:
@@ -3684,6 +3684,8 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
|
||||
{
|
||||
uiLayout *flow, *box, *row;
|
||||
|
||||
WM_operator_properties_sanitize(ptr, false);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
if (title)
|
||||
|
||||
@@ -817,25 +817,23 @@ struct EnumPropertyItem *wm_window_new_screen_itemf(
|
||||
* for dynamic strings in EnumPropertyItem.name to avoid this. */
|
||||
static char active_screens[20][MAX_NAME + 12];
|
||||
|
||||
if (bmain) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
if (screen->winid) {
|
||||
BLI_snprintf(active_screens[count_act_screens], sizeof(*active_screens), "%s (Duplicate)",
|
||||
screen->id.name + 2);
|
||||
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++;
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
if (screen->winid) {
|
||||
BLI_snprintf(active_screens[count_act_screens], sizeof(*active_screens), "%s (Duplicate)",
|
||||
screen->id.name + 2);
|
||||
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++;
|
||||
}
|
||||
|
||||
RNA_enum_item_end(&item, &totitem);
|
||||
|
||||
Reference in New Issue
Block a user