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>2006-12-30 03:51:26 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2006-12-30 03:51:26 +0300
commit04f9d7c60440310e66352d0b9143b878ef95c97a (patch)
treefa6fbcb80efc02b9938557ff8617c9295b19f2c9 /source/blender/src/editmesh.c
parent34286476a58f721c50d2aee54f687f69770b6919 (diff)
Hopefully fixed bug #5437, sculpt - seam selection flushing eats lots of ram on low multires level
This appears to have been caused by the excessive amount of memory that multires was eating up every time an edit operation pushed a new undo copy. Added a hack for multires that allows it to use the same multires data for multiple undo copies until the user actually changes levels (which is when multires data is actually updated.)
Diffstat (limited to 'source/blender/src/editmesh.c')
-rw-r--r--source/blender/src/editmesh.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index f5b0c432b3a..a71c70e0f91 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -1783,6 +1783,10 @@ typedef struct EditSelectionC{
int index;
}EditSelectionC;
+typedef struct EM_MultiresUndo {
+ int users;
+ Multires *mr;
+} EM_MultiresUndo;
typedef struct UndoMesh {
EditVertC *verts;
@@ -1794,7 +1798,7 @@ typedef struct UndoMesh {
RetopoPaintData *retopo_paint_data;
char retopo_mode;
CustomData vdata, fdata;
- Multires *mr;
+ EM_MultiresUndo *mru;
} UndoMesh;
/* for callbacks */
@@ -1810,7 +1814,14 @@ static void free_undoMesh(void *umv)
if(um->retopo_paint_data) retopo_free_paint_data(um->retopo_paint_data);
CustomData_free(&um->vdata, um->totvert);
CustomData_free(&um->fdata, um->totface);
- if(um->mr) multires_free(um->mr);
+ if(um->mru) {
+ --um->mru->users;
+ if(um->mru->users==0) {
+ multires_free(um->mru->mr);
+ um->mru->mr= NULL;
+ MEM_freeN(um->mru);
+ }
+ }
MEM_freeN(um);
}
@@ -1905,7 +1916,24 @@ static void *editMesh_to_undoMesh(void)
um->retopo_paint_data= retopo_paint_data_copy(em->retopo_paint_data);
um->retopo_mode= em->retopo_mode;
- um->mr = get_mesh(G.obedit)->mr ? multires_copy(get_mesh(G.obedit)->mr) : NULL;
+ {
+ Multires *mr= get_mesh(G.obedit)->mr;
+ UndoMesh *prev= undo_editmode_get_prev();
+
+ um->mru= NULL;
+
+ if(mr) {
+ if(prev && prev->mru && prev->mru->mr && prev->mru->mr->current == mr->current) {
+ um->mru= prev->mru;
+ ++um->mru->users;
+ }
+ else {
+ um->mru= MEM_callocN(sizeof(EM_MultiresUndo), "EM_MultiresUndo");
+ um->mru->users= 1;
+ um->mru->mr= multires_copy(mr);
+ }
+ }
+ }
return um;
}
@@ -2022,7 +2050,7 @@ static void undoMesh_to_editMesh(void *umv)
Mesh *me= get_mesh(G.obedit);
multires_free(me->mr);
me->mr= NULL;
- if(um->mr) me->mr= multires_copy(um->mr);
+ if(um->mru && um->mru->mr) me->mr= multires_copy(um->mru->mr);
}
}