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/space_view3d_toolbar.py27
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/intern/brush.c18
-rw-r--r--source/blender/blenloader/intern/readfile.c20
-rw-r--r--source/blender/makesdna/DNA_scene_types.h52
-rw-r--r--source/blender/makesrna/intern/rna_scene.c53
6 files changed, 124 insertions, 48 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 25f81f2cde1..e89e2d9f484 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -468,6 +468,13 @@ class PaintPanel():
return None
+ @staticmethod
+ def unified_paint_settings(parent, context):
+ ups = context.tool_settings.unified_paint_settings
+ parent.label(text="Unified Settings:")
+ parent.prop(ups, "use_unified_size", text="Size")
+ parent.prop(ups, "use_unified_strength", text="Strength")
+
class VIEW3D_PT_tools_brush(PaintPanel, Panel):
bl_label = "Brush"
@@ -950,9 +957,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel, Panel):
layout.prop(sculpt, "show_brush")
layout.prop(sculpt, "use_deform_only")
- layout.label(text="Unified Settings:")
- layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
- layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+ self.unified_paint_settings(layout, context)
class VIEW3D_PT_sculpt_symmetry(PaintPanel, Panel):
@@ -1041,7 +1046,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
col.operator("object.vertex_group_fix", text="Fix Deforms")
-class VIEW3D_PT_tools_weightpaint_options(View3DPanel, Panel):
+class VIEW3D_PT_tools_weightpaint_options(PaintPanel, Panel):
bl_context = "weightpaint"
bl_label = "Options"
@@ -1062,9 +1067,7 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel, Panel):
col.prop(mesh, "use_mirror_x")
col.prop(mesh, "use_mirror_topology")
- col.label(text="Unified Settings:")
- col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
- col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+ self.unified_paint_settings(col, context)
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
@@ -1078,7 +1081,7 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel, Panel):
# ********** default tools for vertex-paint ****************
-class VIEW3D_PT_tools_vertexpaint(View3DPanel, Panel):
+class VIEW3D_PT_tools_vertexpaint(PaintPanel, Panel):
bl_context = "vertexpaint"
bl_label = "Options"
@@ -1094,9 +1097,7 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel, Panel):
col.prop(vpaint, "use_normal")
col.prop(vpaint, "use_spray")
- col.label(text="Unified Settings:")
- col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
- col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+ self.unified_paint_settings(col, context)
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
@@ -1187,9 +1188,7 @@ class VIEW3D_PT_imagepaint_options(PaintPanel):
tool_settings = context.tool_settings
col = layout.column()
- col.label(text="Unified Settings:")
- col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
- col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+ self.unified_paint_settings(col, context)
class VIEW3D_MT_tools_projectpaint_clone(Menu):
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 49cde9d6517..3632eb33717 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 261
-#define BLENDER_SUBVERSION 1
+#define BLENDER_SUBVERSION 2
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 61064bede7e..7a235966bfd 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1231,9 +1231,9 @@ static void set_unified_settings(Brush *brush, short flag, int value)
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
if (value)
- sce->toolsettings->sculpt_paint_settings |= flag;
+ sce->toolsettings->unified_paint_settings.flag |= flag;
else
- sce->toolsettings->sculpt_paint_settings &= ~flag;
+ sce->toolsettings->unified_paint_settings.flag &= ~flag;
}
}
}
@@ -1249,7 +1249,7 @@ static short unified_settings(Brush *brush)
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
- return sce->toolsettings->sculpt_paint_settings;
+ return sce->toolsettings->unified_paint_settings.flag;
}
}
@@ -1280,7 +1280,7 @@ static void set_unified_size(Brush *brush, int value)
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
- sce->toolsettings->sculpt_paint_unified_size= value;
+ sce->toolsettings->unified_paint_settings.size= value;
}
}
}
@@ -1296,7 +1296,7 @@ static int unified_size(Brush *brush)
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
- return sce->toolsettings->sculpt_paint_unified_size;
+ return sce->toolsettings->unified_paint_settings.size;
}
}
@@ -1314,7 +1314,7 @@ static void set_unified_alpha(Brush *brush, float value)
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
- sce->toolsettings->sculpt_paint_unified_alpha= value;
+ sce->toolsettings->unified_paint_settings.alpha= value;
}
}
}
@@ -1330,7 +1330,7 @@ static float unified_alpha(Brush *brush)
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
- return sce->toolsettings->sculpt_paint_unified_alpha;
+ return sce->toolsettings->unified_paint_settings.alpha;
}
}
@@ -1348,7 +1348,7 @@ static void set_unified_unprojected_radius(Brush *brush, float value)
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
- sce->toolsettings->sculpt_paint_unified_unprojected_radius= value;
+ sce->toolsettings->unified_paint_settings.unprojected_radius= value;
}
}
}
@@ -1364,7 +1364,7 @@ static float unified_unprojected_radius(Brush *brush)
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
- return sce->toolsettings->sculpt_paint_unified_unprojected_radius;
+ return sce->toolsettings->unified_paint_settings.unprojected_radius;
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a1d583624cd..1c9cbc6b1ee 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -12940,7 +12940,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- /* put compatibility code here until next subversion bump */
+ if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2))
{
{
/* convert Camera Actuator values to defines */
@@ -12959,6 +12959,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
+
+ {
+ /* convert deprecated sculpt_paint_unified_* fields to
+ UnifiedPaintSettings */
+ Scene *scene;
+ for(scene= main->scene.first; scene; scene= scene->id.next) {
+ ToolSettings *ts= scene->toolsettings;
+ UnifiedPaintSettings *ups= &ts->unified_paint_settings;
+ ups->size= ts->sculpt_paint_unified_size;
+ ups->unprojected_radius= ts->sculpt_paint_unified_unprojected_radius;
+ ups->alpha= ts->sculpt_paint_unified_alpha;
+ ups->flag= ts->sculpt_paint_settings;
+ }
+ }
+ }
+
+ /* put compatibility code here until next subversion bump */
+ {
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 7a87ca8c680..9f3353078c2 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -815,6 +815,38 @@ typedef struct TransformOrientation {
} TransformOrientation;
/* *************************************************************** */
+/* Unified Paint Settings */
+
+/* These settings can override the equivalent fields in the active
+ Brush for any paint mode; the flag field controls whether these
+ values are used */
+typedef struct UnifiedPaintSettings {
+ /* unified radius of brush in pixels */
+ int size;
+
+ /* unified radius of brush in Blender units */
+ float unprojected_radius;
+
+ /* unified strength of brush */
+ float alpha;
+
+ /* user preferences for sculpt and paint */
+ int flag;
+} UnifiedPaintSettings;
+
+typedef enum {
+ SCULPT_PAINT_USE_UNIFIED_SIZE = (1<<0),
+ SCULPT_PAINT_USE_UNIFIED_ALPHA = (1<<1),
+
+ /* only used if unified size is enabled */
+ SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE = (1<<2),
+ SCULPT_PAINT_UNIFIED_SIZE_PRESSURE = (1<<3),
+
+ /* only used if unified alpha is enabled */
+ SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE = (1<<4)
+} UnifiedPaintSettingsFlags;
+
+/* *************************************************************** */
/* Tool Settings */
typedef struct ToolSettings {
@@ -936,11 +968,16 @@ typedef struct ToolSettings {
char auto_normalize; /*auto normalizing mode in wpaint*/
char multipaint; /* paint multiple bones in wpaint */
- short sculpt_paint_settings; /* user preferences for sculpt and paint */
+ /* XXX: these sculpt_paint_* fields are deprecated, use the
+ unified_paint_settings field instead! */
+ short sculpt_paint_settings DNA_DEPRECATED;
short pad1;
- int sculpt_paint_unified_size; /* unified radius of brush in pixels */
- float sculpt_paint_unified_unprojected_radius;/* unified radius of brush in Blender units */
- float sculpt_paint_unified_alpha; /* unified strength of brush */
+ int sculpt_paint_unified_size DNA_DEPRECATED;
+ float sculpt_paint_unified_unprojected_radius DNA_DEPRECATED;
+ float sculpt_paint_unified_alpha DNA_DEPRECATED;
+
+ /* Unified Paint Settings */
+ struct UnifiedPaintSettings unified_paint_settings;
} ToolSettings;
/* *************************************************************** */
@@ -1367,13 +1404,6 @@ typedef enum SculptFlags {
SCULPT_ONLY_DEFORM = (1<<8),
} SculptFlags;
-/* sculpt_paint_settings */
-#define SCULPT_PAINT_USE_UNIFIED_SIZE (1<<0)
-#define SCULPT_PAINT_USE_UNIFIED_ALPHA (1<<1)
-#define SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE (1<<2)
-#define SCULPT_PAINT_UNIFIED_SIZE_PRESSURE (1<<3)
-#define SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE (1<<4)
-
/* ImagePaintSettings.flag */
#define IMAGEPAINT_DRAWING 1
// #define IMAGEPAINT_DRAW_TOOL 2 // deprecated
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e1bf4d73fff..61ced5bdada 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -32,6 +32,7 @@
#include "rna_internal.h"
+#include "DNA_brush_types.h"
#include "DNA_group_types.h"
#include "DNA_modifier_types.h"
#include "DNA_particle_types.h"
@@ -1274,8 +1275,6 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons
}
}
-
-
/* note: without this, when Multi-Paint is activated/deactivated, the colors
* will not change right away when multiple bones are selected, this function
* is not for general use and only for the few cases where changing scene
@@ -1613,19 +1612,48 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
- /* Sculpt/Paint Unified Size and Strength */
+ /* Unified Paint Settings */
+ prop= RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
+ RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
+}
+
+static void rna_def_unified_paint_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
- prop= RNA_def_property(srna, "sculpt_paint_use_unified_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_SIZE);
- RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius",
- "Instead of per brush radius, the radius is shared across brushes");
+ prop= RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCULPT_PAINT_USE_UNIFIED_SIZE);
+ RNA_def_property_ui_text(prop, "Use Unified Radius",
+ "Instead of per-brush radius, the radius is shared across brushes");
- prop= RNA_def_property(srna, "sculpt_paint_use_unified_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_ALPHA);
- RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength",
- "Instead of per brush strength, the strength is shared across brushes");
-}
+ prop= RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCULPT_PAINT_USE_UNIFIED_ALPHA);
+ 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, "size", PROP_INT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10);
+ RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
+ RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
+
+ prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
+ RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
+
+ 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);
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
+ RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
+}
static void rna_def_unit_settings(BlenderRNA *brna)
{
@@ -4048,6 +4076,7 @@ void RNA_def_scene(BlenderRNA *brna)
/* Nestled Data */
rna_def_tool_settings(brna);
+ rna_def_unified_paint_settings(brna);
rna_def_unit_settings(brna);
rna_def_scene_image_format_data(brna);
rna_def_scene_render_data(brna);