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:
authorJoseph Eagar <joeedh@gmail.com>2021-09-21 05:41:00 +0300
committerJoseph Eagar <joeedh@gmail.com>2021-09-21 05:41:00 +0300
commit3fc687ad753e7e597321220b5ff9b2ff6ae847e1 (patch)
tree734e6c0c10d6280a4b2dd2514bbe98a2d496d6bd /release/scripts
parent76beed9068e53e3d393e1c16f61efe8fd6edceda (diff)
Sculpt: Finish color support for brush channels
* BRUSH_CHANNEL_VEC3/4 are now implemented * New flag BRUSH_CHANNEL_COLOR * Also tried to sculpt's usage of wm.radial_control in keymaps
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py51
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py11
2 files changed, 61 insertions, 1 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 322c5e63a18..cd3f78e7342 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4299,6 +4299,28 @@ def km_curve(params):
# Radial control setup helpers, this operator has a lot of properties.
+def radial_control_properties_channels(paint, prop, secondary_prop, secondary_rotation=False, color=False, zoom=False, type="float"):
+ brush_path = 'tool_settings.' + paint + '.brush'
+ channels_path = brush_path + ".channels.channels"
+ unified = "tool_settings." + paint + ".channels.channels"
+
+ rotation = 'mask_texture_slot_angle' if secondary_rotation else 'texture_slot_angle'
+ return {
+ "properties": [
+ ("data_path_primary", '%s["%s"].%s_value' % (channels_path, prop, type)),
+ ("data_path_secondary", '%s["%s"].%s_value' % (unified, prop, type) if secondary_prop else ''),
+ ("use_secondary", '%s["%s"].inherit' % (channels_path, prop) if secondary_prop else ''),
+ #("rotation_path", '%s["%s"].float_value' % (channels_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 ''),
+ #("zoom_path", 'space_data.zoom' if zoom else ''),
+ #("image_id", brush_path + ''),
+ #("secondary_tex", secondary_rotation),
+ ],
+ }
+
def radial_control_properties(paint, prop, secondary_prop, secondary_rotation=False, color=False, zoom=False):
brush_path = 'tool_settings.' + paint + '.brush'
@@ -4348,6 +4370,32 @@ def _template_paint_radial_control(paint, rotation=False, secondary_rotation=Fal
return items
+def _template_paint_radial_control_channels(paint, rotation=False, secondary_rotation=False, color=False, zoom=False):
+ items = []
+
+ items.extend([
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS'},
+ radial_control_properties_channels(paint, 'radius', 'use_unified_size', type="float", secondary_rotation=secondary_rotation, color=color, zoom=zoom)),
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True},
+ radial_control_properties_channels(paint, 'strength', 'use_unified_strength', type="factor", secondary_rotation=secondary_rotation, color=color)),
+ ])
+
+ """
+ if rotation:
+ items.extend([
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True},
+ radial_control_properties_channels(paint, 'texture_slot_angle', None, color=color)),
+ ])
+
+ if secondary_rotation:
+ items.extend([
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True, "alt": True},
+ radial_control_properties_channels(paint, 'mask_texture_slot_angle', None, secondary_rotation=secondary_rotation, color=color)),
+ ])
+ """
+
+ return items
+
def km_image_paint(params):
items = []
keymap = (
@@ -4567,7 +4615,8 @@ def km_sculpt(params):
{"properties": [("scalar", 0.9)]}),
("brush.scale_size", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "repeat": True},
{"properties": [("scalar", 1.0 / 0.9)]}),
- *_template_paint_radial_control("sculpt", rotation=True),
+ *_template_paint_radial_control_channels("sculpt", rotation=True),
+ #*_template_paint_radial_control("sculpt", rotation=True),
# Stencil
("brush.stencil_control", {"type": 'RIGHTMOUSE', "value": 'PRESS'},
{"properties": [("mode", 'TRANSLATION')]}),
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index c656df2fa81..38b75fe9713 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -126,6 +126,7 @@ class UnifiedPaintPanel:
row = layout.row(align=True)
typeprop = "float_value"
+
if ch.type == "INT":
typeprop = "int_value"
elif ch.type == "BOOL":
@@ -134,6 +135,10 @@ class UnifiedPaintPanel:
typeprop = "enum_value"
elif ch.type == "BITMASK":
typeprop = "flags_value"
+ elif ch.type == "VEC3":
+ typeprop = "color3_value"
+ elif ch.type == "VEC4":
+ typeprop = "color4_value"
if text is None:
s = prop_name.lower().replace("_", " ").split(" ");
@@ -274,6 +279,12 @@ class UnifiedPaintPanel:
@staticmethod
def prop_unified_color(parent, context, brush, prop_name, *, text=None):
+ if context.mode == 'SCULPT':
+# def channel_unified(layout, context, brush, prop_name, icon='NONE', pressure=True, text=None,
+ # slider=False, header=False, expand=None, toolsettings_only=False):
+ return UnifiedPaintPanel.channel_unified(parent, context, brush, prop_name, text=text)
+
+
ups = context.tool_settings.unified_paint_settings
prop_owner = ups if ups.use_unified_color else brush
parent.prop(prop_owner, prop_name, text=text)