diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2013-04-23 02:20:38 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2013-04-23 02:20:38 +0400 |
commit | e066b077fb8cae95576b6e4db3fc5bb07e4ab358 (patch) | |
tree | 791eba58bca1187186cc67c9b5d8ab7609787bc4 | |
parent | 15521ab0ff21368ffa19b75f926c806d5f8c2dad (diff) |
Overlay fixes:
* Clobbering enum
* Cursor overlay not dependent on mapping (again!)
* Brush overlay not updating when size is tweaked
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 9 |
4 files changed, 16 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 5b53f1d34c9..c6226180958 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -71,8 +71,8 @@ typedef enum PaintMode { typedef enum OverlayControlFlags { PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY = 1, PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY = (1 << 2), - PAINT_INVALID_OVERLAY_CURVE = (1 << 2), - PAINT_OVERLAY_OVERRIDE = (1 << 3) + PAINT_INVALID_OVERLAY_CURVE = (1 << 3), + PAINT_OVERLAY_OVERRIDE = (1 << 4) } OverlayControlFlags; void BKE_paint_invalidate_overlay_tex(struct Scene *scene, const struct Tex *tex); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index cdee767879b..49863621b04 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -324,13 +324,11 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) if (refresh) { int s, r; - float radius; old_zoom = zoom; s = BKE_brush_size_get(vc->scene, br); r = 1; - radius = s * zoom; for (s >>= 1; s > 0; s >>= 1) r++; @@ -373,17 +371,11 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) x = (float)i / size; y = (float)j / size; - if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED) { - x *= vc->ar->winx / radius; - y *= vc->ar->winy / radius; - } - else { - x -= 0.5f; - y -= 0.5f; + x -= 0.5f; + y -= 0.5f; - x *= 2; - y *= 2; - } + x *= 2; + y *= 2; len = sqrtf(x * x + y * y); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 4369c6dfabd..8e6bb976283 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -304,12 +304,7 @@ static void rna_Brush_secondary_tex_update(Main *bmain, Scene *scene, PointerRNA static void rna_Brush_size_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Brush *br = (Brush *)ptr->data; - if (br->mtex.mapping == MTEX_MAP_MODE_VIEW) { - BKE_paint_invalidate_overlay_tex(scene, br->mtex.tex); - BKE_paint_invalidate_overlay_tex(scene, br->mask_mtex.tex); - } - BKE_paint_invalidate_cursor_overlay(scene, br->curve); + BKE_paint_invalidate_overlay_all(); rna_Brush_update(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index ab7268c2570..0df7cfe3480 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -42,6 +42,7 @@ #include "BKE_freestyle.h" #include "BKE_editmesh.h" +#include "BKE_paint.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -1421,6 +1422,12 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo ups->unprojected_radius = value; } +static void rna_UnifiedPaintSettings_radius_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + /* changing the unified size should invalidate */ + BKE_paint_invalidate_overlay_all(); +} + static char *rna_UnifiedPaintSettings_path(PointerRNA *ptr) { return BLI_strdup("tool_settings.unified_paint_settings"); @@ -1962,12 +1969,14 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10); RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1); RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); + RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update"); prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL); RNA_def_property_range(prop, 0.001, FLT_MAX); RNA_def_property_ui_range(prop, 0.001, 1, 0, -1); RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units"); + RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update"); prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "alpha"); |