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-01-07 07:38:30 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2009-01-07 07:38:30 +0300
commita811d802dd96a2dc93885a1dab46004084386030 (patch)
tree42e09725613129f591b0b97f4d06d931bfd89ab6 /source/blender/blenkernel
parent23e3fdb28b1d0c7d7d8992c2835bd492daef528c (diff)
Changes/cleanup for sculptdata and brushes. Summary:
* Removed texfade, wasn't a very useful option (same result can be created with the falloff curve) * Removed CurveMapping from sculptdata, moved instead to Brush * Removed rake field from sculptdata, moved to Brush.flag * Moved Anchored flag from sculpt to Brush, same for direction field * Removed BrushData, replaced usages with the regular Brush type * Removed hardcoded brushes and brush_type from sculptdata, replaced with a pointer to the current Brush * Made sculpt tool type settable in Brush * Changed symmetry and axis lock fields to flags
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_brush.h8
-rw-r--r--source/blender/blenkernel/intern/brush.c37
-rw-r--r--source/blender/blenkernel/intern/scene.c36
3 files changed, 47 insertions, 34 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 398d203709f..07ca975c46f 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -51,6 +51,14 @@ int brush_texture_delete(struct Brush *brush);
int brush_clone_image_set_nr(struct Brush *brush, int nr);
int brush_clone_image_delete(struct Brush *brush);
+/* brush curve */
+typedef enum {
+ BRUSH_PRESET_SHARP,
+ BRUSH_PRESET_SMOOTH,
+ BRUSH_PRESET_MAX
+} BrushCurvePreset;
+void brush_curve_preset(struct Brush *b, BrushCurvePreset preset);
+
/* sampling */
float brush_sample_falloff(struct Brush *brush, float dist);
float brush_sample_falloff_noalpha(struct Brush *brush, float dist);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 021f76fd2f1..f8301943822 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -32,6 +32,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_brush_types.h"
+#include "DNA_color_types.h"
#include "DNA_image_types.h"
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
@@ -114,6 +115,8 @@ void free_brush(Brush *brush)
MEM_freeN(mtex);
}
}
+
+ curvemapping_free(brush->curve);
}
void make_local_brush(Brush *brush)
@@ -217,6 +220,40 @@ void brush_toggled_fake_user(Brush *brush)
}
}
+
+void sculpt_preset_curve(Brush *b, BrushCurvePreset preset)
+{
+ CurveMap *cm = NULL;
+
+ if(!b->curve)
+ b->curve = curvemapping_add(1, 0, 0, 1, 1);
+
+ cm = b->curve->cm;
+
+ if(cm->curve)
+ MEM_freeN(cm->curve);
+
+ if(preset == BRUSH_PRESET_SHARP) {
+ cm->curve= MEM_callocN(3*sizeof(CurveMapPoint), "curve points");
+ cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+ cm->totpoint= 3;
+ cm->curve[0].x= 0;
+ cm->curve[0].y= 1;
+ cm->curve[1].x= 0.33;
+ cm->curve[1].y= 0.33;
+ cm->curve[2].x= 1;
+ cm->curve[2].y= 0;
+ }
+ else if(preset == BRUSH_PRESET_SMOOTH) {
+ // XXX: todo
+ }
+ else if(preset == BRUSH_PRESET_MAX) {
+ // XXX: todo
+ }
+
+ curvemapping_changed(b->curve, 0);
+}
+
int brush_texture_set_nr(Brush *brush, int nr)
{
ID *idtest, *id=NULL;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 49597f49759..91783a3c85f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -625,13 +625,9 @@ void sculptdata_init(Scene *sce)
sd= &sce->sculptdata;
- if(sd->cumap) {
- curvemapping_free(sd->cumap);
- sd->cumap = NULL;
- }
-
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;
@@ -653,8 +649,7 @@ void sculptdata_init(Scene *sce)
sd->flags= SCULPT_DRAW_BRUSH;
sd->tablet_size=3;
sd->tablet_strength=10;
- sd->rake=0;
- sculpt_reset_curve(sd);
+ sd->rake=0;*/
}
void sculptdata_free(Scene *sce)
@@ -671,9 +666,6 @@ void sculptdata_free(Scene *sce)
MEM_freeN(mtex);
}
}
-
- curvemapping_free(sd->cumap);
- sd->cumap = NULL;
}
void sculpt_vertexusers_free(SculptSession *ss)
@@ -707,30 +699,6 @@ void sculptsession_free(Scene *sce)
}
}
-void sculpt_reset_curve(SculptData *sd)
-{
- CurveMap *cm = NULL;
-
- if(!sd->cumap)
- sd->cumap = curvemapping_add(1, 0, 0, 1, 1);
-
- cm = sd->cumap->cm;
-
- if(cm->curve)
- MEM_freeN(cm->curve);
- cm->curve= MEM_callocN(3*sizeof(CurveMapPoint), "curve points");
- cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
- cm->totpoint= 3;
- cm->curve[0].x= 0;
- cm->curve[0].y= 1;
- cm->curve[1].x= 0.33;
- cm->curve[1].y= 0.33;
- cm->curve[2].x= 1;
- cm->curve[2].y= 0;
-
- curvemapping_changed(sd->cumap, 0);
-}
-
/* render simplification */
int get_render_subsurf_level(RenderData *r, int lvl)