Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_layer.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| static PointerRNA rna_ViewLayer_depsgraph_get(PointerRNA *ptr) | static PointerRNA rna_ViewLayer_depsgraph_get(PointerRNA *ptr) | ||||
| { | { | ||||
| ID *id = ptr->owner_id; | ID *id = ptr->owner_id; | ||||
| if (GS(id->name) == ID_SCE) { | if (GS(id->name) == ID_SCE) { | ||||
| Scene *scene = (Scene *)id; | Scene *scene = (Scene *)id; | ||||
| ViewLayer *view_layer = (ViewLayer *)ptr->data; | ViewLayer *view_layer = (ViewLayer *)ptr->data; | ||||
| // NOTE: We don't allocate new depsgraph here, so the bmain is ignored. So it's easier to pass | Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false); | ||||
| // NULL. | |||||
| // Still weak though. | |||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(NULL, scene, view_layer, false); | |||||
| return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, depsgraph); | return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, depsgraph); | ||||
| } | } | ||||
| return PointerRNA_NULL; | return PointerRNA_NULL; | ||||
| } | } | ||||
| static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | ||||
| { | { | ||||
| ViewLayer *view_layer = (ViewLayer *)ptr->data; | ViewLayer *view_layer = (ViewLayer *)ptr->data; | ||||
| rna_iterator_listbase_begin( | rna_iterator_listbase_begin( | ||||
| iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip); | iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip); | ||||
| } | } | ||||
| static void rna_ViewLayer_update_tagged(ID *id_ptr, ViewLayer *view_layer, Main *bmain) | static void rna_ViewLayer_update_tagged(ID *id_ptr, ViewLayer *view_layer, Main *bmain) | ||||
| { | { | ||||
| # ifdef WITH_PYTHON | # ifdef WITH_PYTHON | ||||
| /* Allow drivers to be evaluated */ | /* Allow drivers to be evaluated */ | ||||
| BPy_BEGIN_ALLOW_THREADS; | BPy_BEGIN_ALLOW_THREADS; | ||||
| # endif | # endif | ||||
| Scene *scene = (Scene *)id_ptr; | Scene *scene = (Scene *)id_ptr; | ||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); | Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); | ||||
| /* NOTE: This is similar to CTX_data_depsgraph_pointer(). Ideally such access would be | /* NOTE: This is similar to CTX_data_depsgraph_pointer(). Ideally such access would be | ||||
| * de-duplicated across all possible cases, but for now this is safest and easiest way to go. | * de-duplicated across all possible cases, but for now this is safest and easiest way to go. | ||||
| * | * | ||||
| * The reason for this is that it's possible to have Python operator which asks view layer to | * The reason for this is that it's possible to have Python operator which asks view layer to | ||||
| * be updated. After re-do of such operator view layer's dependency graph will not be marked | * be updated. After re-do of such operator view layer's dependency graph will not be marked | ||||
| * as active. */ | * as active. */ | ||||
| DEG_make_active(depsgraph); | DEG_make_active(depsgraph); | ||||
| BKE_scene_graph_update_tagged(depsgraph, bmain); | BKE_scene_graph_update_tagged(depsgraph, bmain); | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||