Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.cc
| Show First 20 Lines • Show All 4,558 Lines • ▼ Show 20 Lines | |||||
| /** Get evaluated mesh for given object. */ | /** Get evaluated mesh for given object. */ | ||||
| Mesh *BKE_object_get_evaluated_mesh(const Object *object) | Mesh *BKE_object_get_evaluated_mesh(const Object *object) | ||||
| { | { | ||||
| /* First attempt to retrieve the evaluated mesh from the evaluated geometry set. Most | /* First attempt to retrieve the evaluated mesh from the evaluated geometry set. Most | ||||
| * object types either store it there or add a reference to it if it's owned elsewhere. */ | * object types either store it there or add a reference to it if it's owned elsewhere. */ | ||||
| GeometrySet *geometry_set_eval = object->runtime.geometry_set_eval; | GeometrySet *geometry_set_eval = object->runtime.geometry_set_eval; | ||||
| if (geometry_set_eval) { | if (geometry_set_eval) { | ||||
| /* Some areas expect to be able to modify the evaluated mesh. Theoretically this should be | /* Some areas expect to be able to modify the evaluated mesh in limited ways. Theoretically | ||||
| * avoided, or at least protected with a lock, so a const mesh could be returned from this | * this should be avoided, or at least protected with a lock, so a const mesh could be returned | ||||
| * function. */ | * from this function. We use a const_cast instead of #get_mesh_for_write, because that might | ||||
| Mesh *mesh = geometry_set_eval->get_mesh_for_write(); | * result in a copy of the mesh when it is shared. */ | ||||
| Mesh *mesh = const_cast<Mesh *>(geometry_set_eval->get_mesh_for_read()); | |||||
| if (mesh) { | if (mesh) { | ||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| } | } | ||||
| /* Some object types do not yet add the evaluated mesh to an evaluated geometry set, if they do | /* Some object types do not yet add the evaluated mesh to an evaluated geometry set, if they do | ||||
| * not support evaluating to multiple data types. Eventually this should be removed, when all | * not support evaluating to multiple data types. Eventually this should be removed, when all | ||||
| * object types use #geometry_set_eval. */ | * object types use #geometry_set_eval. */ | ||||
| ▲ Show 20 Lines • Show All 1,294 Lines • Show Last 20 Lines | |||||