Weight paint: Use helper function to get original mesh

Makes it one line to get needed mesh, no code duplication. And can easily
update asserts and tighten the nuts.
This commit is contained in:
Sergey Sharybin 2018-06-04 15:49:11 +02:00
parent 0e8edbbc01
commit 3b4c7a8c9b
2 changed files with 4 additions and 6 deletions

View File

@ -46,6 +46,7 @@
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_editmesh.h"
#include "BKE_curve.h"
@ -291,9 +292,7 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
* this derivedmesh is just original mesh. it's the multires subsurf dm
* that this is actually for, to support a pbvh on a modified mesh */
if (!cddm->pbvh && ob->type == OB_MESH) {
Object *ob_orig = DEG_get_original_object(ob);
Mesh *me = ob_orig->data;
BLI_assert(!(me->id.tag & LIB_TAG_NO_MAIN));
Mesh *me = BKE_object_get_original_mesh(ob);
const int looptris_num = poly_to_tri_count(me->totpoly, me->totloop);
MLoopTri *looptri;
bool deformed;

View File

@ -69,6 +69,7 @@
#include "BKE_mesh_mapping.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
@ -2329,9 +2330,7 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
numGrids, &key, (void **) ccgdm->gridFaces, ccgdm->gridFlagMats, ccgdm->gridHidden);
}
else if (ob->type == OB_MESH) {
Object *ob_orig = DEG_get_original_object(ob);
Mesh *me = ob_orig->data;
BLI_assert(!(me->id.tag & LIB_TAG_NO_MAIN));
Mesh *me = BKE_object_get_original_mesh(ob);
const int looptris_num = poly_to_tri_count(me->totpoly, me->totloop);
MLoopTri *looptri;