diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 20 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 34 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 8 |
6 files changed, 59 insertions, 18 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 789a8b381b6..a6778ef67da 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -972,7 +972,9 @@ static void rna_BrushGpencilSettings_default_eraser_update(Main *bmain, static void rna_BrushGpencilSettings_use_material_pin_update(bContext *C, PointerRNA *ptr) { + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); Brush *brush = (Brush *)ptr->owner_id; diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 3a76b9e05c2..ae0366bebad 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -50,8 +50,10 @@ static PointerRNA rna_ViewLayer_active_layer_collection_get(PointerRNA *ptr) { + const Scene *scene = (const Scene *)ptr->owner_id; ViewLayer *view_layer = (ViewLayer *)ptr->data; - LayerCollection *lc = view_layer->active_collection; + BKE_view_layer_synced_ensure(scene, view_layer); + LayerCollection *lc = BKE_view_layer_active_collection_get(view_layer); return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, lc); } @@ -59,8 +61,10 @@ static void rna_ViewLayer_active_layer_collection_set(PointerRNA *ptr, PointerRNA value, struct ReportList *UNUSED(reports)) { + const Scene *scene = (const Scene *)ptr->owner_id; ViewLayer *view_layer = (ViewLayer *)ptr->data; LayerCollection *lc = (LayerCollection *)value.data; + BKE_view_layer_synced_ensure(scene, view_layer); const int index = BKE_layer_collection_findindex(view_layer, lc); if (index != -1) { BKE_layer_collection_activate(view_layer, lc); @@ -69,18 +73,22 @@ static void rna_ViewLayer_active_layer_collection_set(PointerRNA *ptr, static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr) { + const Scene *scene = (Scene *)ptr->owner_id; ViewLayer *view_layer = (ViewLayer *)ptr->data; + BKE_view_layer_synced_ensure(scene, view_layer); return rna_pointer_inherit_refine( - ptr, &RNA_Object, view_layer->basact ? view_layer->basact->object : NULL); + ptr, &RNA_Object, BKE_view_layer_active_object_get(view_layer)); } static void rna_LayerObjects_active_object_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports) { + const Scene *scene = (Scene *)ptr->owner_id; ViewLayer *view_layer = (ViewLayer *)ptr->data; if (value.data) { Object *ob = value.data; + BKE_view_layer_synced_ensure(scene, view_layer); Base *basact_test = BKE_view_layer_base_find(view_layer, ob); if (basact_test != NULL) { view_layer->basact = basact_test; @@ -197,7 +205,7 @@ static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, Po { ViewLayer *view_layer = (ViewLayer *)ptr->data; rna_iterator_listbase_begin( - iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip); + iter, BKE_view_layer_object_bases_get(view_layer), rna_ViewLayer_objects_selected_skip); } static void rna_ViewLayer_update_tagged(ID *id_ptr, @@ -245,7 +253,7 @@ static void rna_ObjectBase_hide_viewport_update(bContext *C, PointerRNA *UNUSED( { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - BKE_layer_collection_sync(scene, view_layer); + BKE_view_layer_need_resync_tag(view_layer); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } @@ -309,7 +317,7 @@ static void rna_LayerCollection_exclude_update(Main *bmain, Scene *UNUSED(scene) const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0; BKE_layer_collection_set_flag(lc, LAYER_COLLECTION_EXCLUDE, exclude); - BKE_layer_collection_sync(scene, view_layer); + BKE_view_layer_need_resync_tag(view_layer); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); if (!exclude) { @@ -334,7 +342,7 @@ static void rna_LayerCollection_update(Main *UNUSED(bmain), Scene *UNUSED(scene) LayerCollection *lc = (LayerCollection *)ptr->data; ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc); - BKE_layer_collection_sync(scene, view_layer); + BKE_view_layer_need_resync_tag(view_layer); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 6967f78026a..0b8cf601bfd 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -145,7 +145,7 @@ static void rna_Object_hide_set( } Scene *scene = CTX_data_scene(C); - BKE_layer_collection_sync(scene, view_layer); + BKE_view_layer_need_resync_tag(view_layer); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e2b3276c45f..27cfe766eef 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -706,7 +706,9 @@ static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UN static void rna_Gpencil_extend_selection(bContext *C, PointerRNA *UNUSED(ptr)) { /* Extend selection to all points in all selected strokes. */ + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); if ((ob) && (ob->type == OB_GPENCIL)) { bGPdata *gpd = (bGPdata *)ob->data; @@ -1862,13 +1864,17 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *valu /* Update select mode in all the workspaces in mesh edit mode. */ wmWindowManager *wm = G_MAIN->wm.first; LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { + const Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - - if (view_layer && view_layer->basact) { - Mesh *me = BKE_mesh_from_object(view_layer->basact->object); - if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) { - me->edit_mesh->selectmode = flag; - EDBM_selectmode_set(me->edit_mesh); + if (view_layer) { + BKE_view_layer_synced_ensure(scene, view_layer); + Object *object = BKE_view_layer_active_object_get(view_layer); + if (object) { + Mesh *me = BKE_mesh_from_object(object); + if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) { + me->edit_mesh->selectmode = flag; + EDBM_selectmode_set(me->edit_mesh); + } } } } @@ -1877,11 +1883,14 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *valu static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSED(ptr)) { + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Mesh *me = NULL; - if (view_layer->basact) { - me = BKE_mesh_from_object(view_layer->basact->object); + BKE_view_layer_synced_ensure(scene, view_layer); + Object *object = BKE_view_layer_active_object_get(view_layer); + if (object) { + me = BKE_mesh_from_object(object); if (me && me->edit_mesh == NULL) { me = NULL; } @@ -2220,11 +2229,14 @@ static char *rna_SequencerToolSettings_path(const PointerRNA *UNUSED(ptr)) /* generic function to recalc geometry */ static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr)) { + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Mesh *me = NULL; - if (view_layer->basact) { - me = BKE_mesh_from_object(view_layer->basact->object); + BKE_view_layer_synced_ensure(scene, view_layer); + Object *object = BKE_view_layer_active_object_get(view_layer); + if (object) { + me = BKE_mesh_from_object(object); if (me && me->edit_mesh == NULL) { me = NULL; } @@ -2248,7 +2260,9 @@ static char *rna_MeshStatVis_path(const PointerRNA *UNUSED(ptr)) * given its own notifier. */ static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED(ptr)) { + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob) { diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 42523508c14..a4298c8c3aa 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -165,6 +165,7 @@ static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr)) Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob); @@ -185,6 +186,7 @@ static void rna_ParticleEdit_update(bContext *C, PointerRNA *UNUSED(ptr)) { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob) { @@ -215,7 +217,9 @@ static const EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); # if 0 Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); @@ -374,6 +378,7 @@ static void rna_Sculpt_update(bContext *C, PointerRNA *UNUSED(ptr)) { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob) { @@ -389,12 +394,13 @@ static void rna_Sculpt_update(bContext *C, PointerRNA *UNUSED(ptr)) static void rna_Sculpt_ShowMask_update(bContext *C, PointerRNA *UNUSED(ptr)) { + Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *object = BKE_view_layer_active_object_get(view_layer); if (object == NULL || object->sculpt == NULL) { return; } - Scene *scene = CTX_data_scene(C); Sculpt *sd = scene->toolsettings->sculpt; object->sculpt->show_mask = ((sd->flags & SCULPT_HIDE_MASK) == 0); if (object->sculpt->pbvh != NULL) { @@ -488,6 +494,7 @@ static void rna_ImaPaint_mode_update(bContext *C, PointerRNA *UNUSED(ptr)) { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob && ob->type == OB_MESH) { @@ -505,6 +512,7 @@ static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr)) { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); if (ob && ob->type == OB_MESH) { @@ -524,6 +532,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr)) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *ob = BKE_view_layer_active_object_get(view_layer); bScreen *screen; Image *ima = scene->toolsettings->imapaint.canvas; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 268aacfccc6..01b68cbd134 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1673,7 +1673,9 @@ static bool rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr) Object *obedit = NULL; wmWindow *win = ED_screen_window_find(screen, G_MAIN->wm.first); if (win != NULL) { + Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); + BKE_view_layer_synced_ensure(scene, view_layer); obedit = BKE_view_layer_edit_object_get(view_layer); } return ED_space_image_show_uvedit(sima, obedit); @@ -1686,7 +1688,9 @@ static bool rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr) Object *obedit = NULL; wmWindow *win = ED_screen_window_find(screen, G_MAIN->wm.first); if (win != NULL) { + Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); + BKE_view_layer_synced_ensure(scene, view_layer); obedit = BKE_view_layer_edit_object_get(view_layer); } return ED_space_image_check_show_maskedit(sima, obedit); @@ -2184,9 +2188,11 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr) { SpaceAction *saction = (SpaceAction *)(ptr->data); + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Main *bmain = CTX_data_main(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *obact = BKE_view_layer_active_object_get(view_layer); if (obact == NULL) { return; @@ -2259,7 +2265,9 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr) { SpaceAction *saction = (SpaceAction *)(ptr->data); ScrArea *area = CTX_wm_area(C); + const Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + BKE_view_layer_synced_ensure(scene, view_layer); Object *obact = BKE_view_layer_active_object_get(view_layer); /* special exceptions for ShapeKey Editor mode */ |