Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_query.cc
| Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
| Scene *DEG_get_evaluated_scene(Depsgraph *graph) | Scene *DEG_get_evaluated_scene(Depsgraph *graph) | ||||
| { | { | ||||
| DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph); | DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph); | ||||
| Scene *scene_orig = deg_graph->scene; | Scene *scene_orig = deg_graph->scene; | ||||
| return reinterpret_cast<Scene *>(deg_graph->get_cow_id(&scene_orig->id)); | return reinterpret_cast<Scene *>(deg_graph->get_cow_id(&scene_orig->id)); | ||||
| } | } | ||||
| SceneLayer *DEG_get_evaluated_scene_layer(Depsgraph *graph) | ViewLayer *DEG_get_evaluated_view_layer(Depsgraph *graph) | ||||
| { | { | ||||
| DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph); | DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph); | ||||
| Scene *scene_cow = DEG_get_evaluated_scene(graph); | Scene *scene_cow = DEG_get_evaluated_scene(graph); | ||||
| SceneLayer *scene_layer_orig = deg_graph->scene_layer; | ViewLayer *view_layer_orig = deg_graph->view_layer; | ||||
| SceneLayer *scene_layer_cow = | ViewLayer *view_layer_cow = | ||||
| (SceneLayer *)BLI_findstring(&scene_cow->render_layers, | (ViewLayer *)BLI_findstring(&scene_cow->view_layers, | ||||
| scene_layer_orig->name, | view_layer_orig->name, | ||||
| offsetof(SceneLayer, name)); | offsetof(ViewLayer, name)); | ||||
| return scene_layer_cow; | return view_layer_cow; | ||||
| } | } | ||||
| Object *DEG_get_evaluated_object(Depsgraph *depsgraph, Object *object) | Object *DEG_get_evaluated_object(Depsgraph *depsgraph, Object *object) | ||||
| { | { | ||||
| return (Object *)DEG_get_evaluated_id(depsgraph, &object->id); | return (Object *)DEG_get_evaluated_id(depsgraph, &object->id); | ||||
| } | } | ||||
| ID *DEG_get_evaluated_id(struct Depsgraph *depsgraph, ID *id) | ID *DEG_get_evaluated_id(struct Depsgraph *depsgraph, ID *id) | ||||
| Show All 15 Lines | |||||
| /** | /** | ||||
| * XXX (dfelinto/sergey) big hack, waiting for: | * XXX (dfelinto/sergey) big hack, waiting for: | ||||
| * "Reshuffle collections base flags evaluation, make it so object is gathering its base flags from collections." | * "Reshuffle collections base flags evaluation, make it so object is gathering its base flags from collections." | ||||
| * | * | ||||
| * Returns false if object shouldn't be found (which should never happen in the final implementation | * Returns false if object shouldn't be found (which should never happen in the final implementation | ||||
| * and instead we should have a tag to the objects that were not directly part of the depsgraph). | * and instead we should have a tag to the objects that were not directly part of the depsgraph). | ||||
| * | * | ||||
| * That means that the object is not in a collection but it's part of depsgraph, or the object is simply | * That means that the object is not in a collection but it's part of depsgraph, or the object is simply | ||||
| * not in the current SceneLayer - Depsgraph at the moment includes all the SceneLayer in the Scene. | * not in the current ViewLayer - Depsgraph at the moment includes all the ViewLayer in the Scene. | ||||
| */ | */ | ||||
| static bool deg_flush_base_flags_and_settings( | static bool deg_flush_base_flags_and_settings( | ||||
| DEGObjectsIteratorData *data, Object *ob_dst, Object *ob_src, const bool is_dupli) | DEGObjectsIteratorData *data, Object *ob_dst, Object *ob_src, const bool is_dupli) | ||||
| { | { | ||||
| Base *base; | Base *base; | ||||
| Depsgraph *graph = data->graph; | Depsgraph *graph = data->graph; | ||||
| SceneLayer *scene_layer = data->eval_ctx.scene_layer; | ViewLayer *view_layer = data->eval_ctx.view_layer; | ||||
| int flag = is_dupli ? BASE_FROMDUPLI : 0; | int flag = is_dupli ? BASE_FROMDUPLI : 0; | ||||
| /* First attempt, see if object is in the current SceneLayer. */ | /* First attempt, see if object is in the current ViewLayer. */ | ||||
| base = (Base *)BLI_findptr(&scene_layer->object_bases, ob_src, offsetof(Base, object)); | base = (Base *)BLI_findptr(&view_layer->object_bases, ob_src, offsetof(Base, object)); | ||||
| /* Next attempt, see if object is in one of the sets. */ | /* Next attempt, see if object is in one of the sets. */ | ||||
| if (base == NULL) { | if (base == NULL) { | ||||
| Scene *scene_iter, *scene = DEG_get_evaluated_scene(graph); | Scene *scene_iter, *scene = DEG_get_evaluated_scene(graph); | ||||
| scene_iter = scene; | scene_iter = scene; | ||||
| while ((scene_iter = (scene_iter)->set)) { | while ((scene_iter = (scene_iter)->set)) { | ||||
| SceneLayer *scene_layer_set = BKE_scene_layer_from_scene_get(scene_iter); | ViewLayer *view_layer_set = BKE_view_layer_from_scene_get(scene_iter); | ||||
| base = (Base *)BLI_findptr(&scene_layer_set->object_bases, ob_src, offsetof(Base, object)); | base = (Base *)BLI_findptr(&view_layer_set->object_bases, ob_src, offsetof(Base, object)); | ||||
| if (base != NULL) { | if (base != NULL) { | ||||
| flag |= BASE_FROM_SET; | flag |= BASE_FROM_SET; | ||||
| flag &= ~(BASE_SELECTED | BASE_SELECTABLED); | flag &= ~(BASE_SELECTED | BASE_SELECTABLED); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | void DEG_objects_iterator_begin(BLI_Iterator *iter, DEGObjectsIteratorData *data) | ||||
| if (num_id_nodes == 0) { | if (num_id_nodes == 0) { | ||||
| iter->valid = false; | iter->valid = false; | ||||
| return; | return; | ||||
| } | } | ||||
| /* TODO(sergey): What evaluation type we want here? */ | /* TODO(sergey): What evaluation type we want here? */ | ||||
| DEG_evaluation_context_init(&data->eval_ctx, DAG_EVAL_RENDER); | DEG_evaluation_context_init(&data->eval_ctx, DAG_EVAL_RENDER); | ||||
| data->eval_ctx.scene_layer = DEG_get_evaluated_scene_layer(depsgraph); | data->eval_ctx.view_layer = DEG_get_evaluated_view_layer(depsgraph); | ||||
| iter->data = data; | iter->data = data; | ||||
| data->dupli_parent = NULL; | data->dupli_parent = NULL; | ||||
| data->dupli_list = NULL; | data->dupli_list = NULL; | ||||
| data->dupli_object_next = NULL; | data->dupli_object_next = NULL; | ||||
| data->dupli_object_current = NULL; | data->dupli_object_current = NULL; | ||||
| data->scene = DEG_get_evaluated_scene(depsgraph); | data->scene = DEG_get_evaluated_scene(depsgraph); | ||||
| data->id_node_index = 0; | data->id_node_index = 0; | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||