Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_query_iter.cc
| Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
| /* Returns false when iterator is exhausted. */ | /* Returns false when iterator is exhausted. */ | ||||
| bool deg_iterator_components_step(BLI_Iterator *iter) | bool deg_iterator_components_step(BLI_Iterator *iter) | ||||
| { | { | ||||
| DEGObjectIterData *data = (DEGObjectIterData *)iter->data; | DEGObjectIterData *data = (DEGObjectIterData *)iter->data; | ||||
| if (data->geometry_component_owner == nullptr) { | if (data->geometry_component_owner == nullptr) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (data->geometry_component_owner->type != OB_POINTCLOUD) { | if (data->geometry_component_owner->runtime.geometry_set_eval == nullptr) { | ||||
| /* Only point clouds support multiple geometry components currently. */ | /* Return the object itself, if it does not have a geometry set yet. */ | ||||
| iter->current = data->geometry_component_owner; | iter->current = data->geometry_component_owner; | ||||
| data->geometry_component_owner = nullptr; | data->geometry_component_owner = nullptr; | ||||
| return true; | return true; | ||||
| } | } | ||||
| GeometrySet *geometry_set = data->geometry_component_owner->runtime.geometry_set_eval; | GeometrySet *geometry_set = data->geometry_component_owner->runtime.geometry_set_eval; | ||||
| if (geometry_set == nullptr) { | if (geometry_set == nullptr) { | ||||
| data->geometry_component_owner = nullptr; | data->geometry_component_owner = nullptr; | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* The mesh component. */ | |||||
| if (data->geometry_component_id == 0) { | if (data->geometry_component_id == 0) { | ||||
| data->geometry_component_id++; | data->geometry_component_id++; | ||||
| /* The mesh component. */ | /* Don't use a temporary object for this component, when the owner is a mesh object. */ | ||||
| if (data->geometry_component_owner->type == OB_MESH) { | |||||
| iter->current = data->geometry_component_owner; | |||||
| return true; | |||||
| } | |||||
| const Mesh *mesh = geometry_set->get_mesh_for_read(); | const Mesh *mesh = geometry_set->get_mesh_for_read(); | ||||
| if (mesh != nullptr) { | if (mesh != nullptr) { | ||||
| Object *temp_object = &data->temp_geometry_component_object; | Object *temp_object = &data->temp_geometry_component_object; | ||||
| *temp_object = *data->geometry_component_owner; | *temp_object = *data->geometry_component_owner; | ||||
| temp_object->type = OB_MESH; | temp_object->type = OB_MESH; | ||||
| temp_object->data = (void *)mesh; | temp_object->data = (void *)mesh; | ||||
| temp_object->runtime.select_id = data->geometry_component_owner->runtime.select_id; | temp_object->runtime.select_id = data->geometry_component_owner->runtime.select_id; | ||||
| iter->current = temp_object; | iter->current = temp_object; | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| /* The pointcloud component. */ | |||||
| if (data->geometry_component_id == 1) { | if (data->geometry_component_id == 1) { | ||||
| data->geometry_component_id++; | data->geometry_component_id++; | ||||
| /* The pointcloud component. */ | /* Don't use a temporary object for this component, when the owner is a point cloud object. */ | ||||
| if (data->geometry_component_owner->type == OB_POINTCLOUD) { | |||||
| iter->current = data->geometry_component_owner; | |||||
| return true; | |||||
| } | |||||
| const PointCloud *pointcloud = geometry_set->get_pointcloud_for_read(); | const PointCloud *pointcloud = geometry_set->get_pointcloud_for_read(); | ||||
| if (pointcloud != nullptr) { | if (pointcloud != nullptr) { | ||||
| Object *temp_object = &data->temp_geometry_component_object; | Object *temp_object = &data->temp_geometry_component_object; | ||||
| *temp_object = *data->geometry_component_owner; | *temp_object = *data->geometry_component_owner; | ||||
| temp_object->type = OB_POINTCLOUD; | temp_object->type = OB_POINTCLOUD; | ||||
| temp_object->data = (void *)pointcloud; | temp_object->data = (void *)pointcloud; | ||||
| temp_object->runtime.select_id = data->geometry_component_owner->runtime.select_id; | temp_object->runtime.select_id = data->geometry_component_owner->runtime.select_id; | ||||
| iter->current = temp_object; | iter->current = temp_object; | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| data->geometry_component_owner = nullptr; | data->geometry_component_owner = nullptr; | ||||
| return false; | return false; | ||||
| } | } | ||||
| void deg_iterator_duplis_init(DEGObjectIterData *data, Object *object) | void deg_iterator_duplis_init(DEGObjectIterData *data, Object *object) | ||||
| { | { | ||||
| if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) && | if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) && | ||||
| ((object->transflag & OB_DUPLI) || object->runtime.geometry_set_eval != nullptr)) { | ((object->transflag & OB_DUPLI) || object->runtime.geometry_set_eval != nullptr)) { | ||||
| ▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines | |||||