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
path: root/source
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2007-12-27 02:08:00 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2007-12-27 02:08:00 +0300
commitfc2cf13fc6b66caf09e610a83b793fc8e7da09a1 (patch)
treecc8d06fa67de0b3eddd7765cf482158b3973eeb8 /source
parent015007beafeaeec09ba8a7fc859acc40ba6b8b16 (diff)
== Sculpt ==
Fixed a memory leak when using the interactive brush resize tool.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_sculpt.h29
-rw-r--r--source/blender/blenkernel/intern/scene.c9
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/include/BDR_sculptmode.h21
-rw-r--r--source/blender/src/sculptmode.c13
5 files changed, 48 insertions, 25 deletions
diff --git a/source/blender/blenkernel/BKE_sculpt.h b/source/blender/blenkernel/BKE_sculpt.h
index 61b8dc071aa..d539bcf5e8c 100644
--- a/source/blender/blenkernel/BKE_sculpt.h
+++ b/source/blender/blenkernel/BKE_sculpt.h
@@ -27,6 +27,34 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#ifndef BKE_SCULPT_H
+#define BKE_SCULPT_H
+
+struct NumInput;
+struct Scene;
+struct SculptData;
+struct SculptSession;
+
+typedef enum PropsetMode {
+ PropsetNone = 0,
+ PropsetSize,
+ PropsetStrength,
+ PropsetTexRot
+} PropsetMode;
+
+typedef struct PropsetData {
+ PropsetMode mode;
+ unsigned int tex;
+ short origloc[2];
+ float *texdata;
+
+ short origsize;
+ char origstrength;
+ float origtexrot;
+
+ struct NumInput *num;
+} PropsetData;
+
typedef struct SculptSession {
struct ProjVert *projverts;
@@ -62,3 +90,4 @@ void sculptsession_free(struct Scene *sce);
void sculpt_vertexusers_free(struct SculptSession *ss);
void sculpt_reset_curve(struct SculptData *sd);
+#endif
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 88dca65f594..47640ad07ae 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -659,6 +659,15 @@ void sculptsession_free(Scene *sce)
MEM_freeN(ss->projverts);
if(ss->mats)
MEM_freeN(ss->mats);
+
+ if(ss->propset) {
+ if(ss->propset->texdata)
+ MEM_freeN(ss->propset->texdata);
+ if(ss->propset->num)
+ MEM_freeN(ss->propset->num);
+ MEM_freeN(ss->propset);
+ }
+
sculpt_vertexusers_free(ss);
if(ss->texcache)
MEM_freeN(ss->texcache);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index f8f0395300c..043febbbc75 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -136,6 +136,7 @@
#include "BKE_sca.h" // for init_actuator
#include "BKE_scene.h"
#include "BKE_softbody.h" // sbNew()
+#include "BKE_sculpt.h"
#include "BKE_texture.h" // for open_plugin_tex
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
#include "BKE_idprop.h"
diff --git a/source/blender/include/BDR_sculptmode.h b/source/blender/include/BDR_sculptmode.h
index 884f1000b1f..e15c1fb7063 100644
--- a/source/blender/include/BDR_sculptmode.h
+++ b/source/blender/include/BDR_sculptmode.h
@@ -32,6 +32,7 @@
#include "DNA_listBase.h"
#include "DNA_vec_types.h"
+#include "BKE_sculpt.h"
#include "transform.h"
struct uiBlock;
@@ -47,26 +48,6 @@ struct ScrArea;
struct SculptData;
struct SculptStroke;
-typedef enum PropsetMode {
- PropsetNone = 0,
- PropsetSize,
- PropsetStrength,
- PropsetTexRot
-} PropsetMode;
-
-typedef struct PropsetData {
- PropsetMode mode;
- unsigned int tex;
- short origloc[2];
- float *texdata;
-
- short origsize;
- char origstrength;
- float origtexrot;
-
- NumInput num;
-} PropsetData;
-
struct SculptSession *sculpt_session(void);
struct SculptData *sculpt_data(void);
diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c
index 64f9ad0283e..f3bfb645315 100644
--- a/source/blender/src/sculptmode.c
+++ b/source/blender/src/sculptmode.c
@@ -1313,6 +1313,7 @@ void sculptmode_propset_end(SculptSession *ss, int cancel)
set_tex_angle(pd->origtexrot);
}
glDeleteTextures(1, &pd->tex);
+ MEM_freeN(pd->num);
MEM_freeN(pd->texdata);
MEM_freeN(pd);
ss->propset= NULL;
@@ -1353,7 +1354,9 @@ void sculptmode_propset_init(PropsetMode mode)
sculptmode_propset_calctex();
- pd->num.idx_max= 0;
+ if(!pd->num)
+ pd->num = MEM_callocN(sizeof(NumInput), "propset numinput");
+ pd->num->idx_max= 0;
}
pd->mode= mode;
@@ -1391,11 +1394,11 @@ void sculptmode_propset(unsigned short event)
BrushData *brush= sculptmode_brush();
char valset= 0;
- handleNumInput(&pd->num, event);
+ handleNumInput(pd->num, event);
- if(hasNumInput(&pd->num)) {
+ if(hasNumInput(pd->num)) {
float val;
- applyNumInput(&pd->num, &val);
+ applyNumInput(pd->num, &val);
if(pd->mode==PropsetSize)
brush->size= val;
else if(pd->mode==PropsetStrength)
@@ -1409,7 +1412,7 @@ void sculptmode_propset(unsigned short event)
switch(event) {
case MOUSEX:
case MOUSEY:
- if(!hasNumInput(&pd->num)) {
+ if(!hasNumInput(pd->num)) {
char ctrl= G.qual & LR_CTRLKEY;
getmouseco_areawin(mouse);
tmp[0]= pd->origloc[0]-mouse[0];