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>2009-08-15 22:58:01 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2009-08-15 22:58:01 +0400
commitbe1efd74d120068a9a650feddf512b50e5e6c2b8 (patch)
treee1232b3256b84165f9194fe5287bf620cf174c18 /source/blender/blenkernel
parente63d4d2bea06075ef666d613d1136236bb09ae79 (diff)
2.5/Sculpt:
* Made sculpt mode local to object. * This also fixes loading files from 2.4x saved in sculptmode Touched a lot of things here, let me know if anything breaks TODO: * The other paint modes should be converted as well
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_global.h1
-rw-r--r--source/blender/blenkernel/BKE_sculpt.h7
-rw-r--r--source/blender/blenkernel/intern/brush.c3
-rw-r--r--source/blender/blenkernel/intern/object.c34
-rw-r--r--source/blender/blenkernel/intern/scene.c33
5 files changed, 39 insertions, 39 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 315fe2a39cb..dd50bf33869 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -122,7 +122,6 @@ typedef struct Global {
/* #define G_NOFROZEN (1 << 17) also removed */
#define G_GREASEPENCIL (1 << 17)
-#define G_SCULPTMODE (1 << 29)
#define G_PARTICLEEDIT (1 << 30)
/* #define G_AUTOMATKEYS (1 << 30) also removed */
diff --git a/source/blender/blenkernel/BKE_sculpt.h b/source/blender/blenkernel/BKE_sculpt.h
index 54cafc984a6..9e5647a8775 100644
--- a/source/blender/blenkernel/BKE_sculpt.h
+++ b/source/blender/blenkernel/BKE_sculpt.h
@@ -33,7 +33,7 @@
struct MFace;
struct MultireModifierData;
struct MVert;
-struct Sculpt;
+struct Object;
struct StrokeCache;
typedef struct SculptSession {
@@ -63,13 +63,10 @@ typedef struct SculptSession {
float (*mesh_co_orig)[3]; /* Copy of the mesh vertices' locations */
float *layer_disps; /* Displacements for each vertex */
- void *cursor; /* wm handle */
-
struct SculptStroke *stroke;
-
struct StrokeCache *cache;
} SculptSession;
-void sculptsession_free(struct Sculpt *sculpt);
+void free_sculptsession(SculptSession **);
#endif
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 5dbef017f9d..eddca8d0073 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -35,6 +35,7 @@
#include "DNA_brush_types.h"
#include "DNA_color_types.h"
#include "DNA_image_types.h"
+#include "DNA_object_types.h"
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
#include "DNA_windowmanager_types.h"
@@ -187,7 +188,7 @@ void make_local_brush(Brush *brush)
Brush **current_brush_source(Scene *sce)
{
- if(G.f & G_SCULPTMODE)
+ if(sce->basact && sce->basact->object->mode & OB_MODE_SCULPT)
return &sce->toolsettings->sculpt->brush;
else if(G.f & G_VERTEXPAINT)
return &sce->toolsettings->vpaint->brush;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 9423f80cba2..0e45aedc3ed 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -107,6 +107,7 @@
#include "BKE_sca.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
+#include "BKE_sculpt.h"
#include "BKE_softbody.h"
#include "LBM_fluidsim.h"
@@ -222,6 +223,34 @@ void object_free_display(Object *ob)
freedisplist(&ob->disp);
}
+void free_sculptsession(SculptSession **ssp)
+{
+ if(ssp && *ssp) {
+ SculptSession *ss = *ssp;
+ if(ss->projverts)
+ MEM_freeN(ss->projverts);
+
+ if(ss->fmap)
+ MEM_freeN(ss->fmap);
+
+ if(ss->fmap_mem)
+ MEM_freeN(ss->fmap_mem);
+
+ if(ss->texcache)
+ MEM_freeN(ss->texcache);
+
+ if(ss->layer_disps)
+ MEM_freeN(ss->layer_disps);
+
+ if(ss->mesh_co_orig)
+ MEM_freeN(ss->mesh_co_orig);
+
+ MEM_freeN(ss);
+
+ *ssp = NULL;
+ }
+}
+
/* do not free object itself */
void free_object(Object *ob)
{
@@ -276,6 +305,8 @@ void free_object(Object *ob)
if(ob->soft) sbFree(ob->soft);
if(ob->bsoft) bsbFree(ob->bsoft);
if(ob->gpulamp.first) GPU_lamp_free(ob);
+
+ free_sculptsession(&ob->sculpt);
}
static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin)
@@ -1211,6 +1242,9 @@ Object *copy_object(Object *ob)
copy_defgroups(&obn->defbase, &ob->defbase);
copy_constraints(&obn->constraints, &ob->constraints);
+ obn->mode = 0;
+ obn->sculpt = NULL;
+
/* increase user numbers */
id_us_plus((ID *)obn->data);
id_us_plus((ID *)obn->dup_group);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 83b1976aabe..8e889859317 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -77,7 +77,6 @@
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_scene.h"
-#include "BKE_sculpt.h"
#include "BKE_sequence.h"
#include "BKE_world.h"
#include "BKE_utildefines.h"
@@ -174,7 +173,6 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type)
}
if(ts->sculpt) {
ts->sculpt= MEM_dupallocN(ts->sculpt);
- ts->sculpt->session= NULL;
id_us_plus((ID *)ts->sculpt->brush);
}
@@ -277,10 +275,8 @@ void free_scene(Scene *sce)
MEM_freeN(sce->toolsettings->vpaint);
if(sce->toolsettings->wpaint)
MEM_freeN(sce->toolsettings->wpaint);
- if(sce->toolsettings->sculpt) {
- sculptsession_free(sce->toolsettings->sculpt);
+ if(sce->toolsettings->sculpt)
MEM_freeN(sce->toolsettings->sculpt);
- }
MEM_freeN(sce->toolsettings);
sce->toolsettings = NULL;
@@ -808,33 +804,6 @@ void scene_add_render_layer(Scene *sce)
srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z;
}
-void sculptsession_free(Sculpt *sculpt)
-{
- SculptSession *ss= sculpt->session;
- if(ss) {
- if(ss->projverts)
- MEM_freeN(ss->projverts);
-
- if(ss->fmap)
- MEM_freeN(ss->fmap);
-
- if(ss->fmap_mem)
- MEM_freeN(ss->fmap_mem);
-
- if(ss->texcache)
- MEM_freeN(ss->texcache);
-
- if(ss->layer_disps)
- MEM_freeN(ss->layer_disps);
-
- if(ss->mesh_co_orig)
- MEM_freeN(ss->mesh_co_orig);
-
- MEM_freeN(ss);
- sculpt->session= NULL;
- }
-}
-
/* render simplification */
int get_render_subsurf_level(RenderData *r, int lvl)