Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | |||||
| static void object_update_from_subsurf_ccg(Object *object) | static void object_update_from_subsurf_ccg(Object *object) | ||||
| { | { | ||||
| /* Currently CCG is only created for Mesh objects. */ | /* Currently CCG is only created for Mesh objects. */ | ||||
| if (object->type != OB_MESH) { | if (object->type != OB_MESH) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Object was never evaluated, so can not have CCG subdivision surface. */ | /* Object was never evaluated, so can not have CCG subdivision surface. */ | ||||
| Mesh *mesh_eval = object->runtime.mesh_eval; | Mesh *mesh_eval = object->runtime.mesh_eval; | ||||
| if (mesh_eval == NULL) { | if (mesh_eval == NULL || mesh_eval == object->runtime.mesh_orig) { | ||||
| return; | return; | ||||
| } | } | ||||
| SubdivCCG *subdiv_ccg = mesh_eval->runtime.subdiv_ccg; | SubdivCCG *subdiv_ccg = mesh_eval->runtime.subdiv_ccg; | ||||
| if (subdiv_ccg == NULL) { | if (subdiv_ccg == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Check whether there is anything to be reshaped. */ | /* Check whether there is anything to be reshaped. */ | ||||
| if (!subdiv_ccg->dirty.coords && !subdiv_ccg->dirty.hidden) { | if (!subdiv_ccg->dirty.coords && !subdiv_ccg->dirty.hidden) { | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | else if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) { | ||||
| } | } | ||||
| } | } | ||||
| MEM_SAFE_FREE(ob->runtime.bb); | MEM_SAFE_FREE(ob->runtime.bb); | ||||
| object_update_from_subsurf_ccg(ob); | object_update_from_subsurf_ccg(ob); | ||||
| BKE_object_free_derived_mesh_caches(ob); | BKE_object_free_derived_mesh_caches(ob); | ||||
| if (ob->runtime.mesh_eval != NULL) { | if (ob->runtime.mesh_eval != NULL && ob->runtime.mesh_eval != ob->runtime.mesh_orig) { | ||||
| Mesh *mesh_eval = ob->runtime.mesh_eval; | Mesh *mesh_eval = ob->runtime.mesh_eval; | ||||
| /* Restore initial pointer. */ | /* Restore initial pointer. */ | ||||
| if (ob->data == mesh_eval) { | if (ob->data == mesh_eval) { | ||||
| ob->data = ob->runtime.mesh_orig; | ob->data = ob->runtime.mesh_orig; | ||||
| } | } | ||||
| /* Evaluated mesh points to edit mesh, but does not own it. */ | /* Evaluated mesh points to edit mesh, but does not own it. */ | ||||
| mesh_eval->edit_mesh = NULL; | mesh_eval->edit_mesh = NULL; | ||||
| BKE_mesh_free(mesh_eval); | BKE_mesh_free(mesh_eval); | ||||
| ▲ Show 20 Lines • Show All 4,059 Lines • Show Last 20 Lines | |||||