[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30856] branches/soc-2010-nicolasbishop: = = Paint ==
Nicholas Bishop
nicholasbishop at gmail.com
Thu Jul 29 02:47:10 CEST 2010
Revision: 30856
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30856
Author: nicholasbishop
Date: 2010-07-29 02:47:10 +0200 (Thu, 29 Jul 2010)
Log Message:
-----------
== Paint ==
* Moved a bunch more sculpt stroke stuff into paint stroke
* Made all the sculpt stroke UI visible for vpaint too
* Most of sculpt's stroke features work in vpaint now
TODO:
* Drag dot for vpaint
* Anchored for vpaint
* Smooth stroke broken
Modified Paths:
--------------
branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_utils.c
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_scene_types.h
Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-07-29 00:44:53 UTC (rev 30855)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py 2010-07-29 00:47:10 UTC (rev 30856)
@@ -920,7 +920,7 @@
col = layout.column()
- if context.sculpt_object:
+ if context.sculpt_object or context.vertex_paint_object:
col.label(text="Stroke Method:")
col.prop(brush, "stroke_method", text="")
@@ -940,7 +940,7 @@
row.active = brush.use_space
row.prop(brush, "spacing", text="Spacing")
- if brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE') and (not brush.use_anchor) and (not brush.restore_mesh):
+ if (context.vertex_paint_object or brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE')) and (not brush.use_anchor) and (not brush.restore_mesh):
col = layout.column()
col.separator()
Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h 2010-07-29 00:44:53 UTC (rev 30855)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h 2010-07-29 00:47:10 UTC (rev 30856)
@@ -51,43 +51,50 @@
/* paint_stroke.c */
typedef struct PaintStroke PaintStroke;
-typedef int (*StrokeGetLocation)(struct bContext *C, struct PaintStroke *stroke, float location[3], float mouse[2]);
+typedef int (*StrokeGetLocation)(struct bContext *C, PaintStroke *stroke, float location[3], float mouse[2]);
typedef int (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
-typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke, struct PointerRNA *itemptr);
-typedef void (*StrokeUpdateSymmetry)(struct bContext *C, struct PaintStroke *stroke,
+typedef void (*StrokeUpdateStep)(struct bContext *C, PaintStroke *stroke, struct PointerRNA *itemptr);
+typedef void (*StrokeUpdateSymmetry)(struct bContext *C, PaintStroke *stroke,
char symmetry, char axis, float angle,
int mirror_symmetry_pass, int radial_symmetry_pass,
float (*symmetry_rot_mat)[4]);
-typedef void (*StrokeBrushAction)(struct bContext *C, struct PaintStroke *stroke);
-typedef void (*StrokeDone)(struct bContext *C, struct PaintStroke *stroke);
+typedef void (*StrokeBrushAction)(struct bContext *C, PaintStroke *stroke);
+typedef void (*StrokeDone)(struct bContext *C, PaintStroke *stroke);
-struct PaintStroke *paint_stroke_new(struct bContext *C,
- StrokeGetLocation get_location,
- StrokeTestStart test_start,
- StrokeUpdateStep update_step,
- StrokeUpdateSymmetry update_symmetry,
- StrokeBrushAction brush_action,
- StrokeDone done);
-void paint_stroke_free(struct PaintStroke *stroke);
+PaintStroke *paint_stroke_new(struct bContext *C,
+ StrokeGetLocation get_location,
+ StrokeTestStart test_start,
+ StrokeUpdateStep update_step,
+ StrokeUpdateSymmetry update_symmetry,
+ StrokeBrushAction brush_action,
+ StrokeDone done);
+void paint_stroke_free(PaintStroke *stroke);
int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
-void paint_stroke_apply_brush(struct bContext *C, struct PaintStroke *stroke, struct Paint *paint);
-float paint_stroke_combined_strength(struct PaintStroke *stroke,
- struct Brush *brush, float dist,
- float co[3], float mask,
- float special_rotation,
- float tex_mouse[2]);
+void paint_stroke_apply_brush(struct bContext *C, PaintStroke *stroke, struct Paint *paint);
+float paint_stroke_combined_strength(PaintStroke *stroke,
+ float dist, float co[3], float mask);
int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
-void *paint_stroke_mode_data(struct PaintStroke *stroke);
-void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data);
+void *paint_stroke_mode_data(PaintStroke *stroke);
+void paint_stroke_set_mode_data(PaintStroke *stroke, void *mode_data);
/* paint stroke cache access */
-struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);
-float paint_stroke_feather(struct PaintStroke *stroke);
-void paint_stroke_symmetry_location(struct PaintStroke *stroke, float loc[3]);
-float paint_stroke_radius(struct PaintStroke *stroke);
-void paint_stroke_projection_mat(struct PaintStroke *stroke, float (**pmat)[4]);
+struct ViewContext *paint_stroke_view_context(PaintStroke *stroke);
+float paint_stroke_feather(PaintStroke *stroke);
+void paint_stroke_mouse_location(PaintStroke *stroke, float mouse[2]);
+void paint_stroke_initial_mouse_location(PaintStroke *stroke, float initial_mouse[2]);
+void paint_stroke_location(PaintStroke *stroke, float location[3]);
+float paint_stroke_pressure(PaintStroke *stroke);
+float paint_stroke_radius(PaintStroke *stroke);
+float paint_stroke_radius_squared(PaintStroke *stroke);
+void paint_stroke_symmetry_location(PaintStroke *stroke, float loc[3]);
+int paint_stroke_first_dab(PaintStroke *stroke);
+/* paint stroke modifiers */
+void paint_stroke_set_modifier_use_original_location(PaintStroke *stroke);
+void paint_stroke_set_modifier_initial_radius_factor(PaintStroke *stroke, float initial_radius_factor);
+void paint_stroke_set_modifier_use_original_texture_coords(PaintStroke *stroke);
+
typedef struct {
void *mode_data;
struct Object *ob;
@@ -96,7 +103,7 @@
float dist;
int original;
} PaintStrokeRaycastData;
-int paint_stroke_get_location(struct bContext *C, struct PaintStroke *stroke,
+int paint_stroke_get_location(struct bContext *C, PaintStroke *stroke,
BLI_pbvh_HitOccludedCallback hit_cb, void *mode_data,
float out[3], float mouse[2], int original);
@@ -108,8 +115,7 @@
float location[3];
float dist;
} PaintStrokeTest;
-void paint_stroke_test_init(PaintStrokeTest *test, float loc[3],
- float radius_squared);
+void paint_stroke_test_init(PaintStrokeTest *test, PaintStroke *stroke);
int paint_stroke_test(PaintStrokeTest *test, float co[3]);
int paint_stroke_test_sq(PaintStrokeTest *test, float co[3]);
int paint_stroke_test_fast(PaintStrokeTest *test, float co[3]);
@@ -165,8 +171,7 @@
int facemask_paint_poll(struct bContext *C);
-float paint_calc_object_space_radius(struct Object *ob,
- struct ViewContext *vc,
+float paint_calc_object_space_radius(struct ViewContext *vc,
float center[3],
float pixel_radius);
@@ -199,10 +204,9 @@
void undo_paint_push_end(int type);
/* paint_mask.c */
-void paintmask_brush_apply(struct Paint *paint, struct PaintStroke *stroke,
- struct Object *ob, struct PBVHNode **nodes,
- int totnode, float location[3],
- float bstrength, float radius3d);
+void paintmask_brush_apply(struct Paint *paint, PaintStroke *stroke,
+ struct PBVHNode **nodes,
+ int totnode, float bstrength);
void PAINT_OT_mask_layer_add(struct wmOperatorType *ot);
void PAINT_OT_mask_layer_remove(struct wmOperatorType *ot);
Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c 2010-07-29 00:44:53 UTC (rev 30855)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c 2010-07-29 00:47:10 UTC (rev 30856)
@@ -72,25 +72,18 @@
return 0;
}
-void paintmask_brush_apply(Paint *paint, PaintStroke *stroke, Object *ob, PBVHNode **nodes, int totnode,
- float location[3], float bstrength, float radius3d)
+void paintmask_brush_apply(Paint *paint, PaintStroke *stroke, PBVHNode **nodes, int totnode,
+ float bstrength)
{
- Brush *brush = paint_brush(paint);
- ViewContext *vc;
- float (*pmat)[4];
- float tex_mouse[2] = {0,0}; /* TODO */
- float radius_squared = radius3d*radius3d;
+ Object *ob = paint_stroke_view_context(stroke)->obact;
int n;
- vc = paint_stroke_view_context(stroke);
- paint_stroke_projection_mat(stroke, &pmat);
-
for(n=0; n<totnode; n++) {
PBVHVertexIter vd;
PaintStrokeTest test;
/* XXX: sculpt_undo_push_node(ob, nodes[n]); */
- paint_stroke_test_init(&test, location, radius_squared);
+ paint_stroke_test_init(&test, stroke);
BLI_pbvh_vertex_iter_begin(ob->paint->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
/* TODO: should add a mask layer if needed */
@@ -98,12 +91,10 @@
if(paint_stroke_test(&test, vd.co)) {
float fade;
- fade = brush_tex_strength(vc, pmat,
- brush, vd.co,
- 0, test.dist,
- brush_size(brush),
- radius3d, 0,
- tex_mouse) *
+ fade = paint_stroke_combined_strength(stroke,
+ test.dist,
+ vd.co,
+ 0) *
bstrength;
*vd.mask_active += fade;
Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c 2010-07-29 00:44:53 UTC (rev 30855)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c 2010-07-29 00:47:10 UTC (rev 30856)
@@ -41,8 +41,8 @@
#include "WM_types.h"
#include "BLI_math.h"
+#include "BLI_rand.h"
-
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -67,13 +67,22 @@
float project_mat[4][4];
bglMats mats;
Brush *brush;
+ /* brush location (object space) */
+ float location[3], symmetry_location[3];
+ /* screen-space brush location */
+ float mouse[2], initial_mouse[2], last_mouse_position[2];
/* not always the same as brush_size() */
int pixel_radius;
- /* projected brush radius */
- float radius, radius_squared;
- /* brush location (object space) */
- float location[3], symmetry_location[3];
-
+ /* tablet pressure, or 1 if using mouse */
+ float pressure;
+ /* 3d brush radius */
+ float radius, radius_squared, initial_radius;
+ /* previous location of updating rake rotation */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list