Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.cc
| Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_duplilist.h" | #include "BKE_duplilist.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_editmesh_cache.h" | #include "BKE_editmesh_cache.h" | ||||
| #include "BKE_effect.h" | #include "BKE_effect.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_fcurve_driver.h" | #include "BKE_fcurve_driver.h" | ||||
| #include "BKE_geometry_set.h" | #include "BKE_geometry_set.h" | ||||
| #include "BKE_geometry_set.hh" | |||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "BKE_gpencil_geom.h" | #include "BKE_gpencil_geom.h" | ||||
| #include "BKE_gpencil_modifier.h" | #include "BKE_gpencil_modifier.h" | ||||
| #include "BKE_hair.h" | #include "BKE_hair.h" | ||||
| #include "BKE_icons.h" | #include "BKE_icons.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| ▲ Show 20 Lines • Show All 4,447 Lines • ▼ Show 20 Lines | default: | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| /** 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 | |||||
| * 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; | |||||
| if (geometry_set_eval) { | |||||
| /* Some areas expect to be able to modify the evaluated mesh. Theoretically this should be | |||||
| * avoided, or at least protected with a lock, so a const mesh could be returned from this | |||||
| * function. */ | |||||
| Mesh *mesh = geometry_set_eval->get_mesh_for_write(); | |||||
| if (mesh) { | |||||
| return mesh; | |||||
| } | |||||
| } | |||||
| /* 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 | |||||
| * object types use #geometry_set_eval. */ | |||||
| ID *data_eval = object->runtime.data_eval; | ID *data_eval = object->runtime.data_eval; | ||||
| return (data_eval && GS(data_eval->name) == ID_ME) ? (Mesh *)data_eval : nullptr; | if (data_eval && GS(data_eval->name) == ID_ME) { | ||||
| return reinterpret_cast<Mesh *>(data_eval); | |||||
| } | |||||
| return nullptr; | |||||
| } | } | ||||
| /** | /** | ||||
| * Get mesh which is not affected by modifiers: | * Get mesh which is not affected by modifiers: | ||||
| * - For original objects it will be same as `object->data`, and it is a mesh | * - For original objects it will be same as `object->data`, and it is a mesh | ||||
| * which is in the corresponding #Main. | * which is in the corresponding #Main. | ||||
| * - For copied-on-write objects it will give pointer to a copied-on-write | * - For copied-on-write objects it will give pointer to a copied-on-write | ||||
| * mesh which corresponds to original object's mesh. | * mesh which corresponds to original object's mesh. | ||||
| ▲ Show 20 Lines • Show All 1,280 Lines • Show Last 20 Lines | |||||