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:
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py8
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py4
-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.c8
-rw-r--r--source/blender/blenloader/intern/readfile.c21
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/makesdna/DNA_brush_types.h3
-rw-r--r--source/blender/makesdna/DNA_scene_types.h8
-rw-r--r--source/blender/makesrna/intern/rna_brush.c7
-rw-r--r--source/blender/makesrna/intern/rna_scene.c12
12 files changed, 74 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 25ea85a9a6a..94df1ed6cf5 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -47,6 +47,8 @@ class UnifiedPaintPanel():
parent.label(text="Unified Settings:")
parent.prop(ups, "use_unified_size", text="Size")
parent.prop(ups, "use_unified_strength", text="Strength")
+ if context.weight_paint_object:
+ parent.prop(ups, "use_unified_weight", text="Weight")
@staticmethod
def prop_unified_size(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
@@ -59,3 +61,9 @@ class UnifiedPaintPanel():
ups = context.tool_settings.unified_paint_settings
ptr = ups if ups.use_unified_strength else brush
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
+
+ @staticmethod
+ def prop_unified_weight(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
+ ups = context.tool_settings.unified_paint_settings
+ ptr = ups if ups.use_unified_weight else brush
+ parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index c494590d005..503229f5593 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -652,13 +652,15 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
# Weight Paint Mode #
elif context.weight_paint_object and brush:
- layout.prop(toolsettings, "vertex_group_weight", text="Weight", slider=True)
layout.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
layout.prop(toolsettings, "use_multipaint", text="Multi-Paint")
col = layout.column()
row = col.row(align=True)
+ self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
+
+ row = col.row(align=True)
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 14f5c27c3df..51daac87138 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 0
+#define BLENDER_SUBVERSION 1
#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 1ff9bc46638..2a62d204e78 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -99,6 +99,7 @@ float brush_unprojected_radius(const struct Scene *scene, struct Brush *brush);
void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, float value);
float brush_alpha(const struct Scene *scene, struct Brush *brush);
+float brush_weight(const Scene *scene, struct Brush *brush);
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 3df6de2fd24..917c59b35a1 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -75,6 +75,7 @@ static void brush_set_defaults(Brush *brush)
brush->ob_mode = OB_MODE_ALL_PAINT;
/* BRUSH SCULPT TOOL SETTINGS */
+ brush->weight= 1.0f; /* weight of brush 0 - 1.0 */
brush->size= 35; /* radius of the brush in pixels */
brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */
brush->autosmooth_factor= 0.0f;
@@ -710,6 +711,13 @@ float brush_alpha(const Scene *scene, Brush *brush)
return (ups->flag & UNIFIED_PAINT_ALPHA) ? ups->alpha : brush->alpha;
}
+float brush_weight(const Scene *scene, Brush *brush)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ return (ups->flag & UNIFIED_PAINT_WEIGHT) ? ups->weight : brush->weight;
+}
+
/* 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 b7ffa77a502..79904793715 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -13261,6 +13261,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
part->flag |= PART_ROTATIONS;
}
+ if (main->versionfile <= 263 && main->subversionfile == 0) {
+ Scene *scene;
+ Brush *brush;
+
+ /* For weight paint, each brush now gets its own weight;
+ unified paint settings also have weight. Update unified
+ paint settings and brushes with a default weight value. */
+
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ ToolSettings *ts = scene->toolsettings;
+ if (ts) {
+ ts->unified_paint_settings.weight = ts->vgroup_weight;
+ ts->unified_paint_settings.flag |= UNIFIED_PAINT_WEIGHT;
+ }
+ }
+
+ for (brush = main->brush.first; brush; brush = brush->id.next) {
+ brush->weight = 0.5;
+ }
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index b5d6f20aa79..6860b551556 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -530,6 +530,9 @@ static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *p
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
set_brush_rc_props(kmi->ptr, paint, "strength", "use_unified_strength", flags);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", WKEY, KM_PRESS, 0, 0);
+ set_brush_rc_props(kmi->ptr, paint, "weight", "use_unified_weight", flags);
+
if (flags & RC_ROTATION) {
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
set_brush_rc_props(kmi->ptr, paint, "texture_slot.angle", NULL, flags);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index bd448cc8288..7d847df4175 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2348,7 +2348,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
if (brush->vertexpaint_tool == PAINT_BLEND_BLUR)
paintweight = 0.0f;
else
- paintweight = ts->vgroup_weight;
+ paintweight = brush_weight(scene, brush);
for (index = 0; index < totindex; index++) {
if (indexar[index] && indexar[index] <= me->totpoly) {
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 0d06b55f1d3..c531225775a 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -65,6 +65,7 @@ typedef struct Brush {
short blend; /* blend mode */
short ob_mode; /* & with ob->mode to see if the brush is compatible, use for display only. */
+ float weight; /* brush weight */
int size; /* brush diameter */
int flag; /* general purpose flag */
float jitter; /* jitter the position of the brush */
@@ -83,7 +84,7 @@ typedef struct Brush {
char sculpt_tool; /* active sculpt tool */
char vertexpaint_tool; /* active vertex/weight paint blend mode (poorly named) */
char imagepaint_tool; /* active image paint tool */
- char pad3[5];
+ char pad;
float autosmooth_factor;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 83688e30643..81cc4f13372 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -851,13 +851,18 @@ typedef struct UnifiedPaintSettings {
/* unified strength of brush */
float alpha;
+ /* unified brush weight, [0, 1] */
+ float weight;
+
/* user preferences for sculpt and paint */
int flag;
+ int pad;
} UnifiedPaintSettings;
typedef enum {
UNIFIED_PAINT_SIZE = (1<<0),
UNIFIED_PAINT_ALPHA = (1<<1),
+ UNIFIED_PAINT_WEIGHT = (1<<5),
/* only used if unified size is enabled, mirros the brush flags
* BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */
@@ -878,7 +883,8 @@ typedef struct ToolSettings {
Sculpt *sculpt;
UvSculpt *uvsculpt; /* uv smooth */
- /* Vertex groups */
+ /* Vertex group weight - used only for editmode, not weight
+ paint */
float vgroup_weight;
/* Subdivide Settings */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 4444f7aa3cc..bdff545df5c 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -583,6 +583,13 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Color", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Weight", "Vertex weight when brush is applied");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "alpha");
RNA_def_property_float_default(prop, 0.5f);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 6a3fd47ba04..ba927a1c739 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1779,6 +1779,11 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Unified Strength",
"Instead of per-brush strength, the strength is shared across brushes");
+ prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
+ RNA_def_property_ui_text(prop, "Use Unified Weight",
+ "Instead of per-brush weight, the weight is shared across brushes");
+
/* unified paint settings that override the equivalent settings
* from the active brush */
prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
@@ -1800,6 +1805,13 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
+
prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);