RNA: Fix crash with select_mode_update.

`bpy.context.tool_settings.mesh_select_mode = (True, True, True)` was crashing because `wmn->window` was not being passed.
This commit is contained in:
Germano Cavalcante 2018-04-13 10:41:44 -03:00
parent ce114a307d
commit 3765653b38
2 changed files with 12 additions and 6 deletions

View File

@ -911,11 +911,15 @@ static void view3d_main_region_listener(
{
WM_manipulatormap_tag_refresh(mmap);
ViewLayer *view_layer = WM_window_get_active_view_layer(wmn->window);
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
if (obedit) {
ID *ob_data = wmn->reference;
if (ob_data == NULL) {
BLI_assert(wmn->window); // Use `WM_event_add_notifier` instead of `WM_main_add_notifier`
ViewLayer *view_layer = WM_window_get_active_view_layer(wmn->window);
ob_data = OBEDIT_FROM_VIEW_LAYER(view_layer)->data;
}
if (ob_data) {
/* TODO(sergey): Notifiers shouldn't really be doing DEG tags. */
DEG_id_tag_update((ID *)obedit->data, DEG_TAG_SELECT_UPDATE);
DEG_id_tag_update(ob_data, DEG_TAG_SELECT_UPDATE);
}
ATTR_FALLTHROUGH;
}

View File

@ -1507,8 +1507,10 @@ static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSE
me = NULL;
}
WM_main_add_notifier(NC_GEOM | ND_SELECT, me);
WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
if (me) {
DEG_id_tag_update(&me->id, DEG_TAG_SELECT_UPDATE);
WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
}
}
static void object_simplify_update(Object *ob)