Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/scene.c
| Show First 20 Lines • Show All 1,123 Lines • ▼ Show 20 Lines | while (run_again) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return iter->phase; | return iter->phase; | ||||
| } | } | ||||
| Scene *BKE_scene_find_from_view_layer(const Main *bmain, const ViewLayer *layer) | |||||
| { | |||||
| for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { | |||||
Severin: Could use `LISTBASE_FOREACH` of course. | |||||
| if (BLI_findindex(&scene->view_layers, layer) != -1) { | |||||
| return scene; | |||||
| } | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| Scene *BKE_scene_find_from_collection(const Main *bmain, const Collection *collection) | Scene *BKE_scene_find_from_collection(const Main *bmain, const Collection *collection) | ||||
| { | { | ||||
| for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { | for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { | ||||
| LISTBASE_FOREACH (ViewLayer *, layer, &scene->view_layers) { | LISTBASE_FOREACH (ViewLayer *, layer, &scene->view_layers) { | ||||
| if (BKE_view_layer_has_collection(layer, collection)) { | if (BKE_view_layer_has_collection(layer, collection)) { | ||||
| return scene; | return scene; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,101 Lines • ▼ Show 20 Lines | |||||
| static Depsgraph **scene_get_depsgraph_p(Main *bmain, | static Depsgraph **scene_get_depsgraph_p(Main *bmain, | ||||
| Scene *scene, | Scene *scene, | ||||
| ViewLayer *view_layer, | ViewLayer *view_layer, | ||||
| const bool allocate_ghash_entry, | const bool allocate_ghash_entry, | ||||
| const bool allocate_depsgraph) | const bool allocate_depsgraph) | ||||
| { | { | ||||
| BLI_assert(scene != NULL); | BLI_assert(scene != NULL); | ||||
| BLI_assert(view_layer != NULL); | BLI_assert(view_layer != NULL); | ||||
| BLI_assert(BKE_scene_find_from_view_layer(bmain, view_layer) == scene); | |||||
| /* Make sure hash itself exists. */ | /* Make sure hash itself exists. */ | ||||
| if (allocate_ghash_entry) { | if (allocate_ghash_entry) { | ||||
| BKE_scene_ensure_depsgraph_hash(scene); | BKE_scene_ensure_depsgraph_hash(scene); | ||||
| } | } | ||||
| if (scene->depsgraph_hash == NULL) { | if (scene->depsgraph_hash == NULL) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* Either ensure item is in the hash or simply return NULL if it's not, | /* Either ensure item is in the hash or simply return NULL if it's not, | ||||
| ▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines | |||||
Could use LISTBASE_FOREACH of course.