Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_query_iter.cc
| Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | if (!dob || !(dob->type & hide_original_types)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| void deg_iterator_duplis_init(DEGObjectIterData *data, Object *object) | void deg_iterator_duplis_init(DEGObjectIterData *data, Object *object, ListBase *duplis) | ||||
| { | { | ||||
| if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) && | |||||
| ((object->transflag & OB_DUPLI) || object->runtime.geometry_set_eval != nullptr)) { | |||||
| data->dupli_parent = object; | data->dupli_parent = object; | ||||
| data->dupli_list = object_duplilist(data->graph, data->scene, object); | data->dupli_list = duplis; | ||||
| data->dupli_object_next = (DupliObject *)data->dupli_list->first; | data->dupli_object_next = static_cast<DupliObject *>(duplis->first); | ||||
| } | |||||
| } | } | ||||
| /* Returns false when iterator is exhausted. */ | /* Returns false when iterator is exhausted. */ | ||||
| bool deg_iterator_duplis_step(DEGObjectIterData *data) | bool deg_iterator_duplis_step(DEGObjectIterData *data) | ||||
| { | { | ||||
| if (data->dupli_list == nullptr) { | if (data->dupli_list == nullptr) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | switch (id_node->linked_state) { | ||||
| case deg::DEG_ID_LINKED_INDIRECTLY: | case deg::DEG_ID_LINKED_INDIRECTLY: | ||||
| if ((data->flag & DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY) == 0) { | if ((data->flag & DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY) == 0) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| Object *object = (Object *)id_node->id_cow; | Object *object = (Object *)id_node->id_cow; | ||||
| Object *object_orig = DEG_get_original_object(object); | |||||
| BLI_assert(deg::deg_validate_copy_on_write_datablock(&object->id)); | BLI_assert(deg::deg_validate_copy_on_write_datablock(&object->id)); | ||||
| object->runtime.select_id = object_orig->runtime.select_id; | |||||
| const bool use_preview = object_orig == data->object_orig_with_preview; | |||||
| if (use_preview) { | |||||
| ListBase *preview_duplis = object_duplilist_preview( | |||||
| data->graph, data->scene, object, data->settings->viewer_path); | |||||
| deg_iterator_duplis_init(data, object, preview_duplis); | |||||
| data->id_node_index++; | |||||
| return true; | |||||
| } | |||||
| int ob_visibility = OB_VISIBLE_ALL; | int ob_visibility = OB_VISIBLE_ALL; | ||||
| if (data->flag & DEG_ITER_OBJECT_FLAG_VISIBLE) { | if (data->flag & DEG_ITER_OBJECT_FLAG_VISIBLE) { | ||||
| ob_visibility = BKE_object_visibility(object, data->eval_mode); | ob_visibility = BKE_object_visibility(object, data->eval_mode); | ||||
| if (object->type != OB_MBALL && deg_object_hide_original(data->eval_mode, object, nullptr)) { | if (object->type != OB_MBALL && deg_object_hide_original(data->eval_mode, object, nullptr)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| object->runtime.select_id = DEG_get_original_object(object)->runtime.select_id; | |||||
| if (ob_visibility & OB_VISIBLE_INSTANCES) { | if (ob_visibility & OB_VISIBLE_INSTANCES) { | ||||
| deg_iterator_duplis_init(data, object); | if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) && | ||||
| ((object->transflag & OB_DUPLI) || object->runtime.geometry_set_eval != nullptr)) { | |||||
| ListBase *duplis = object_duplilist(data->graph, data->scene, object); | |||||
| deg_iterator_duplis_init(data, object, duplis); | |||||
| } | |||||
| } | } | ||||
| if (ob_visibility & (OB_VISIBLE_SELF | OB_VISIBLE_PARTICLES)) { | if (ob_visibility & (OB_VISIBLE_SELF | OB_VISIBLE_PARTICLES)) { | ||||
| data->next_object = object; | data->next_object = object; | ||||
| } | } | ||||
| data->id_node_index++; | data->id_node_index++; | ||||
| return true; | return true; | ||||
| } | } | ||||
| Show All 21 Lines | void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data) | ||||
| data->dupli_object_next = nullptr; | data->dupli_object_next = nullptr; | ||||
| data->dupli_object_current = nullptr; | data->dupli_object_current = nullptr; | ||||
| data->scene = DEG_get_evaluated_scene(depsgraph); | data->scene = DEG_get_evaluated_scene(depsgraph); | ||||
| data->id_node_index = 0; | data->id_node_index = 0; | ||||
| data->num_id_nodes = num_id_nodes; | data->num_id_nodes = num_id_nodes; | ||||
| data->eval_mode = DEG_get_mode(depsgraph); | data->eval_mode = DEG_get_mode(depsgraph); | ||||
| deg_invalidate_iterator_work_data(data); | deg_invalidate_iterator_work_data(data); | ||||
| /* Determine if the preview of any object should be in the iterator. */ | |||||
| const ViewerPath *viewer_path = data->settings->viewer_path; | |||||
| if (viewer_path != nullptr) { | |||||
| if (!BLI_listbase_is_empty(&viewer_path->path)) { | |||||
| const ViewerPathElem *elem = static_cast<const ViewerPathElem *>(viewer_path->path.first); | |||||
| if (elem->type == VIEWER_PATH_ELEM_TYPE_ID) { | |||||
| const IDViewerPathElem *id_elem = reinterpret_cast<const IDViewerPathElem *>(elem); | |||||
| if (id_elem->id != nullptr) { | |||||
| if (GS(id_elem->id->name) == ID_OB) { | |||||
| data->object_orig_with_preview = reinterpret_cast<Object *>(id_elem->id); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| DEG_iterator_objects_next(iter); | DEG_iterator_objects_next(iter); | ||||
| } | } | ||||
| void DEG_iterator_objects_next(BLI_Iterator *iter) | void DEG_iterator_objects_next(BLI_Iterator *iter) | ||||
| { | { | ||||
| DEGObjectIterData *data = (DEGObjectIterData *)iter->data; | DEGObjectIterData *data = (DEGObjectIterData *)iter->data; | ||||
| while (true) { | while (true) { | ||||
| if (data->next_object != nullptr) { | if (data->next_object != nullptr) { | ||||
| ▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines | |||||