[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18554] branches/blender2.5/blender/source /blender: Make sculpt data more like vpaint/weightpaint.
Nicholas Bishop
nicholasbishop at gmail.com
Sat Jan 17 17:58:05 CET 2009
Revision: 18554
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18554
Author: nicholasbishop
Date: 2009-01-17 17:58:05 +0100 (Sat, 17 Jan 2009)
Log Message:
-----------
Make sculpt data more like vpaint/weightpaint. SculptData is now in scene->toolsettings, moved the RNA to reflect that too.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/blenkernel/BKE_scene.h
branches/blender2.5/blender/source/blender/blenkernel/BKE_sculpt.h
branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c
branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c
branches/blender2.5/blender/source/blender/editors/sculpt/sculpt_intern.h
branches/blender2.5/blender/source/blender/editors/sculpt/stroke.c
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c
branches/blender2.5/blender/source/blender/makesdna/DNA_scene_types.h
branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_scene.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_scene.h 2009-01-17 16:11:12 UTC (rev 18553)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_scene.h 2009-01-17 16:58:05 UTC (rev 18554)
@@ -37,7 +37,6 @@
struct Base;
struct AviCodecData;
struct QuicktimeCodecData;
-struct SculptData;
struct RenderData;
/* note; doesn't work when scene is empty */
Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_sculpt.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_sculpt.h 2009-01-17 16:11:12 UTC (rev 18553)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_sculpt.h 2009-01-17 16:58:05 UTC (rev 18554)
@@ -33,7 +33,7 @@
struct NumInput;
struct RadialControl;
struct Scene;
-struct SculptData;
+struct Sculpt;
struct SculptSession;
struct StrokeCache;
@@ -65,10 +65,7 @@
struct StrokeCache *cache;
} SculptSession;
-void sculptdata_init(struct Scene *sce);
-void sculptdata_free(struct Scene *sce);
-void sculptsession_free(struct Scene *sce);
+void sculptsession_free(struct Sculpt *sculpt);
void sculpt_vertexusers_free(struct SculptSession *ss);
-void sculpt_reset_curve(struct SculptData *sd);
#endif
Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c 2009-01-17 16:11:12 UTC (rev 18553)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c 2009-01-17 16:58:05 UTC (rev 18554)
@@ -174,6 +174,10 @@
MEM_freeN(sce->toolsettings->vpaint);
if(sce->toolsettings->wpaint)
MEM_freeN(sce->toolsettings->wpaint);
+ if(sce->toolsettings->sculpt) {
+ sculptsession_free(sce->toolsettings->sculpt);
+ MEM_freeN(sce->toolsettings->sculpt);
+ }
MEM_freeN(sce->toolsettings);
sce->toolsettings = NULL;
@@ -188,8 +192,6 @@
ntreeFreeTree(sce->nodetree);
MEM_freeN(sce->nodetree);
}
-
- sculptdata_free(sce);
}
Scene *add_scene(char *name)
@@ -304,8 +306,6 @@
BLI_init_rctf(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
sce->r.osa= 8;
- sculptdata_init(sce);
-
/* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
scene_add_render_layer(sce);
@@ -653,60 +653,6 @@
srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z;
}
-/* Initialize 'permanent' sculpt data that is saved with file kept after
- switching out of sculptmode. */
-void sculptdata_init(Scene *sce)
-{
- SculptData *sd;
-
- if(!sce)
- return;
-
- sd= &sce->sculptdata;
-
- memset(sd, 0, sizeof(SculptData));
-
- /* XXX: create preset brushes here
- sd->drawbrush.size = sd->smoothbrush.size = sd->pinchbrush.size =
- sd->inflatebrush.size = sd->grabbrush.size =
- sd->layerbrush.size = sd->flattenbrush.size = 50;
- sd->drawbrush.strength = sd->smoothbrush.strength =
- sd->pinchbrush.strength = sd->inflatebrush.strength =
- sd->grabbrush.strength = sd->layerbrush.strength =
- sd->flattenbrush.strength = 25;
- sd->drawbrush.dir = sd->pinchbrush.dir = sd->inflatebrush.dir = sd->layerbrush.dir= 1;
- sd->drawbrush.flag = sd->smoothbrush.flag =
- sd->pinchbrush.flag = sd->inflatebrush.flag =
- sd->layerbrush.flag = sd->flattenbrush.flag = 0;
- sd->drawbrush.view= 0;
- sd->brush_type= DRAW_BRUSH;
- sd->texact= -1;
- sd->texfade= 1;
- sd->averaging= 1;
- sd->texsep= 0;
- sd->texrept= SCULPTREPT_DRAG;
- sd->flags= SCULPT_DRAW_BRUSH;
- sd->tablet_size=3;
- sd->tablet_strength=10;
- sd->rake=0;*/
-}
-
-void sculptdata_free(Scene *sce)
-{
- SculptData *sd= &sce->sculptdata;
- int a;
-
- sculptsession_free(sce);
-
- for(a=0; a<MAX_MTEX; a++) {
- MTex *mtex= sd->mtex[a];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- }
- }
-}
-
void sculpt_vertexusers_free(SculptSession *ss)
{
if(ss && ss->vertex_users){
@@ -718,9 +664,9 @@
}
}
-void sculptsession_free(Scene *sce)
+void sculptsession_free(Sculpt *sculpt)
{
- SculptSession *ss= sce->sculptdata.session;
+ SculptSession *ss= sculpt->session;
if(ss) {
if(ss->projverts)
MEM_freeN(ss->projverts);
@@ -732,7 +678,7 @@
if(ss->texcache)
MEM_freeN(ss->texcache);
MEM_freeN(ss);
- sce->sculptdata.session= NULL;
+ sculpt->session= NULL;
}
}
Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2009-01-17 16:11:12 UTC (rev 18553)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2009-01-17 16:58:05 UTC (rev 18554)
@@ -3505,7 +3505,6 @@
Base *base, *next;
Sequence *seq;
SceneRenderLayer *srl;
- int a;
sce= main->scene.first;
while(sce) {
@@ -3521,13 +3520,6 @@
sce->toolsettings->imapaint.brush=
newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.brush);
- /* Sculptdata textures */
- for(a=0; a<MAX_MTEX; ++a) {
- MTex *mtex= sce->sculptdata.mtex[a];
- if(mtex)
- mtex->tex= newlibadr_us(fd, sce->id.lib, mtex->tex);
- }
-
for(base= sce->base.first; base; base= next) {
next= base->next;
@@ -3593,7 +3585,6 @@
Editing *ed;
Sequence *seq;
MetaStack *ms;
- int a;
sce->theDag = NULL;
sce->dagisvalid = 0;
@@ -3610,11 +3601,9 @@
if(sce->toolsettings) {
sce->toolsettings->vpaint= newdataadr(fd, sce->toolsettings->vpaint);
sce->toolsettings->wpaint= newdataadr(fd, sce->toolsettings->wpaint);
+ if(sce->toolsettings->sculpt)
+ sce->toolsettings->sculpt->session= NULL;
}
- sce->sculptdata.session= NULL;
- /* SculptData textures */
- for(a=0; a<MAX_MTEX; ++a)
- sce->sculptdata.mtex[a]= newdataadr(fd,sce->sculptdata.mtex[a]);
if(sce->ed) {
ListBase *old_seqbasep= &((Editing *)sce->ed)->seqbase;
Modified: branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c 2009-01-17 16:11:12 UTC (rev 18553)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c 2009-01-17 16:58:05 UTC (rev 18554)
@@ -1477,9 +1477,6 @@
if(sce->toolsettings->wpaint)
writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->wpaint);
- for(a=0; a<MAX_MTEX; ++a)
- writestruct(wd, DATA, "MTex", 1, sce->sculptdata.mtex[a]);
-
ed= sce->ed;
if(ed) {
writestruct(wd, DATA, "Editing", 1, ed);
Modified: branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-17 16:11:12 UTC (rev 18553)
+++ branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c 2009-01-17 16:58:05 UTC (rev 18554)
@@ -276,7 +276,7 @@
shrink the brush. Skipped for grab brush because only the first mouse down
size is used, which is small if the user has just touched the pen to the
tablet */
-static char brush_size(SculptData *sd)
+static char brush_size(Sculpt *sd)
{
float size= sd->brush->size;
#if 0
@@ -298,7 +298,7 @@
/* Return modified brush strength. Includes the direction of the brush, positive
values pull vertices, negative values push. Uses tablet pressure and a
special multiplier found experimentally to scale the strength factor. */
-static float brush_strength(SculptData *sd, StrokeCache *cache)
+static float brush_strength(Sculpt *sd, StrokeCache *cache)
{
float dir= sd->brush->flag & BRUSH_DIR_IN ? -1 : 1;
float pressure= 1;
@@ -350,7 +350,7 @@
}
}
-static void sculpt_axislock(SculptData *sd, float *co)
+static void sculpt_axislock(Sculpt *sd, float *co)
{
if (sd->flags & (SCULPT_LOCK_X|SCULPT_LOCK_Y|SCULPT_LOCK_Z)) return;
/* XXX: if(G.vd->twmode == V3D_MANIP_LOCAL) { */
@@ -385,7 +385,7 @@
/* Currently only for the draw brush; finds average normal for all active
vertices */
-static void calc_area_normal(SculptData *sd, float out[3], const ListBase* active_verts)
+static void calc_area_normal(Sculpt *sd, float out[3], const ListBase* active_verts)
{
StrokeCache *cache = sd->session->cache;
ActiveData *node = active_verts->first;
@@ -419,7 +419,7 @@
Normalize(out);
}
-static void do_draw_brush(SculptData *sd, SculptSession *ss, const ListBase* active_verts)
+static void do_draw_brush(Sculpt *sd, SculptSession *ss, const ListBase* active_verts)
{
float area_normal[3];
ActiveData *node= active_verts->first;
@@ -517,7 +517,7 @@
}
}
-static void do_grab_brush(SculptData *sd, SculptSession *ss)
+static void do_grab_brush(Sculpt *sd, SculptSession *ss)
{
ActiveData *node= ss->cache->grab_active_verts[ss->cache->symmetry].first;
float add[3];
@@ -539,7 +539,7 @@
}
-static void do_layer_brush(SculptData *sd, SculptSession *ss, const ListBase *active_verts)
+static void do_layer_brush(Sculpt *sd, SculptSession *ss, const ListBase *active_verts)
{
float area_normal[3];
ActiveData *node= active_verts->first;
@@ -623,7 +623,7 @@
VecMulf(co, 1.0f / FLATTEN_SAMPLE_SIZE);
}
-static void do_flatten_brush(SculptData *sd, SculptSession *ss, const ListBase *active_verts)
+static void do_flatten_brush(Sculpt *sd, SculptSession *ss, const ListBase *active_verts)
{
ActiveData *node= active_verts->first;
/* area_normal and cntr define the plane towards which vertices are squashed */
@@ -680,17 +680,19 @@
}
/* Use the warpfac field in MTex to store a rotation value for sculpt textures. Value is in degrees */
-static float sculpt_tex_angle(SculptData *sd)
+static float sculpt_tex_angle(Sculpt *sd)
{
- if(sd->texact!=-1 && sd->mtex[sd->texact])
- return sd->mtex[sd->texact]->warpfac;
+ Brush *br = sd->brush;
+ if(br->texact!=-1 && br->mtex[br->texact])
+ return br->mtex[br->texact]->warpfac;
return 0;
}
-static void set_tex_angle(SculptData *sd, const float f)
+static void set_tex_angle(Sculpt *sd, const float f)
{
- if(sd->texact != -1 && sd->mtex[sd->texact])
- sd->mtex[sd->texact]->warpfac = f;
+ Brush *br = sd->brush;
+ if(br->texact != -1 && br->mtex[br->texact])
+ br->mtex[br->texact]->warpfac = f;
}
static float to_rad(const float deg)
@@ -741,12 +743,13 @@
}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list