mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Paint: Migrate unified paint flag from scene / mode level to brush level
This PR moves the controls of "Use Unified xxx" (such as Use Unified Size) from the scene / mode level to the brush level, meaning each brush can have this option toggled on and off separately. It used to be that every brush shares the same toggle state. I moved the `UNIFIED_xxx` flags from `UnifiedPaintSettings` to `Brush`. Ialso added relevant RNA properties and hooked them up to Python scripts. Resolves #138469 Pull Request: https://projects.blender.org/blender/blender/pulls/159382
This commit is contained in:
parent
6ff59d28e4
commit
6ecfe4e810
19 changed files with 178 additions and 55 deletions
|
|
@ -360,4 +360,50 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
|
|||
if index_to_fix != -1:
|
||||
item_prop["properties"][index_to_fix] = ("brush_toggle", value_to_copy)
|
||||
|
||||
if keyconfig_version < (5, 3, 16):
|
||||
if not has_copy:
|
||||
keyconfig_data = copy.deepcopy(keyconfig_data)
|
||||
has_copy = True
|
||||
|
||||
# The `use_unified_*` toggle for radial controls was moved from the paint mode's
|
||||
# `unified_paint_settings` to brushes.
|
||||
#
|
||||
# The following conversion maps from the old values of
|
||||
# `tool_settings.<paint_mode>.unified_paint_settings.use_unified_<property_name>`
|
||||
# to
|
||||
# `tool_settings.<paint_mode>.brush.use_unified_<property_name>`
|
||||
#
|
||||
# It also updates the color override test path:
|
||||
# `tool_settings.<paint_mode>.unified_paint_settings.use_unified_color`
|
||||
# becomes
|
||||
# `tool_settings.<paint_mode>.brush.use_unified_color`
|
||||
|
||||
re_unified_paint_settings = re.compile(r"^(tool_settings)\.([a-z_]+)\.(unified_paint_settings)\.(.*)")
|
||||
|
||||
for _km_name, _km_parms, km_items_data in keyconfig_data:
|
||||
for item_op, _item_event, item_prop in km_items_data["items"]:
|
||||
|
||||
if item_op == "wm.radial_control":
|
||||
use_secondary_path_index = -1
|
||||
new_use_secondary_path = ""
|
||||
fill_color_override_test_path_index = -1
|
||||
new_fill_color_override_test_path = ""
|
||||
|
||||
for prop_index, (prop_id, prop_path) in enumerate(item_prop["properties"]):
|
||||
if (prop_id == "use_secondary" and re_unified_paint_settings.fullmatch(prop_path)):
|
||||
|
||||
use_secondary_path_index = prop_index
|
||||
new_use_secondary_path = prop_path.replace("unified_paint_settings", "brush")
|
||||
elif (prop_id == "fill_color_override_test_path" and re_unified_paint_settings.fullmatch(prop_path)):
|
||||
|
||||
fill_color_override_test_path_index = prop_index
|
||||
new_fill_color_override_test_path = prop_path.replace("unified_paint_settings", "brush")
|
||||
|
||||
if (use_secondary_path_index != -1 and new_use_secondary_path):
|
||||
item_prop["properties"][use_secondary_path_index] = (
|
||||
"use_secondary", new_use_secondary_path)
|
||||
if (fill_color_override_test_path_index != -1 and new_fill_color_override_test_path):
|
||||
item_prop["properties"][fill_color_override_test_path_index] = (
|
||||
"fill_color_override_test_path", new_fill_color_override_test_path)
|
||||
|
||||
return keyconfig_data
|
||||
|
|
|
|||
|
|
@ -4828,12 +4828,12 @@ def radial_control_properties(
|
|||
"properties": [
|
||||
("data_path_primary", "{:s}.{:s}".format(brush_path, prop)),
|
||||
("data_path_secondary", "{:s}.{:s}".format(unified_path, prop) if secondary_prop else ""),
|
||||
("use_secondary", "{:s}.{:s}".format(unified_path, secondary_prop) if secondary_prop else ""),
|
||||
("use_secondary", "{:s}.{:s}".format(brush_path, secondary_prop) if secondary_prop else ""),
|
||||
("rotation_path", "{:s}.{:s}".format(brush_path, rotation)),
|
||||
("color_path", "{:s}.cursor_color_add".format(brush_path)),
|
||||
("fill_color_path", "{:s}.color".format(brush_path) if color else ""),
|
||||
("fill_color_override_path", "{:s}.color".format(unified_path) if color else ""),
|
||||
("fill_color_override_test_path", "{:s}.use_unified_color".format(unified_path) if color else ""),
|
||||
("fill_color_override_test_path", "{:s}.use_unified_color".format(brush_path) if color else ""),
|
||||
("zoom_path", "space_data.zoom" if zoom else ""),
|
||||
("image_id", brush_path),
|
||||
("secondary_tex", secondary_rotation),
|
||||
|
|
|
|||
|
|
@ -2710,12 +2710,12 @@ def radial_control_properties(paint, prop, secondary_prop, secondary_rotation=Fa
|
|||
"properties": [
|
||||
("data_path_primary", brush_path + "." + prop),
|
||||
("data_path_secondary", unified_path + "." + prop if secondary_prop else ""),
|
||||
("use_secondary", unified_path + "." + secondary_prop if secondary_prop else ""),
|
||||
("use_secondary", brush_path + "." + secondary_prop if secondary_prop else ""),
|
||||
("rotation_path", brush_path + "." + rotation),
|
||||
("color_path", brush_path + ".cursor_color_add"),
|
||||
("fill_color_path", brush_path + ".color" if color else ""),
|
||||
("fill_color_override_path", unified_path + ".color" if color else ""),
|
||||
("fill_color_override_test_path", unified_path + ".use_unified_color" if color else ""),
|
||||
("fill_color_override_test_path", brush_path + ".use_unified_color" if color else ""),
|
||||
("zoom_path", "space_data.zoom" if zoom else ""),
|
||||
("image_id", brush_path + ""),
|
||||
("secondary_tex", secondary_rotation),
|
||||
|
|
|
|||
|
|
@ -317,14 +317,14 @@ class UnifiedPaintPanel:
|
|||
else:
|
||||
ups = UnifiedPaintPanel.paint_settings_from_active_tool(context).unified_paint_settings
|
||||
prop_owner = brush
|
||||
if unified_name and getattr(ups, unified_name):
|
||||
if unified_name and getattr(brush, unified_name):
|
||||
prop_owner = ups
|
||||
|
||||
row.prop(prop_owner, prop_name, icon='NONE', text=text, slider=slider)
|
||||
|
||||
if unified_name and not header:
|
||||
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
|
||||
row.prop(ups, unified_name, text="", icon='BRUSHES_ALL')
|
||||
row.prop(brush, unified_name, text="", icon='BRUSHES_ALL')
|
||||
|
||||
if pressure_name:
|
||||
row.prop(brush, pressure_name, text="")
|
||||
|
|
@ -360,13 +360,14 @@ class UnifiedPaintPanel:
|
|||
@staticmethod
|
||||
def prop_unified_color(parent, context, brush, prop_name, *, text=None):
|
||||
ups = UnifiedPaintPanel.paint_settings_from_active_tool(context).unified_paint_settings
|
||||
prop_owner = ups if ups.use_unified_color else brush
|
||||
prop_owner = ups if brush.use_unified_color else brush
|
||||
|
||||
parent.prop(prop_owner, prop_name, text=text)
|
||||
|
||||
@staticmethod
|
||||
def prop_unified_color_picker(parent, context, brush, prop_name, value_slider=True):
|
||||
ups = UnifiedPaintPanel.paint_settings_from_active_tool(context).unified_paint_settings
|
||||
prop_owner = ups if ups.use_unified_color else brush
|
||||
prop_owner = ups if brush.use_unified_color else brush
|
||||
parent.template_color_picker(prop_owner, prop_name, value_slider=value_slider)
|
||||
|
||||
|
||||
|
|
@ -1015,7 +1016,7 @@ def brush_settings(layout, context, brush, popover=False):
|
|||
UnifiedPaintPanel.prop_unified_color(row, context, brush, "secondary_color", text="")
|
||||
row.separator()
|
||||
row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", emboss=False)
|
||||
row.prop(ups, "use_unified_color", text="", icon='BRUSHES_ALL')
|
||||
row.prop(brush, "use_unified_color", text="", icon='BRUSHES_ALL')
|
||||
layout.prop(brush, "blend", text="Blend Mode")
|
||||
|
||||
# Per sculpt tool options.
|
||||
|
|
@ -1305,7 +1306,7 @@ def brush_shared_settings(layout, context, brush, popover=False):
|
|||
slider=True,
|
||||
)
|
||||
|
||||
size_owner = ups if ups.use_unified_size else brush
|
||||
size_owner = ups if brush.use_unified_size else brush
|
||||
size_prop = "size"
|
||||
if size_mode and (size_owner.use_locked_size == 'SCENE'):
|
||||
size_prop = "unprojected_size"
|
||||
|
|
@ -1378,7 +1379,7 @@ def brush_shared_settings(layout, context, brush, popover=False):
|
|||
def draw_color_jitter_panel(layout, context, brush):
|
||||
ups = UnifiedPaintPanel.paint_settings_from_active_tool(context).unified_paint_settings
|
||||
|
||||
prop_owner = ups if ups.use_unified_color else brush
|
||||
prop_owner = ups if brush.use_unified_color else brush
|
||||
layout.use_property_split = False
|
||||
|
||||
header, panel = layout.panel("color_jitter_panel", default_closed=True)
|
||||
|
|
@ -1639,7 +1640,7 @@ def draw_color_settings(context, layout, brush, color_type=False):
|
|||
UnifiedPaintPanel.prop_unified_color(row, context, brush, "secondary_color", text="")
|
||||
row.separator()
|
||||
row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", emboss=False)
|
||||
row.prop(ups, "use_unified_color", text="", icon='BRUSHES_ALL')
|
||||
row.prop(brush, "use_unified_color", text="", icon='BRUSHES_ALL')
|
||||
|
||||
draw_color_jitter_panel(layout, context, brush)
|
||||
|
||||
|
|
|
|||
|
|
@ -2165,10 +2165,11 @@ class _defs_weight_paint:
|
|||
def sample_weight():
|
||||
def draw_settings(context, layout, _tool):
|
||||
ups = context.tool_settings.weight_paint.unified_paint_settings
|
||||
if ups.use_unified_weight:
|
||||
brush = context.tool_settings.weight_paint.brush
|
||||
if brush.use_unified_weight:
|
||||
weight = ups.weight
|
||||
elif context.tool_settings.weight_paint.brush:
|
||||
weight = context.tool_settings.weight_paint.brush.weight
|
||||
elif brush:
|
||||
weight = brush.weight
|
||||
else:
|
||||
return
|
||||
layout.label(text=iface_("Weight: {:.3f}").format(weight), translate=False)
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ class _draw_tool_settings_context_mode:
|
|||
layout.prop(brush, "blend", text="", expand=False)
|
||||
|
||||
size = "size"
|
||||
size_owner = ups if ups.use_unified_size else brush
|
||||
size_owner = ups if brush.use_unified_size else brush
|
||||
if size_owner.use_locked_size == 'SCENE':
|
||||
size = "unprojected_size"
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ class _draw_tool_settings_context_mode:
|
|||
ups = paint.unified_paint_settings
|
||||
|
||||
size = "size"
|
||||
size_owner = ups if ups.use_unified_size else brush
|
||||
size_owner = ups if brush.use_unified_size else brush
|
||||
if size_owner.use_locked_size == 'SCENE':
|
||||
size = "unprojected_size"
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ class _draw_tool_settings_context_mode:
|
|||
if brush.gpencil_vertex_brush_type not in {'BLUR', 'AVERAGE', 'SMEAR'}:
|
||||
layout.separator(factor=0.4)
|
||||
ups = paint.unified_paint_settings
|
||||
prop_owner = ups if ups.use_unified_color else brush
|
||||
prop_owner = ups if brush.use_unified_color else brush
|
||||
layout.prop_with_popover(prop_owner, "color", text="", panel="TOPBAR_PT_grease_pencil_vertex_color")
|
||||
|
||||
brush_basic_grease_pencil_vertex_settings(layout, context, brush, compact=True)
|
||||
|
|
@ -8657,16 +8657,16 @@ class VIEW3D_PT_greasepencil_sculpt_context_menu(Panel):
|
|||
layout = self.layout
|
||||
|
||||
ups = paint.unified_paint_settings
|
||||
size_owner = ups if ups.use_unified_size else brush
|
||||
strength_owner = ups if ups.use_unified_strength else brush
|
||||
size_owner = ups if brush.use_unified_size else brush
|
||||
strength_owner = ups if brush.use_unified_strength else brush
|
||||
row = layout.row(align=True)
|
||||
row.prop(size_owner, "size", text="")
|
||||
row.prop(brush, "use_pressure_size", text="", icon='STYLUS_PRESSURE')
|
||||
row.prop(ups, "use_unified_size", text="", icon='BRUSHES_ALL')
|
||||
row.prop(brush, "use_unified_size", text="", icon='BRUSHES_ALL')
|
||||
row = layout.row(align=True)
|
||||
row.prop(strength_owner, "strength", text="")
|
||||
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
|
||||
row.prop(ups, "use_unified_strength", text="", icon='BRUSHES_ALL')
|
||||
row.prop(brush, "use_unified_strength", text="", icon='BRUSHES_ALL')
|
||||
|
||||
layer = context.object.data.layers.active
|
||||
|
||||
|
|
@ -8697,7 +8697,7 @@ class VIEW3D_PT_greasepencil_vertex_paint_context_menu(Panel):
|
|||
if brush.gpencil_vertex_brush_type in {'DRAW', 'REPLACE'}:
|
||||
split = layout.split(factor=0.1)
|
||||
ups = settings.unified_paint_settings
|
||||
prop_owner = ups if ups.use_unified_color else brush
|
||||
prop_owner = ups if brush.use_unified_color else brush
|
||||
split.prop(prop_owner, "color", text="")
|
||||
split.template_color_picker(prop_owner, "color", value_slider=True)
|
||||
|
||||
|
|
@ -8712,11 +8712,11 @@ class VIEW3D_PT_greasepencil_vertex_paint_context_menu(Panel):
|
|||
|
||||
if brush.gpencil_vertex_brush_type in {'DRAW', 'BLUR', 'SMEAR'}:
|
||||
ups = settings.unified_paint_settings
|
||||
strength_owner = ups if ups.use_unified_strength else brush
|
||||
strength_owner = ups if brush.use_unified_strength else brush
|
||||
row = layout.row(align=True)
|
||||
row.prop(strength_owner, "strength", text="")
|
||||
row.prop(brush, "use_pressure_strength", text="", icon='STYLUS_PRESSURE')
|
||||
row.prop(ups, "use_unified_strength", text="", icon='BRUSHES_ALL')
|
||||
row.prop(brush, "use_unified_strength", text="", icon='BRUSHES_ALL')
|
||||
|
||||
layer = context.object.data.layers.active
|
||||
|
||||
|
|
@ -8942,7 +8942,7 @@ class VIEW3D_PT_sculpt_context_menu(Panel):
|
|||
|
||||
ups = paint.unified_paint_settings
|
||||
size = "size"
|
||||
size_owner = ups if ups.use_unified_size else brush
|
||||
size_owner = ups if brush.use_unified_size else brush
|
||||
if size_owner.use_locked_size == 'SCENE':
|
||||
size = "unprojected_size"
|
||||
|
||||
|
|
@ -9026,7 +9026,7 @@ class TOPBAR_PT_grease_pencil_vertex_color(Panel):
|
|||
|
||||
ups = paint.unified_paint_settings
|
||||
brush = paint.brush
|
||||
prop_owner = ups if use_unified_paint and ups.use_unified_color else brush
|
||||
prop_owner = ups if use_unified_paint and brush.use_unified_color else brush
|
||||
|
||||
col = layout.column()
|
||||
col.template_color_picker(prop_owner, "color", value_slider=True)
|
||||
|
|
|
|||
|
|
@ -1653,7 +1653,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
|
|||
brush = settings.brush
|
||||
use_unified_paint = (context.object.mode != 'PAINT_GREASE_PENCIL')
|
||||
ups = settings.unified_paint_settings
|
||||
prop_owner = ups if use_unified_paint and ups.use_unified_color else brush
|
||||
prop_owner = ups if use_unified_paint and brush.use_unified_color else brush
|
||||
|
||||
col = layout.column()
|
||||
|
||||
|
|
@ -1669,7 +1669,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
|
|||
|
||||
sub_row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
|
||||
if use_unified_paint:
|
||||
sub_row.prop(ups, "use_unified_color", text="", icon='BRUSHES_ALL')
|
||||
sub_row.prop(brush, "use_unified_color", text="", icon='BRUSHES_ALL')
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_grease_pencil_brush_vertex_falloff(GreasePencilBrushFalloff, Panel, View3DPaintPanel):
|
||||
|
|
@ -2211,7 +2211,7 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_mixcolor(View3DPanel, Panel):
|
|||
gp_settings = brush.gpencil_settings
|
||||
use_unified_paint = (context.object.mode != 'PAINT_GREASE_PENCIL')
|
||||
ups = settings.unified_paint_settings
|
||||
prop_owner = ups if use_unified_paint and ups.use_unified_color else brush
|
||||
prop_owner = ups if use_unified_paint and brush.use_unified_color else brush
|
||||
|
||||
row = layout.row()
|
||||
row.prop(settings, "color_mode", expand=True)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace blender {
|
|||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 15
|
||||
#define BLENDER_FILE_SUBVERSION 16
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and cancel loading the file, showing a warning to
|
||||
|
|
|
|||
|
|
@ -1338,8 +1338,9 @@ bool BKE_brush_use_locked_size(const Paint *paint, const Brush *brush)
|
|||
{
|
||||
const short us_flag = paint->unified_paint_settings.flag;
|
||||
|
||||
return (us_flag & UNIFIED_PAINT_SIZE) ? (us_flag & UNIFIED_PAINT_BRUSH_LOCK_SIZE) != 0 :
|
||||
(brush->flag & BRUSH_LOCK_SIZE) != 0;
|
||||
return (brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_SIZE) ?
|
||||
(us_flag & UNIFIED_PAINT_BRUSH_LOCK_SIZE) != 0 :
|
||||
(brush->flag & BRUSH_LOCK_SIZE) != 0;
|
||||
}
|
||||
|
||||
bool BKE_brush_use_size_pressure(const Brush *brush)
|
||||
|
|
@ -1430,14 +1431,15 @@ float BKE_brush_weight_get(const Paint *paint, const Brush *brush)
|
|||
{
|
||||
const UnifiedPaintSettings *ups = &paint->unified_paint_settings;
|
||||
|
||||
return (ups->flag & UNIFIED_PAINT_WEIGHT) ? ups->weight : brush->weight;
|
||||
return (brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_WEIGHT) ? ups->weight :
|
||||
brush->weight;
|
||||
}
|
||||
|
||||
void BKE_brush_weight_set(Paint *paint, Brush *brush, float value)
|
||||
{
|
||||
UnifiedPaintSettings *ups = &paint->unified_paint_settings;
|
||||
|
||||
if (ups->flag & UNIFIED_PAINT_WEIGHT) {
|
||||
if (brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_WEIGHT) {
|
||||
ups->weight = value;
|
||||
}
|
||||
else {
|
||||
|
|
@ -1450,14 +1452,16 @@ int BKE_brush_input_samples_get(const Paint *paint, const Brush *brush)
|
|||
{
|
||||
const UnifiedPaintSettings *ups = &paint->unified_paint_settings;
|
||||
|
||||
return (ups->flag & UNIFIED_PAINT_INPUT_SAMPLES) ? ups->input_samples : brush->input_samples;
|
||||
return (brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_INPUT_SAMPLES) ?
|
||||
ups->input_samples :
|
||||
brush->input_samples;
|
||||
}
|
||||
|
||||
void BKE_brush_input_samples_set(Paint *paint, Brush *brush, int value)
|
||||
{
|
||||
UnifiedPaintSettings *ups = &paint->unified_paint_settings;
|
||||
|
||||
if (ups->flag & UNIFIED_PAINT_INPUT_SAMPLES) {
|
||||
if (brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_INPUT_SAMPLES) {
|
||||
ups->input_samples = value;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ bool BKE_paint_use_unified_size(const Paint *paint)
|
|||
return false;
|
||||
}
|
||||
|
||||
return paint->unified_paint_settings.flag & UNIFIED_PAINT_SIZE;
|
||||
return paint->brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_SIZE;
|
||||
}
|
||||
|
||||
bool BKE_paint_use_unified_strength(const Paint *paint)
|
||||
|
|
@ -624,7 +624,7 @@ bool BKE_paint_use_unified_strength(const Paint *paint)
|
|||
return false;
|
||||
}
|
||||
|
||||
return paint->unified_paint_settings.flag & UNIFIED_PAINT_ALPHA;
|
||||
return paint->brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_ALPHA;
|
||||
}
|
||||
|
||||
bool BKE_paint_use_unified_color(const Paint *paint)
|
||||
|
|
@ -634,7 +634,7 @@ bool BKE_paint_use_unified_color(const Paint *paint)
|
|||
return false;
|
||||
}
|
||||
|
||||
return paint->unified_paint_settings.flag & UNIFIED_PAINT_COLOR;
|
||||
return paint->brush->unified_paint_flags & BRUSH_USE_UNIFIED_PAINT_COLOR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1761,7 +1761,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
ToolSettings *ts = scene.toolsettings;
|
||||
if (ts) {
|
||||
ts->unified_paint_settings.weight = ts->vgroup_weight;
|
||||
ts->unified_paint_settings.flag |= UNIFIED_PAINT_WEIGHT;
|
||||
ts->unified_paint_settings.flag |= UNIFIED_PAINT_WEIGHT_DEPRECATED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -603,7 +603,8 @@ void blo_do_versions_502(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
|
|||
if (scene.toolsettings->gp_paint) {
|
||||
UnifiedPaintSettings &settings =
|
||||
scene.toolsettings->gp_paint->paint.unified_paint_settings;
|
||||
settings.flag &= ~(UNIFIED_PAINT_SIZE | UNIFIED_PAINT_ALPHA | UNIFIED_PAINT_COLOR);
|
||||
settings.flag &= ~(UNIFIED_PAINT_SIZE_DEPRECATED | UNIFIED_PAINT_ALPHA_DEPRECATED |
|
||||
UNIFIED_PAINT_COLOR_DEPRECATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,6 +347,22 @@ void blo_do_versions_503(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 503, 16)) {
|
||||
for (Brush &brush : bmain->brushes) {
|
||||
if (ELEM(brush.ob_mode,
|
||||
OB_MODE_SCULPT,
|
||||
OB_MODE_VERTEX_PAINT,
|
||||
OB_MODE_SCULPT_GREASE_PENCIL,
|
||||
OB_MODE_VERTEX_GREASE_PENCIL))
|
||||
{
|
||||
brush.unified_paint_flags |= BRUSH_USE_UNIFIED_PAINT_SIZE | BRUSH_USE_UNIFIED_PAINT_COLOR;
|
||||
}
|
||||
if (ELEM(brush.ob_mode, OB_MODE_WEIGHT_PAINT, OB_MODE_WEIGHT_GREASE_PENCIL)) {
|
||||
brush.unified_paint_flags |= BRUSH_USE_UNIFIED_PAINT_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Always bump subversion in BKE_blender_version.h when adding versioning
|
||||
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.
|
||||
|
|
|
|||
|
|
@ -411,6 +411,16 @@ enum eBrushFlags2 : int {
|
|||
};
|
||||
ENUM_OPERATORS(eBrushFlags2)
|
||||
|
||||
/** #Brush.unified_paint_flags */
|
||||
enum eBrushUnifiedPaintFlags : int {
|
||||
BRUSH_USE_UNIFIED_PAINT_SIZE = (1 << 0),
|
||||
BRUSH_USE_UNIFIED_PAINT_ALPHA = (1 << 1),
|
||||
BRUSH_USE_UNIFIED_PAINT_WEIGHT = (1 << 2),
|
||||
BRUSH_USE_UNIFIED_PAINT_COLOR = (1 << 3),
|
||||
BRUSH_USE_UNIFIED_PAINT_INPUT_SAMPLES = (1 << 4),
|
||||
};
|
||||
ENUM_OPERATORS(eBrushUnifiedPaintFlags)
|
||||
|
||||
enum BrushMaskPressureFlags : int {
|
||||
BRUSH_MASK_PRESSURE_RAMP = (1 << 1),
|
||||
BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2),
|
||||
|
|
|
|||
|
|
@ -452,6 +452,10 @@ struct Brush {
|
|||
|
||||
DNA_DEPRECATED struct CurveMapping *automasking_cavity_curve = nullptr;
|
||||
struct MeshAutomaskingSettings *mesh_automasking_settings = nullptr;
|
||||
eBrushUnifiedPaintFlags unified_paint_flags = BRUSH_USE_UNIFIED_PAINT_SIZE |
|
||||
BRUSH_USE_UNIFIED_PAINT_COLOR |
|
||||
BRUSH_USE_UNIFIED_PAINT_WEIGHT;
|
||||
char _pad3[4] = {};
|
||||
};
|
||||
|
||||
struct PaletteColor {
|
||||
|
|
|
|||
|
|
@ -59,15 +59,20 @@ inline ePaintSymmetryFlags operator++(ePaintSymmetryFlags &flags, int)
|
|||
|
||||
/** #UnifiedPaintSettings::flag */
|
||||
enum eUnifiedPaintSettingsFlags : int {
|
||||
UNIFIED_PAINT_SIZE = (1 << 0),
|
||||
UNIFIED_PAINT_ALPHA = (1 << 1),
|
||||
/** Only used if unified size is enabled, mirrors the brush flag #BRUSH_LOCK_SIZE. */
|
||||
/* DEPRECATED: migrated to per-brush flag BRUSH_USE_UNIFIED_PAINT_SIZE */
|
||||
UNIFIED_PAINT_SIZE_DEPRECATED = (1 << 0),
|
||||
/* DEPRECATED: migrated to per-brush flag BRUSH_USE_UNIFIED_PAINT_ALPHA */
|
||||
UNIFIED_PAINT_ALPHA_DEPRECATED = (1 << 1),
|
||||
/** Only used if per-brush unified size is enabled, mirrors the brush flag #BRUSH_LOCK_SIZE. */
|
||||
UNIFIED_PAINT_BRUSH_LOCK_SIZE = (1 << 2),
|
||||
UNIFIED_PAINT_FLAG_UNUSED_0 = (1 << 3),
|
||||
UNIFIED_PAINT_FLAG_UNUSED_1 = (1 << 4),
|
||||
UNIFIED_PAINT_WEIGHT = (1 << 5),
|
||||
UNIFIED_PAINT_COLOR = (1 << 6),
|
||||
UNIFIED_PAINT_INPUT_SAMPLES = (1 << 7),
|
||||
/* DEPRECATED: migrated to per-brush flag BRUSH_USE_UNIFIED_PAINT_WEIGHT */
|
||||
UNIFIED_PAINT_WEIGHT_DEPRECATED = (1 << 5),
|
||||
/* DEPRECATED: migrated to per-brush flag BRUSH_USE_UNIFIED_PAINT_COLOR */
|
||||
UNIFIED_PAINT_COLOR_DEPRECATED = (1 << 6),
|
||||
/* DEPRECATED: migrated to per-brush flag BRUSH_USE_UNIFIED_PAINT_INPUT_SAMPLES */
|
||||
UNIFIED_PAINT_INPUT_SAMPLES_DEPRECATED = (1 << 7),
|
||||
UNIFIED_PAINT_COLOR_JITTER = (1 << 8),
|
||||
};
|
||||
ENUM_OPERATORS(eUnifiedPaintSettingsFlags)
|
||||
|
|
|
|||
|
|
@ -1137,8 +1137,7 @@ struct UnifiedPaintSettings {
|
|||
/** Unified brush stroke input samples. */
|
||||
int input_samples = 1;
|
||||
|
||||
/** User preferences for sculpt and paint. */
|
||||
eUnifiedPaintSettingsFlags flag = UNIFIED_PAINT_SIZE | UNIFIED_PAINT_COLOR;
|
||||
eUnifiedPaintSettingsFlags flag = eUnifiedPaintSettingsFlags(0);
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
|
|
|||
|
|
@ -4062,6 +4062,37 @@ static void rna_def_brush(BlenderRNA *brna)
|
|||
RNA_def_property_struct_type(prop, "MeshAutomaskingSettings");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Mesh Automasking Settings", nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, nullptr, "unified_paint_flags", BRUSH_USE_UNIFIED_PAINT_SIZE);
|
||||
RNA_def_property_ui_text(prop, "Use Unified Size", "Use shared size for this brush");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, nullptr, "unified_paint_flags", BRUSH_USE_UNIFIED_PAINT_ALPHA);
|
||||
RNA_def_property_ui_text(prop, "Use Unified Strength", "Use shared strength for this brush");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, nullptr, "unified_paint_flags", BRUSH_USE_UNIFIED_PAINT_WEIGHT);
|
||||
RNA_def_property_ui_text(prop, "Use Unified Weight", "Use shared weight for this brush");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_color", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, nullptr, "unified_paint_flags", BRUSH_USE_UNIFIED_PAINT_COLOR);
|
||||
RNA_def_property_ui_text(prop, "Use Unified Color", "Use shared color for this brush");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_input_samples", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, nullptr, "unified_paint_flags", BRUSH_USE_UNIFIED_PAINT_INPUT_SAMPLES);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Use Unified Input Samples", "Use shared input samples for this brush");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -854,38 +854,43 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
|
|||
|
||||
/* high-level flags to enable or disable unified paint settings */
|
||||
prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_SIZE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_SIZE_DEPRECATED);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Use Unified Size", "Instead of per-brush size, the size is shared across brushes");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
RNA_def_property_deprecated(prop, "Replaced by per-brush unified settings", 503, 600);
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_ALPHA);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_ALPHA_DEPRECATED);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Use Unified Strength",
|
||||
"Instead of per-brush strength, the strength is shared across brushes");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
RNA_def_property_deprecated(prop, "Replaced by per-brush unified settings", 503, 600);
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_WEIGHT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_WEIGHT_DEPRECATED);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Use Unified Weight",
|
||||
"Instead of per-brush weight, the weight is shared across brushes");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
RNA_def_property_deprecated(prop, "Replaced by per-brush unified settings", 503, 600);
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_color", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_COLOR);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_COLOR_DEPRECATED);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Use Unified Color", "Instead of per-brush color, the color is shared across brushes");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
RNA_def_property_deprecated(prop, "Replaced by per-brush unified settings", 503, 600);
|
||||
|
||||
prop = RNA_def_property(srna, "use_unified_input_samples", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_INPUT_SAMPLES);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", UNIFIED_PAINT_INPUT_SAMPLES_DEPRECATED);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Use Unified Input Samples",
|
||||
"Instead of per-brush input samples, the value is shared across brushes");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
RNA_def_property_deprecated(prop, "Replaced by per-brush unified settings", 503, 600);
|
||||
|
||||
/* unified paint settings that override the equivalent settings
|
||||
* from the active brush */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue