2012-01-18 05:54:19 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
# <pep8 compliant>
|
2014-08-28 16:40:38 +02:00
|
|
|
from bpy.types import Menu
|
2012-01-18 05:54:19 +00:00
|
|
|
|
|
|
|
|
2015-01-29 15:35:06 +11:00
|
|
|
class UnifiedPaintPanel:
|
2012-01-18 05:54:19 +00:00
|
|
|
# subclass must set
|
|
|
|
# bl_space_type = 'IMAGE_EDITOR'
|
|
|
|
# bl_region_type = 'UI'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def paint_settings(context):
|
2018-12-17 17:20:24 +11:00
|
|
|
tool_settings = context.tool_settings
|
2012-01-18 05:54:19 +00:00
|
|
|
|
|
|
|
if context.sculpt_object:
|
2018-12-17 17:20:24 +11:00
|
|
|
return tool_settings.sculpt
|
2012-01-18 05:54:19 +00:00
|
|
|
elif context.vertex_paint_object:
|
2018-12-17 17:20:24 +11:00
|
|
|
return tool_settings.vertex_paint
|
2012-01-18 05:54:19 +00:00
|
|
|
elif context.weight_paint_object:
|
2018-12-17 17:20:24 +11:00
|
|
|
return tool_settings.weight_paint
|
2012-01-18 05:54:19 +00:00
|
|
|
elif context.image_paint_object:
|
2018-12-17 17:20:24 +11:00
|
|
|
if (tool_settings.image_paint and tool_settings.image_paint.detect_data()):
|
|
|
|
return tool_settings.image_paint
|
2014-10-06 15:12:06 +02:00
|
|
|
|
|
|
|
return None
|
2012-01-18 05:54:19 +00:00
|
|
|
elif context.particle_edit_object:
|
2018-12-17 17:20:24 +11:00
|
|
|
return tool_settings.particle_edit
|
2012-01-18 05:54:19 +00:00
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def unified_paint_settings(parent, context):
|
|
|
|
ups = context.tool_settings.unified_paint_settings
|
2018-10-31 17:23:43 +01:00
|
|
|
|
|
|
|
flow = parent.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
|
|
|
|
|
|
|
|
col = flow.column()
|
2019-03-20 14:09:55 +01:00
|
|
|
col.prop(ups, "use_unified_size", text="Size")
|
2018-10-31 17:23:43 +01:00
|
|
|
col = flow.column()
|
2019-03-20 14:09:55 +01:00
|
|
|
col.prop(ups, "use_unified_strength", text="Strength")
|
2012-04-29 20:04:25 +00:00
|
|
|
if context.weight_paint_object:
|
2018-10-31 17:23:43 +01:00
|
|
|
col = flow.column()
|
2019-03-20 14:09:55 +01:00
|
|
|
col.prop(ups, "use_unified_weight", text="Weight")
|
2014-07-21 12:02:05 +02:00
|
|
|
elif context.vertex_paint_object or context.image_paint_object:
|
2018-10-31 17:23:43 +01:00
|
|
|
col = flow.column()
|
2019-03-20 14:09:55 +01:00
|
|
|
col.prop(ups, "use_unified_color", text="Color")
|
2014-07-21 12:02:05 +02:00
|
|
|
else:
|
2018-10-31 17:23:43 +01:00
|
|
|
col = flow.column()
|
2019-03-20 14:09:55 +01:00
|
|
|
col.prop(ups, "use_unified_color", text="Color")
|
2012-01-18 05:54:19 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2019-03-12 16:19:37 +11:00
|
|
|
def prop_unified_size(parent, context, brush, prop_name, *, icon='NONE', text=None, slider=False):
|
2012-01-18 05:54:19 +00:00
|
|
|
ups = context.tool_settings.unified_paint_settings
|
|
|
|
ptr = ups if ups.use_unified_size else brush
|
|
|
|
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
|
|
|
|
|
|
|
|
@staticmethod
|
2019-03-12 16:19:37 +11:00
|
|
|
def prop_unified_strength(parent, context, brush, prop_name, *, icon='NONE', text=None, slider=False):
|
2012-01-18 05:54:19 +00:00
|
|
|
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)
|
2012-04-29 20:04:25 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2019-03-12 16:19:37 +11:00
|
|
|
def prop_unified_weight(parent, context, brush, prop_name, *, icon='NONE', text=None, slider=False):
|
2012-04-29 20:04:25 +00:00
|
|
|
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)
|
2012-05-15 04:50:47 +00:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
@staticmethod
|
2019-03-12 16:19:37 +11:00
|
|
|
def prop_unified_color(parent, context, brush, prop_name, *, text=None):
|
2014-07-21 12:02:05 +02:00
|
|
|
ups = context.tool_settings.unified_paint_settings
|
|
|
|
ptr = ups if ups.use_unified_color else brush
|
|
|
|
parent.prop(ptr, prop_name, text=text)
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def prop_unified_color_picker(parent, context, brush, prop_name, value_slider=True):
|
|
|
|
ups = context.tool_settings.unified_paint_settings
|
|
|
|
ptr = ups if ups.use_unified_color else brush
|
|
|
|
parent.template_color_picker(ptr, prop_name, value_slider=value_slider)
|
|
|
|
|
|
|
|
|
2014-08-28 16:40:38 +02:00
|
|
|
class VIEW3D_MT_tools_projectpaint_clone(Menu):
|
|
|
|
bl_label = "Clone Layer"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2017-05-25 15:11:00 +10:00
|
|
|
for i, uv_layer in enumerate(context.active_object.data.uv_layers):
|
|
|
|
props = layout.operator("wm.context_set_int", text=uv_layer.name, translate=False)
|
2018-09-28 16:34:12 -03:00
|
|
|
props.data_path = "active_object.data.uv_layer_clone_index"
|
2014-08-28 16:40:38 +02:00
|
|
|
props.value = i
|
|
|
|
|
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def brush_texpaint_common(panel, context, layout, brush, _settings, projpaint=False):
|
2014-07-21 12:02:05 +02:00
|
|
|
capabilities = brush.image_paint_capabilities
|
|
|
|
|
|
|
|
col = layout.column()
|
|
|
|
|
2019-01-10 10:10:21 +11:00
|
|
|
if capabilities.has_color:
|
2019-03-19 18:17:50 +01:00
|
|
|
if brush.blend in {'ERASE_ALPHA', 'ADD_ALPHA'}:
|
2016-11-18 15:49:41 +01:00
|
|
|
if brush.image_tool == 'FILL' and not projpaint:
|
|
|
|
col.prop(brush, "fill_threshold")
|
2014-07-21 12:02:05 +02:00
|
|
|
|
|
|
|
elif brush.image_tool == 'SOFTEN':
|
|
|
|
col.row().prop(brush, "direction", expand=True)
|
|
|
|
col.prop(brush, "sharp_threshold")
|
2014-08-27 15:07:57 +02:00
|
|
|
if not projpaint:
|
|
|
|
col.prop(brush, "blur_kernel_radius")
|
2014-07-21 12:02:05 +02:00
|
|
|
col.prop(brush, "blur_mode")
|
|
|
|
elif brush.image_tool == 'MASK':
|
|
|
|
col.prop(brush, "weight", text="Mask Value", slider=True)
|
|
|
|
|
|
|
|
elif brush.image_tool == 'CLONE':
|
2019-03-19 18:17:50 +01:00
|
|
|
if not projpaint:
|
2014-07-21 19:24:03 +02:00
|
|
|
col.prop(brush, "clone_image", text="Image")
|
|
|
|
col.prop(brush, "clone_alpha", text="Alpha")
|
|
|
|
|
2019-01-02 14:36:56 +11:00
|
|
|
if not panel.is_popover:
|
|
|
|
brush_basic_texpaint_settings(col, context, brush)
|
2014-07-21 12:02:05 +02:00
|
|
|
|
2019-03-19 18:17:50 +01:00
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def brush_texpaint_common_clone(_panel, context, layout, _brush, settings, _projpaint=False):
|
2019-03-19 18:17:50 +01:00
|
|
|
ob = context.active_object
|
|
|
|
col = layout.column()
|
|
|
|
|
|
|
|
if settings.mode == 'MATERIAL':
|
|
|
|
if len(ob.material_slots) > 1:
|
|
|
|
col.label(text="Materials")
|
|
|
|
col.template_list("MATERIAL_UL_matslots", "",
|
|
|
|
ob, "material_slots",
|
|
|
|
ob, "active_material_index", rows=2)
|
|
|
|
|
|
|
|
mat = ob.active_material
|
|
|
|
if mat:
|
|
|
|
col.label(text="Source Clone Slot")
|
|
|
|
col.template_list("TEXTURE_UL_texpaintslots", "",
|
|
|
|
mat, "texture_paint_images",
|
|
|
|
mat, "paint_clone_slot", rows=2)
|
|
|
|
|
|
|
|
elif settings.mode == 'IMAGE':
|
|
|
|
mesh = ob.data
|
|
|
|
|
|
|
|
clone_text = mesh.uv_layer_clone.name if mesh.uv_layer_clone else ""
|
|
|
|
col.label(text="Source Clone Image")
|
|
|
|
col.template_ID(settings, "clone_image")
|
|
|
|
col.label(text="Source Clone UV Map")
|
|
|
|
col.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text, translate=False)
|
|
|
|
|
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def brush_texpaint_common_color(_panel, context, layout, brush, _settings, _projpaint=False):
|
2019-03-19 18:17:50 +01:00
|
|
|
UnifiedPaintPanel.prop_unified_color_picker(layout, context, brush, "color", value_slider=True)
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
UnifiedPaintPanel.prop_unified_color(row, context, brush, "color", text="")
|
|
|
|
UnifiedPaintPanel.prop_unified_color(row, context, brush, "secondary_color", text="")
|
|
|
|
row.separator()
|
|
|
|
row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", emboss=False)
|
|
|
|
|
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def brush_texpaint_common_gradient(_panel, context, layout, brush, _settings, _projpaint=False):
|
2019-03-19 18:17:50 +01:00
|
|
|
layout.template_color_ramp(brush, "gradient", expand=True)
|
|
|
|
|
|
|
|
layout.use_property_split = True
|
|
|
|
|
|
|
|
col = layout.column()
|
|
|
|
|
|
|
|
if brush.image_tool == 'DRAW':
|
|
|
|
UnifiedPaintPanel.prop_unified_color(col, context, brush, "secondary_color", text="Background Color")
|
|
|
|
col.prop(brush, "gradient_stroke_mode", text="Mode")
|
|
|
|
if brush.gradient_stroke_mode in {'SPACING_REPEAT', 'SPACING_CLAMP'}:
|
|
|
|
col.prop(brush, "grad_spacing")
|
|
|
|
else: # if brush.image_tool == 'FILL':
|
|
|
|
col.prop(brush, "gradient_fill_mode")
|
|
|
|
|
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def brush_texpaint_common_options(_panel, _context, layout, brush, _settings, projpaint=False):
|
2019-03-19 18:17:50 +01:00
|
|
|
capabilities = brush.image_paint_capabilities
|
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
col = layout.column()
|
|
|
|
|
|
|
|
if capabilities.has_accumulate:
|
|
|
|
col.prop(brush, "use_accumulate")
|
|
|
|
|
2019-03-19 18:17:50 +01:00
|
|
|
if capabilities.has_space_attenuation:
|
|
|
|
col.prop(brush, "use_space_attenuation")
|
|
|
|
|
2015-06-03 11:33:33 +02:00
|
|
|
if projpaint:
|
|
|
|
col.prop(brush, "use_alpha")
|
|
|
|
|
2012-05-15 04:50:47 +00:00
|
|
|
|
|
|
|
# Used in both the View3D toolbar and texture properties
|
2013-01-16 12:57:35 +00:00
|
|
|
def brush_texture_settings(layout, brush, sculpt):
|
2012-05-15 04:50:47 +00:00
|
|
|
tex_slot = brush.texture_slot
|
|
|
|
|
2018-10-31 17:23:43 +01:00
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
2012-05-15 04:50:47 +00:00
|
|
|
|
|
|
|
# map_mode
|
2013-01-16 12:57:35 +00:00
|
|
|
if sculpt:
|
2018-10-31 17:23:43 +01:00
|
|
|
layout.prop(tex_slot, "map_mode", text="Mapping")
|
2012-05-15 04:50:47 +00:00
|
|
|
else:
|
2018-10-31 17:23:43 +01:00
|
|
|
layout.prop(tex_slot, "tex_paint_map_mode", text="Mapping")
|
|
|
|
|
|
|
|
layout.separator()
|
2013-04-07 01:38:03 +00:00
|
|
|
|
2013-04-05 13:00:16 +00:00
|
|
|
if tex_slot.map_mode == 'STENCIL':
|
2013-04-30 10:32:02 +00:00
|
|
|
if brush.texture and brush.texture.type == 'IMAGE':
|
|
|
|
layout.operator("brush.stencil_fit_image_aspect")
|
|
|
|
layout.operator("brush.stencil_reset_transform")
|
2013-02-10 08:54:10 +00:00
|
|
|
|
2013-01-16 12:57:35 +00:00
|
|
|
# angle and texture_angle_source
|
2014-12-30 18:06:59 +01:00
|
|
|
if tex_slot.has_texture_angle:
|
2014-02-12 17:57:25 +02:00
|
|
|
col = layout.column()
|
2018-10-31 17:23:43 +01:00
|
|
|
col.prop(tex_slot, "angle", text="Angle")
|
2014-12-30 18:06:59 +01:00
|
|
|
if tex_slot.has_texture_angle_source:
|
2014-12-26 23:51:27 +01:00
|
|
|
col.prop(tex_slot, "use_rake", text="Rake")
|
2015-01-29 15:35:06 +11:00
|
|
|
|
2014-12-30 18:06:59 +01:00
|
|
|
if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
|
2014-02-12 17:57:25 +02:00
|
|
|
if sculpt:
|
|
|
|
if brush.sculpt_capabilities.has_random_texture_angle:
|
2014-12-26 23:51:27 +01:00
|
|
|
col.prop(tex_slot, "use_random", text="Random")
|
|
|
|
if tex_slot.use_random:
|
2018-12-23 21:58:59 +01:00
|
|
|
col.prop(tex_slot, "random_angle", text="Random Angle")
|
2014-02-12 17:57:25 +02:00
|
|
|
else:
|
2014-12-26 23:51:27 +01:00
|
|
|
col.prop(tex_slot, "use_random", text="Random")
|
|
|
|
if tex_slot.use_random:
|
2018-10-31 17:23:43 +01:00
|
|
|
col.prop(tex_slot, "random_angle", text="Random Angle")
|
2012-05-15 04:50:47 +00:00
|
|
|
|
|
|
|
# scale and offset
|
2018-10-31 17:23:43 +01:00
|
|
|
layout.prop(tex_slot, "offset")
|
|
|
|
layout.prop(tex_slot, "scale")
|
2013-02-10 08:54:10 +00:00
|
|
|
|
2013-01-16 12:57:35 +00:00
|
|
|
if sculpt:
|
|
|
|
# texture_sample_bias
|
2018-10-31 17:23:43 +01:00
|
|
|
layout.prop(brush, "texture_sample_bias", slider=True, text="Sample Bias")
|
2013-03-25 01:00:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
def brush_mask_texture_settings(layout, brush):
|
|
|
|
mask_tex_slot = brush.mask_texture_slot
|
|
|
|
|
2018-10-31 17:23:43 +01:00
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
|
|
|
|
# map_mode
|
2018-10-31 17:23:43 +01:00
|
|
|
layout.row().prop(mask_tex_slot, "mask_map_mode", text="Mask Mapping")
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
|
2013-04-23 11:34:18 +00:00
|
|
|
if mask_tex_slot.map_mode == 'STENCIL':
|
2013-04-30 10:32:02 +00:00
|
|
|
if brush.mask_texture and brush.mask_texture.type == 'IMAGE':
|
|
|
|
layout.operator("brush.stencil_fit_image_aspect").mask = True
|
2013-05-02 17:55:17 +00:00
|
|
|
layout.operator("brush.stencil_reset_transform").mask = True
|
2013-04-23 11:34:18 +00:00
|
|
|
|
2013-10-09 14:57:48 +00:00
|
|
|
col = layout.column()
|
2018-10-31 17:23:43 +01:00
|
|
|
col.prop(brush, "use_pressure_masking", text="Pressure Masking")
|
2014-12-26 23:51:27 +01:00
|
|
|
# angle and texture_angle_source
|
2014-12-30 18:06:59 +01:00
|
|
|
if mask_tex_slot.has_texture_angle:
|
2014-12-26 23:51:27 +01:00
|
|
|
col = layout.column()
|
2018-10-31 17:23:43 +01:00
|
|
|
col.prop(mask_tex_slot, "angle", text="Angle")
|
2014-12-30 18:06:59 +01:00
|
|
|
if mask_tex_slot.has_texture_angle_source:
|
2014-12-26 23:51:27 +01:00
|
|
|
col.prop(mask_tex_slot, "use_rake", text="Rake")
|
2015-01-29 15:35:06 +11:00
|
|
|
|
2014-12-30 18:06:59 +01:00
|
|
|
if brush.brush_capabilities.has_random_texture_angle and mask_tex_slot.has_random_texture_angle:
|
2014-12-26 23:51:27 +01:00
|
|
|
col.prop(mask_tex_slot, "use_random", text="Random")
|
|
|
|
if mask_tex_slot.use_random:
|
2018-10-31 17:23:43 +01:00
|
|
|
col.prop(mask_tex_slot, "random_angle", text="Random Angle")
|
2013-10-09 14:57:48 +00:00
|
|
|
|
|
|
|
# scale and offset
|
2018-10-31 17:23:43 +01:00
|
|
|
col.prop(mask_tex_slot, "offset")
|
|
|
|
col.prop(mask_tex_slot, "scale")
|
2017-03-18 20:03:24 +11:00
|
|
|
|
2019-01-02 14:36:56 +11:00
|
|
|
# Basic Brush Options
|
|
|
|
#
|
|
|
|
# Share between topbar and brush panel.
|
|
|
|
|
2019-03-20 10:44:13 +11:00
|
|
|
|
2019-01-02 14:36:56 +11:00
|
|
|
def brush_basic_wpaint_settings(layout, context, brush, *, compact=False):
|
2019-01-15 11:03:33 +11:00
|
|
|
capabilities = brush.weight_paint_capabilities
|
|
|
|
|
|
|
|
if capabilities.has_weight:
|
|
|
|
row = layout.row(align=True)
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_weight(row, context, brush, "weight", slider=True)
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
|
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
layout.prop(brush, "blend", text="" if compact else "Blend")
|
|
|
|
|
|
|
|
|
|
|
|
def brush_basic_vpaint_settings(layout, context, brush, *, compact=False):
|
2019-01-10 10:10:21 +11:00
|
|
|
capabilities = brush.vertex_paint_capabilities
|
|
|
|
|
2019-01-02 14:36:56 +11:00
|
|
|
row = layout.row(align=True)
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
|
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
2019-01-10 10:10:21 +11:00
|
|
|
if capabilities.has_color:
|
|
|
|
layout.prop(brush, "blend", text="" if compact else "Blend")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
|
|
|
|
def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
|
|
|
|
capabilities = brush.image_paint_capabilities
|
|
|
|
|
|
|
|
if capabilities.has_radius:
|
|
|
|
row = layout.row(align=True)
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
|
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
2019-01-10 10:10:21 +11:00
|
|
|
if capabilities.has_color:
|
2019-01-02 14:36:56 +11:00
|
|
|
layout.prop(brush, "blend", text="" if compact else "Blend")
|
|
|
|
|
|
|
|
|
|
|
|
def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
|
|
|
|
tool_settings = context.tool_settings
|
|
|
|
capabilities = brush.sculpt_capabilities
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
2019-01-02 17:23:57 +11:00
|
|
|
|
2019-01-02 14:36:56 +11:00
|
|
|
ups = tool_settings.unified_paint_settings
|
|
|
|
if (
|
2019-03-19 18:17:50 +01:00
|
|
|
(ups.use_unified_size and ups.use_locked_size == 'SCENE') or
|
|
|
|
((not ups.use_unified_size) and brush.use_locked_size == 'SCENE')
|
2019-01-02 14:36:56 +11:00
|
|
|
):
|
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "unprojected_radius", slider=True, text="Radius")
|
|
|
|
else:
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True)
|
2019-01-02 14:36:56 +11:00
|
|
|
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
# strength, use_strength_pressure, and use_strength_attenuation
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
if capabilities.has_strength_pressure:
|
2019-03-12 16:19:37 +11:00
|
|
|
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="")
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
# direction
|
2019-03-19 18:17:50 +01:00
|
|
|
if capabilities.has_direction == False:
|
|
|
|
layout.row().prop(brush, "direction", expand=True, **({"text": ""} if compact else {}))
|
2019-01-02 14:36:56 +11:00
|
|
|
|
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def brush_basic_gpencil_paint_settings(layout, _context, brush, *, _compact=True):
|
2019-01-02 14:36:56 +11:00
|
|
|
gp_settings = brush.gpencil_settings
|
|
|
|
|
|
|
|
# Brush details
|
|
|
|
if brush.gpencil_tool == 'ERASE':
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(brush, "size", text="Radius")
|
|
|
|
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
|
|
|
|
row.prop(gp_settings, "use_occlude_eraser", text="", icon='XRAY')
|
|
|
|
|
|
|
|
if gp_settings.eraser_mode == 'SOFT':
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(gp_settings, "pen_strength", slider=True)
|
|
|
|
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(gp_settings, "eraser_strength_factor")
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(gp_settings, "eraser_thickness_factor")
|
|
|
|
elif brush.gpencil_tool == 'FILL':
|
2019-03-17 19:47:31 +01:00
|
|
|
row = layout.row(align=True)
|
2019-01-11 17:22:13 +01:00
|
|
|
row.prop(gp_settings, "fill_leak", text="Leak Size")
|
2019-03-17 19:47:31 +01:00
|
|
|
row = layout.row(align=True)
|
2019-01-11 17:22:13 +01:00
|
|
|
row.prop(brush, "size", text="Thickness")
|
2019-03-17 19:47:31 +01:00
|
|
|
row = layout.row(align=True)
|
2019-01-11 17:22:13 +01:00
|
|
|
row.prop(gp_settings, "fill_simplify_level", text="Simplify")
|
2019-01-02 14:36:56 +11:00
|
|
|
row = layout.row(align=True)
|
2019-03-17 19:47:31 +01:00
|
|
|
row.prop(gp_settings, "fill_draw_mode", text="Boundary")
|
2019-01-02 14:36:56 +11:00
|
|
|
row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
|
|
|
|
else: # brush.gpencil_tool == 'DRAW':
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(brush, "size", text="Radius")
|
|
|
|
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(gp_settings, "pen_strength", slider=True)
|
|
|
|
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
|
|
|
|
|
|
|
|
|
|
|
|
def brush_basic_gpencil_sculpt_settings(layout, context, brush, *, compact=False):
|
|
|
|
tool_settings = context.tool_settings
|
|
|
|
settings = tool_settings.gpencil_sculpt
|
|
|
|
tool = settings.sculpt_tool
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(brush, "size", slider=True)
|
|
|
|
sub = row.row(align=True)
|
|
|
|
sub.enabled = tool not in {'GRAB', 'CLONE'}
|
|
|
|
sub.prop(brush, "use_pressure_radius", text="")
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(brush, "strength", slider=True)
|
|
|
|
row.prop(brush, "use_pressure_strength", text="")
|
|
|
|
|
|
|
|
layout.prop(brush, "use_falloff")
|
|
|
|
|
|
|
|
if compact:
|
|
|
|
if tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
|
|
|
|
row.separator()
|
|
|
|
row.prop(brush, "direction", expand=True, text="")
|
|
|
|
else:
|
|
|
|
use_property_split_prev = layout.use_property_split
|
|
|
|
layout.use_property_split = False
|
|
|
|
if tool in {'THICKNESS', 'STRENGTH'}:
|
|
|
|
layout.row().prop(brush, "direction", expand=True)
|
|
|
|
elif tool == 'PINCH':
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop_enum(brush, "direction", value='ADD', text="Pinch")
|
|
|
|
row.prop_enum(brush, "direction", value='SUBTRACT', text="Inflate")
|
|
|
|
elif tool == 'TWIST':
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop_enum(brush, "direction", value='ADD', text="CCW")
|
|
|
|
row.prop_enum(brush, "direction", value='SUBTRACT', text="CW")
|
|
|
|
layout.use_property_split = use_property_split_prev
|
|
|
|
|
|
|
|
|
2019-04-19 07:32:24 +02:00
|
|
|
def brush_basic_gpencil_weight_settings(layout, _context, brush, *, _compact=False):
|
2019-01-02 14:36:56 +11:00
|
|
|
layout.prop(brush, "size", slider=True)
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.prop(brush, "strength", slider=True)
|
|
|
|
row.prop(brush, "use_pressure_strength", text="")
|
|
|
|
|
|
|
|
layout.prop(brush, "use_falloff")
|
|
|
|
|
2019-01-02 15:31:56 +11:00
|
|
|
layout.prop(brush, "weight", slider=True)
|
2019-01-02 14:36:56 +11:00
|
|
|
|
2018-12-20 13:01:40 +11:00
|
|
|
|
2017-03-18 20:03:24 +11:00
|
|
|
classes = (
|
|
|
|
VIEW3D_MT_tools_projectpaint_clone,
|
|
|
|
)
|
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
from bpy.utils import register_class
|
|
|
|
for cls in classes:
|
|
|
|
register_class(cls)
|