Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2007-12-27 01:40:56 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2007-12-27 01:40:56 +0300
commit015007beafeaeec09ba8a7fc859acc40ba6b8b16 (patch)
tree2922fc9d7e4d2a4ab9e63da1d6421cdd7cafb3ce /source/blender/blenkernel/intern/mesh.c
parentae976e087a7110c6b25a0fee4f663185b5e4319d (diff)
== Sculpt ==
Fixed bad level calls in sculptmode.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 6156b2bed89..25a391be566 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -55,8 +55,6 @@
#include "DNA_meshdata_types.h"
#include "DNA_ipo_types.h"
-#include "BDR_sculptmode.h"
-
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
@@ -1230,3 +1228,70 @@ void free_uv_vert_map(UvVertMap *vmap)
}
}
+/* Partial Mesh Visibility */
+PartialVisibility *mesh_pmv_copy(PartialVisibility *pmv)
+{
+ PartialVisibility *n= MEM_dupallocN(pmv);
+ n->vert_map= MEM_dupallocN(pmv->vert_map);
+ n->edge_map= MEM_dupallocN(pmv->edge_map);
+ n->old_edges= MEM_dupallocN(pmv->old_edges);
+ n->old_faces= MEM_dupallocN(pmv->old_faces);
+ return n;
+}
+
+void mesh_pmv_free(PartialVisibility *pv)
+{
+ MEM_freeN(pv->vert_map);
+ MEM_freeN(pv->edge_map);
+ MEM_freeN(pv->old_faces);
+ MEM_freeN(pv->old_edges);
+ MEM_freeN(pv);
+}
+
+void mesh_pmv_revert(Object *ob, Mesh *me)
+{
+ if(me->pv) {
+ unsigned i;
+ MVert *nve, *old_verts;
+
+ /* Reorder vertices */
+ nve= me->mvert;
+ old_verts = MEM_mallocN(sizeof(MVert)*me->pv->totvert,"PMV revert verts");
+ for(i=0; i<me->pv->totvert; ++i)
+ old_verts[i]= nve[me->pv->vert_map[i]];
+
+ /* Restore verts, edges and faces */
+ CustomData_free_layer_active(&me->vdata, CD_MVERT, me->totvert);
+ CustomData_free_layer_active(&me->edata, CD_MEDGE, me->totedge);
+ CustomData_free_layer_active(&me->fdata, CD_MFACE, me->totface);
+
+ CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, old_verts, me->pv->totvert);
+ CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->pv->old_edges, me->pv->totedge);
+ CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->pv->old_faces, me->pv->totface);
+ mesh_update_customdata_pointers(me);
+
+ me->totvert= me->pv->totvert;
+ me->totedge= me->pv->totedge;
+ me->totface= me->pv->totface;
+
+ me->pv->old_edges= NULL;
+ me->pv->old_faces= NULL;
+
+ /* Free maps */
+ MEM_freeN(me->pv->edge_map);
+ me->pv->edge_map= NULL;
+ MEM_freeN(me->pv->vert_map);
+ me->pv->vert_map= NULL;
+
+ DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
+ }
+}
+
+void mesh_pmv_off(Object *ob, Mesh *me)
+{
+ if(ob && me->pv) {
+ mesh_pmv_revert(ob, me);
+ MEM_freeN(me->pv);
+ me->pv= NULL;
+ }
+}