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:
authorAntony Riakiotakis <kalast@gmail.com>2013-04-12 21:21:31 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-04-12 21:21:31 +0400
commita305452275207a555d2812c3a5ea6647f0f594e4 (patch)
tree991400d761e7895e84841bfe63c5b9f71078dc9e /source/blender/editors/sculpt_paint/paint_utils.c
parent8f658d42643b5edb03d4ae16ca8f9f611b1fbf74 (diff)
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews, * Expose alpha mask mapping to UI (still not functional but coming soon). * More overlay refactoring: Overlay now does minimal checking for texture refresh. Instead, we now have invalidation flags to set an aspect of the brush overlay as invalid. This is necessary because this way we will be able to separate and preview different brush attributes on the overlays, using different textures: These attributes/aspects are: Primary texture (main texture for sculpt, vertex, imapaint) Secondary texture (mask/alpha texture for imapaint) Cursor texture (cursor texture. It involves brush strength and curves) Modified the relevant RNA property update functions and C update callback functions to call the relevant cursor invalidation functions instead of checking every frame for multiple properties. Properties that affect this are: Image changes, if image is used by current brush, Texture slot changes, similarly Curve changes, Object mode change invalidates the cursor Paint tool change invalidates the cursor. These changes give slightly more invalidation cases than simply comparing the relevant properties each frame, but these do not occur in performance critical moments and it's a much more elegant system than adding more variables to check per frame each time we add something on the system.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_utils.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 315fdd2fb32..0bf27267c89 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -206,6 +206,10 @@ void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct
rgba[2] = intensity;
rgba[3] = 1.0f;
}
+ CLAMP(rgba[0], 0.0, 1.0);
+ CLAMP(rgba[1], 0.0, 1.0);
+ CLAMP(rgba[2], 0.0, 1.0);
+ CLAMP(rgba[3], 0.0, 1.0);
}
/* 3D Paint */
@@ -358,7 +362,7 @@ int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index,
/* used for both 3d view and image window */
void paint_sample_color(const bContext *C, ARegion *ar, int x, int y) /* frontbuf */
{
- Brush *br = paint_brush(paint_get_active_from_context(C));
+ Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C));
unsigned int col;
char *cp;
@@ -380,17 +384,20 @@ void paint_sample_color(const bContext *C, ARegion *ar, int x, int y) /* fron
static int brush_curve_preset_exec(bContext *C, wmOperator *op)
{
- Brush *br = paint_brush(paint_get_active_from_context(C));
+ Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C));
- if (br)
+ if (br) {
+ Scene *scene = CTX_data_scene(C);
BKE_brush_curve_preset(br, RNA_enum_get(op->ptr, "shape"));
+ BKE_paint_invalidate_cursor_overlay(scene, br->curve);
+ }
return OPERATOR_FINISHED;
}
static int brush_curve_preset_poll(bContext *C)
{
- Brush *br = paint_brush(paint_get_active_from_context(C));
+ Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C));
return br && br->curve;
}