Cleanup: Naming, match policy with rest of copy-on-write design
This commit is contained in:
parent
301a27187c
commit
d709705203
|
@ -341,15 +341,15 @@ void BKE_object_free_derived_caches(Object *ob)
|
|||
ob->derivedDeform = NULL;
|
||||
}
|
||||
|
||||
if (ob->mesh_evaluated != NULL) {
|
||||
if (ob->mesh_eval != NULL) {
|
||||
/* Restore initial pointer. */
|
||||
ob->data = ob->mesh_evaluated->id.orig_id;
|
||||
ob->data = ob->mesh_eval->id.orig_id;
|
||||
/* Evaluated mesh points to edit mesh, but does not own it. */
|
||||
ob->mesh_evaluated->edit_btmesh = NULL;
|
||||
BKE_mesh_free(ob->mesh_evaluated);
|
||||
BKE_libblock_free_data(&ob->mesh_evaluated->id, false);
|
||||
MEM_freeN(ob->mesh_evaluated);
|
||||
ob->mesh_evaluated = NULL;
|
||||
ob->mesh_eval->edit_btmesh = NULL;
|
||||
BKE_mesh_free(ob->mesh_eval);
|
||||
BKE_libblock_free_data(&ob->mesh_eval->id, false);
|
||||
MEM_freeN(ob->mesh_eval);
|
||||
ob->mesh_eval = NULL;
|
||||
}
|
||||
|
||||
BKE_object_free_curve_cache(ob);
|
||||
|
@ -2814,7 +2814,7 @@ Mesh *BKE_object_get_evaluated_mesh(const Depsgraph *depsgraph, Object *ob)
|
|||
{
|
||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
|
||||
return ob_eval->mesh_evaluated;
|
||||
return ob_eval->mesh_eval;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ void BKE_object_eval_uber_data(Depsgraph *depsgraph,
|
|||
* explicit way to query final object evaluated data and know for sure
|
||||
* who owns the newly created mesh datablock.
|
||||
*/
|
||||
ob->mesh_evaluated = new_mesh;
|
||||
ob->mesh_eval = new_mesh;
|
||||
/* TODO(sergey): This is kind of compatibility thing, so all render
|
||||
* engines can use object->data for mesh data for display. This is
|
||||
* something what we might want to change in the future.
|
||||
|
|
|
@ -716,7 +716,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
|
|||
*/
|
||||
ListBase gpumaterial_backup;
|
||||
ListBase *gpumaterial_ptr = NULL;
|
||||
Mesh *mesh_evaluated = NULL;
|
||||
Mesh *mesh_eval = NULL;
|
||||
CurveCache *curve_cache = NULL;
|
||||
short base_flag = 0;
|
||||
if (check_datablock_expanded(id_cow)) {
|
||||
|
@ -756,15 +756,15 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
|
|||
{
|
||||
Object *object = (Object *)id_cow;
|
||||
/* Store evaluated mesh, make sure we don't free it. */
|
||||
mesh_evaluated = object->mesh_evaluated;
|
||||
object->mesh_evaluated = NULL;
|
||||
mesh_eval = object->mesh_eval;
|
||||
object->mesh_eval = NULL;
|
||||
/* Currently object update will override actual object->data
|
||||
* to an evaluated version. Need to make sure we don't have
|
||||
* data set to evaluated one before free anything.
|
||||
*/
|
||||
if (mesh_evaluated != NULL) {
|
||||
if (object->data == mesh_evaluated) {
|
||||
object->data = mesh_evaluated->id.orig_id;
|
||||
if (mesh_eval != NULL) {
|
||||
if (object->data == mesh_eval) {
|
||||
object->data = mesh_eval->id.orig_id;
|
||||
}
|
||||
}
|
||||
/* Store curve cache and make sure we don't free it. */
|
||||
|
@ -791,19 +791,19 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
|
|||
}
|
||||
if (id_type == ID_OB) {
|
||||
Object *object = (Object *)id_cow;
|
||||
if (mesh_evaluated != NULL) {
|
||||
object->mesh_evaluated = mesh_evaluated;
|
||||
if (mesh_eval != NULL) {
|
||||
object->mesh_eval = mesh_eval;
|
||||
/* Do same thing as object update: override actual object data
|
||||
* pointer with evaluated datablock.
|
||||
*/
|
||||
if (object->type == OB_MESH) {
|
||||
object->data = mesh_evaluated;
|
||||
object->data = mesh_eval;
|
||||
/* Evaluated mesh simply copied edit_btmesh pointer from
|
||||
* original mesh during update, need to make sure no dead
|
||||
* pointers are left behind.
|
||||
*/
|
||||
mesh_evaluated->edit_btmesh =
|
||||
((Mesh *)mesh_evaluated->id.orig_id)->edit_btmesh;
|
||||
mesh_eval->edit_btmesh =
|
||||
((Mesh *)mesh_eval->id.orig_id)->edit_btmesh;
|
||||
}
|
||||
}
|
||||
if (curve_cache != NULL) {
|
||||
|
|
|
@ -1044,7 +1044,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
|
|||
psys_start = totpsys > 0 ? tmp_psys[0] : NULL;
|
||||
|
||||
/* get the DM (psys and their modifiers have not been appended yet) */
|
||||
/* TODO(Sybren): use mesh_evaluated instead */
|
||||
/* TODO(Sybren): use mesh_eval instead */
|
||||
DerivedMesh *final_dm = mesh_get_derived_final(depsgraph, scene, ob_to, cdmask);
|
||||
final_mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(final_dm, final_mesh, ob_to, CD_MASK_EVERYTHING, false);
|
||||
|
|
|
@ -459,7 +459,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
|
|||
|
||||
if (ob) {
|
||||
Mesh *me = (Mesh *)ob->data;
|
||||
Mesh *me_eval = BKE_object_get_evaluated_mesh(depsgraph, ob); /* Or shall we just do ob_eval->mesh_evaluated ? */
|
||||
Mesh *me_eval = BKE_object_get_evaluated_mesh(depsgraph, ob); /* Or shall we just do ob_eval->mesh_eval ? */
|
||||
|
||||
ViewContext vc;
|
||||
const int mval[2] = {x, y};
|
||||
|
|
|
@ -302,7 +302,7 @@ typedef struct Object {
|
|||
/* Mesh structure created during object evaluation.
|
||||
* It has all modifiers applied.
|
||||
*/
|
||||
struct Mesh *mesh_evaluated;
|
||||
struct Mesh *mesh_eval;
|
||||
|
||||
/* Object Display */
|
||||
struct ObjectDisplay display;
|
||||
|
|
Loading…
Reference in New Issue