Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/context.c
| Show First 20 Lines • Show All 1,342 Lines • ▼ Show 20 Lines | int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list) | ||||
| return ctx_data_collection_get(C, "editable_gpencil_layers", list); | return ctx_data_collection_get(C, "editable_gpencil_layers", list); | ||||
| } | } | ||||
| int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list) | int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list) | ||||
| { | { | ||||
| return ctx_data_collection_get(C, "editable_gpencil_strokes", list); | return ctx_data_collection_get(C, "editable_gpencil_strokes", list); | ||||
| } | } | ||||
| Depsgraph *CTX_data_depsgraph(const bContext *C) | Depsgraph *CTX_data_depsgraph_pointer(const bContext *C) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); | Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); | ||||
| /* Dependency graph might have been just allocated, and hence it will not be marked. | /* Dependency graph might have been just allocated, and hence it will not be marked. | ||||
| * This confuses redo system due to the lack of flushing changes back to the original data. | * This confuses redo system due to the lack of flushing changes back to the original data. | ||||
| * In the future we would need to check whether the CTX_wm_window(C) is in editing mode (as an | * In the future we would need to check whether the CTX_wm_window(C) is in editing mode (as an | ||||
| * opposite of playback-preview-only) and set active flag based on that. */ | * opposite of playback-preview-only) and set active flag based on that. */ | ||||
| DEG_make_active(depsgraph); | DEG_make_active(depsgraph); | ||||
| return depsgraph; | return depsgraph; | ||||
| } | } | ||||
| Depsgraph *CTX_data_evaluated_depsgraph(const bContext *C) | Depsgraph *CTX_data_expect_evaluated_depsgraph(const bContext *C) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| /* TODO(sergey): Assert that the dependency graph is fully evaluated. | |||||
| * Note that first the depsgraph and scene post-eval hooks needs to run extra round of updates | |||||
| * first to make check here really reliable. */ | |||||
| return depsgraph; | |||||
| } | |||||
| Depsgraph *CTX_data_ensure_evaluated_depsgraph(const bContext *C) | |||||
| { | |||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | |||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| BKE_scene_graph_evaluated_ensure(depsgraph, bmain); | BKE_scene_graph_evaluated_ensure(depsgraph, bmain); | ||||
| return depsgraph; | return depsgraph; | ||||
| } | } | ||||
| Depsgraph *CTX_data_depsgraph_on_load(const bContext *C) | Depsgraph *CTX_data_depsgraph_on_load(const bContext *C) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| return BKE_scene_get_depsgraph(scene, view_layer, false); | return BKE_scene_get_depsgraph(scene, view_layer, false); | ||||
| } | } | ||||