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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-02 20:05:25 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-02 20:05:25 +0400
commita0642a259759ebd76a956433a2949b94b00374bb (patch)
tree72fef4e7b0d1fd05ea9fe0bca8d1dcffd397ec42
parentb2a9d012b4e0ce820cb81ce170d84bed143ac041 (diff)
Fix wrong unified weight paint value version patch, was doing incorrect version check.
Fix #31209: weight paint sample & fill not using correct brush/unified value.
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_brush.h1
-rw-r--r--source/blender/blenkernel/intern/brush.c10
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c10
5 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 19ca0f8cc61..4ea38628001 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 3
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 2a62d204e78..52666ca1538 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -100,6 +100,7 @@ void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, flo
float brush_alpha(const struct Scene *scene, struct Brush *brush);
float brush_weight(const Scene *scene, struct Brush *brush);
+void brush_set_weight(const Scene *scene, struct Brush *brush, float value);
int brush_use_locked_size(const struct Scene *scene, struct Brush *brush);
int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 917c59b35a1..b3d128bf2b4 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -718,6 +718,16 @@ float brush_weight(const Scene *scene, Brush *brush)
return (ups->flag & UNIFIED_PAINT_WEIGHT) ? ups->weight : brush->weight;
}
+void brush_set_weight(const Scene *scene, Brush *brush, float value)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ if(ups->flag & UNIFIED_PAINT_WEIGHT)
+ ups->weight = value;
+ else
+ brush->weight = value;
+}
+
/* scale unprojected radius to reflect a change in the brush's 2D size */
void brush_scale_unprojected_radius(float *unprojected_radius,
int new_brush_size,
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1813bd49936..6c0ac651f13 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -13318,7 +13318,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile <= 263 && main->subversionfile == 0) {
+ if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 3)) {
Scene *scene;
Brush *brush;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 2d984adf5cb..18ddc965976 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1025,7 +1025,9 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
else {
MPoly *mp = ((MPoly *)me->mpoly) + (index - 1);
const int vgroup_active = vc.obact->actdef - 1;
+ Scene *scene = vc.scene;
ToolSettings *ts = vc.scene->toolsettings;
+ Brush *brush = paint_brush(&ts->wpaint->paint);
float mval_f[2];
int v_idx_best = -1;
int fidx;
@@ -1048,7 +1050,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
} while (fidx--);
if (v_idx_best != -1) { /* should always be valid */
- ts->vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
+ float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
+ brush_set_weight(scene, brush, vgroup_weight);
change = TRUE;
}
}
@@ -2505,8 +2508,11 @@ static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
{
struct Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ Brush *brush = paint_brush(&ts->wpaint->paint);
+ float vgroup_weight = brush_weight(scene, brush);
- wpaint_fill(scene->toolsettings->wpaint, obact, scene->toolsettings->vgroup_weight);
+ wpaint_fill(scene->toolsettings->wpaint, obact, vgroup_weight);
ED_region_tag_redraw(CTX_wm_region(C)); /* XXX - should redraw all 3D views */
return OPERATOR_FINISHED;
}