[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17728] branches/projection-paint/source/ blender: * Patch from Michael Fox to set the normal angle ( was fixed at 80 before)
Campbell Barton
ideasman42 at gmail.com
Sat Dec 6 14:42:56 CET 2008
Revision: 17728
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17728
Author: campbellbarton
Date: 2008-12-06 14:42:55 +0100 (Sat, 06 Dec 2008)
Log Message:
-----------
* Patch from Michael Fox to set the normal angle (was fixed at 80 before)
* Fixed another face clipping bug (some artifacts still when using screen aligned faces)
* Removed Soften and Warp buttons on the panit panel since they are not used for projection painting
* added do_versions to initialize bleed and normal values
Modified Paths:
--------------
branches/projection-paint/source/blender/blenkernel/BKE_blender.h
branches/projection-paint/source/blender/blenloader/intern/readfile.c
branches/projection-paint/source/blender/makesdna/DNA_scene_types.h
branches/projection-paint/source/blender/src/buttons_editing.c
branches/projection-paint/source/blender/src/imagepaint.c
Modified: branches/projection-paint/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/projection-paint/source/blender/blenkernel/BKE_blender.h 2008-12-06 10:25:51 UTC (rev 17727)
+++ branches/projection-paint/source/blender/blenkernel/BKE_blender.h 2008-12-06 13:42:55 UTC (rev 17728)
@@ -41,7 +41,7 @@
struct MemFile;
#define BLENDER_VERSION 248
-#define BLENDER_SUBVERSION 1
+#define BLENDER_SUBVERSION 2
#define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15
Modified: branches/projection-paint/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/projection-paint/source/blender/blenloader/intern/readfile.c 2008-12-06 10:25:51 UTC (rev 17727)
+++ branches/projection-paint/source/blender/blenloader/intern/readfile.c 2008-12-06 13:42:55 UTC (rev 17728)
@@ -8007,6 +8007,17 @@
}
}
+ if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 2)) {
+ Scene *sce;
+
+ /* Note, these will need to be added for painting */
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ sce->toolsettings->imapaint.seam_bleed = 2;
+ sce->toolsettings->imapaint.normal_angle = 80;
+ }
+ }
+
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
Modified: branches/projection-paint/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/projection-paint/source/blender/makesdna/DNA_scene_types.h 2008-12-06 10:25:51 UTC (rev 17727)
+++ branches/projection-paint/source/blender/makesdna/DNA_scene_types.h 2008-12-06 13:42:55 UTC (rev 17728)
@@ -347,8 +347,8 @@
short flag, tool;
/* for projection painting only - todo - use flags */
- float seam_bleed;
- int clone_layer, pad;
+ char seam_bleed,normal_angle;
+ short clone_layer;
} ImagePaintSettings;
typedef struct ParticleBrushData {
@@ -805,9 +805,8 @@
/* projection painting only */
#define IMAGEPAINT_PROJECT_XRAY 8
#define IMAGEPAINT_PROJECT_BACKFACE 16
-#define IMAGEPAINT_PROJECT_IGNORE_SEAMS 32
-#define IMAGEPAINT_PROJECT_CLONE_LAYER 64
-#define IMAGEPAINT_PROJECT_FLAT 128
+#define IMAGEPAINT_PROJECT_CLONE_LAYER 32
+#define IMAGEPAINT_PROJECT_FLAT 64
/* toolsettings->uvcalc_flag */
#define UVCALC_FILLHOLES 1
Modified: branches/projection-paint/source/blender/src/buttons_editing.c
===================================================================
--- branches/projection-paint/source/blender/src/buttons_editing.c 2008-12-06 10:25:51 UTC (rev 17727)
+++ branches/projection-paint/source/blender/src/buttons_editing.c 2008-12-06 13:42:55 UTC (rev 17728)
@@ -6341,10 +6341,10 @@
//uiDefButS(block, ROW, B_BRUSHCHANGE, "Soften", 108 ,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
//uiDefButS(block, ROW, B_BRUSHCHANGE, "Smear", 214,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Draw", 0 ,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Soften", 80 ,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Smear", 160,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
- uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Clone", 240,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_CLONE, 0, 0, "Clone brush, use RMB to drag source image");
+ uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Draw", 0 ,yco,108,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
+ //uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Soften", 80 ,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
+ uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Smear", 108 ,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
+ uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Clone", 214,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_CLONE, 0, 0, "Clone brush, use RMB to drag source image");
uiBlockEndAlign(block);
yco -= 30;
@@ -6361,23 +6361,24 @@
uiDefButS(block, MENU, B_NOP, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
- uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, B_BRUSHCHANGE, "Wrap", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
+ // uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, B_BRUSHCHANGE, "Wrap", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, B_BRUSHCHANGE, "Airbrush", xco+10,yco-50,butw,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
- uiDefButF(block, NUM, B_NOP, "Rate ", xco+10,yco-70,butw,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
+ uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, B_BRUSHCHANGE, "Airbrush", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
+ uiDefButF(block, NUM, B_NOP, "Rate ", xco+10,yco-45,butw,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
uiBlockEndAlign(block);
yco -= 25;
/* Projection Painting */
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_XRAY, B_NOP, "Occlude", xco+10,yco-70,butw,19, &settings->imapaint.flag, 0, 0, 0, 0, "Only paint onto the faces directly under the brush (slower)");
- uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_BACKFACE, B_NOP, "Cull", xco+10,yco-90,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Ignore faces pointing away from the view (faster)");
- uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_FLAT, B_NOP, "Normal", xco+10+butw/2,yco-90,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Paint most on faces pointing towards teh view");
+ uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_XRAY, B_NOP, "Occlude", xco+10,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Only paint onto the faces directly under the brush (slower)");
+ uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_BACKFACE, B_NOP, "Cull", xco+10+butw/2,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Ignore faces pointing away from the view (faster)");
- uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_IGNORE_SEAMS, B_NOP, "Bleed", xco+10,yco-110,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
- uiDefButF(block, NUM, B_NOP, "", xco+10 + (butw/2),yco-110,butw/2,19, &settings->imapaint.seam_bleed, 2.0, 8.0, 0, 0, "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
+ uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_FLAT, B_NOP, "Normal", xco+10,yco-65,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Paint most on faces pointing towards the view");
+ uiDefButC(block, NUM, B_NOP, "", xco+10 +(butw/2),yco-65,butw/2,19, &settings->imapaint.normal_angle, 10.0, 90.0, 0, 0, "Paint most on faces pointing towards the view acording to this angle)");
+
+ uiDefButC(block, NUM, B_NOP, "Bleed: ", xco+10,yco-85,butw,19, &settings->imapaint.seam_bleed, 0.0, 8.0, 0, 0, "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
Modified: branches/projection-paint/source/blender/src/imagepaint.c
===================================================================
--- branches/projection-paint/source/blender/src/imagepaint.c 2008-12-06 10:25:51 UTC (rev 17727)
+++ branches/projection-paint/source/blender/src/imagepaint.c 2008-12-06 13:42:55 UTC (rev 17728)
@@ -159,6 +159,7 @@
//#define PROJ_DEBUG_PAINT 1
//#define PROJ_DEBUG_NOSEAMBLEED 1
+//#define PROJ_DEBUG_PRINT_CLIP 1
#define PROJ_DEBUG_WINCLIP 1
/* projectFaceSeamFlags options */
@@ -186,7 +187,6 @@
/* vert flags */
#define PROJ_VERT_CULL 1
-/* M_PI_2 is 90d, we want 80 though */
#define PI_80_DEG ((M_PI_2 / 9) * 8)
/* This is mainly a convenience struct used so we can keep an array of images we use
@@ -245,6 +245,8 @@
short do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/
short do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
short do_mask_normal; /* mask out pixels based on their normals */
+ float normal_angle; /* what angle to mask at*/
+
short is_ortho;
short is_airbrush; /* only to avoid using (ps.brush->flag & BRUSH_AIRBRUSH) */
short is_texbrush; /* only to avoid running */
@@ -1293,7 +1295,7 @@
const int side,
const float w[3])
{
- float mask;
+ float mask, mask_angle;
/* calculate mask */
if (ps->do_mask_normal) {
@@ -1340,22 +1342,28 @@
angle = NormalizedVecAngle2(viewDirPersp, no);
}
- if (angle >= PI_80_DEG) {
+ /*if (angle >= (M_PI_2 / 90) * ps->normal_angle) {
return 0.0f;
}
- else {
+ else {*/
#if 0
mask = 1.0f - (angle / PI_80_DEG); /* map angle to 1.0-facing us, 0.0 right angles to the view direction */
#endif
/* trickier method that clips the normal so its more useful */
- mask = (angle / PI_80_DEG); /* map angle to 1.0-facing us, 0.0 right angles to the view direction */
+ /* M_PI_2 is 90d, we want 80 though */
+ mask_angle = ((M_PI_2 / 90) * ps->normal_angle);
+
+ /*printf("normal_angle : %f \n" ,ps->normal_angle);
+ printf("mask_angle : %f \n" ,mask_angle);*/
+
+ mask = (angle / mask_angle); /* map angle to 1.0-facing us, 0.0 right angles to the view direction */
mask = (1.0f - (mask * mask * mask)) * 1.4f;
if (mask > 1.0f) {
mask = 1.0f;
}
+ /*}*/
}
- }
else {
mask = 1.0f;
}
@@ -1548,7 +1556,7 @@
}
/* top/bottom */
- if (line_isect_y(l1, l2, rect->ymin, &isect) && (isect > rect->xmin) && (isect < rect->xmax)) {
+ if (line_isect_y(l1, l2, rect->ymin, &isect) && (isect >= rect->xmin) && (isect <= rect->xmax)) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list