Cleanup: pep8, unused vars, line length
This commit is contained in:
parent
31ac2e292e
commit
165afb3ad0
@ -241,7 +241,8 @@ class ConnectRigidBodies(Operator):
|
||||
description="Pattern used to connect objects",
|
||||
items=(
|
||||
('SELECTED_TO_ACTIVE', "Selected to Active", "Connect selected objects to the active object"),
|
||||
('CHAIN_DISTANCE', "Chain by Distance", "Connect objects as a chain based on distance, starting at the active object"),
|
||||
('CHAIN_DISTANCE', "Chain by Distance", "Connect objects as a chain based on distance, "
|
||||
"starting at the active object"),
|
||||
),
|
||||
default='SELECTED_TO_ACTIVE',
|
||||
)
|
||||
|
@ -283,7 +283,16 @@ def mergeUvIslands(islandList):
|
||||
# UV Edge list used for intersections as well as unique points.
|
||||
edges, uniqueEdgePoints = island2Edge(islandList[islandIdx])
|
||||
|
||||
decoratedIslandList.append([islandList[islandIdx], totFaceArea, efficiency, islandBoundsArea, w, h, edges, uniqueEdgePoints])
|
||||
decoratedIslandList.append([
|
||||
islandList[islandIdx],
|
||||
totFaceArea,
|
||||
efficiency,
|
||||
islandBoundsArea,
|
||||
w,
|
||||
h,
|
||||
edges,
|
||||
uniqueEdgePoints,
|
||||
])
|
||||
|
||||
# Sort by island bounding box area, smallest face area first.
|
||||
# no.. chance that to most simple edge loop first.
|
||||
@ -389,7 +398,8 @@ def mergeUvIslands(islandList):
|
||||
|
||||
# testcount+=1
|
||||
# print 'Testing intersect'
|
||||
Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector((boxLeft, boxBottom)))
|
||||
Intersect = islandIntersectUvIsland(
|
||||
sourceIsland, targetIsland, Vector((boxLeft, boxBottom)))
|
||||
# print 'Done', Intersect
|
||||
if Intersect == 1: # Line intersect, don't bother with this any more
|
||||
pass
|
||||
|
@ -176,7 +176,14 @@ class VertexPaintDirt(Operator):
|
||||
obj = context.object
|
||||
mesh = obj.data
|
||||
|
||||
ret = applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, self.dirt_angle, self.clean_angle, self.dirt_only)
|
||||
ret = applyVertexDirt(
|
||||
mesh,
|
||||
self.blur_iterations,
|
||||
self.blur_strength,
|
||||
self.dirt_angle,
|
||||
self.clean_angle,
|
||||
self.dirt_only,
|
||||
)
|
||||
|
||||
return ret
|
||||
|
||||
|
@ -2414,6 +2414,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
|
||||
row.prop(md, "layer_pass", text="Pass")
|
||||
row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
|
||||
classes = (
|
||||
DATA_PT_modifiers,
|
||||
DATA_PT_gpencil_modifiers,
|
||||
|
@ -160,6 +160,7 @@ class GreasePencilSculptOptionsPanel:
|
||||
|
||||
layout.prop(settings, "use_edit_uv", text="Affect UV")
|
||||
|
||||
|
||||
# GP Object Tool Settings
|
||||
class GreasePencilDisplayPanel:
|
||||
bl_label = "Brush Tip"
|
||||
@ -175,9 +176,11 @@ class GreasePencilDisplayPanel:
|
||||
else:
|
||||
# GP Sculpt and Weight Paint always have Brush Tip panel.
|
||||
return True
|
||||
return False
|
||||
|
||||
def draw_header(self, context):
|
||||
if self.is_popover: return
|
||||
if self.is_popover:
|
||||
return
|
||||
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
brush = context.tool_settings.gpencil_paint.brush
|
||||
@ -506,7 +509,7 @@ class GPENCIL_MT_move_to_layer(Menu):
|
||||
gpl_active = context.active_gpencil_layer
|
||||
tot_layers = len(gpd.layers)
|
||||
i = tot_layers - 1
|
||||
while(i >= 0):
|
||||
while i >= 0:
|
||||
gpl = gpd.layers[i]
|
||||
if gpl.info == gpl_active.info:
|
||||
icon = 'GREASEPENCIL'
|
||||
@ -716,12 +719,11 @@ class GreasePencilToolsPanel:
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
def poll(cls, _context):
|
||||
# XXX - disabled in 2.8 branch.
|
||||
# return (context.gpencil_data is not None)
|
||||
return False
|
||||
|
||||
return (context.gpencil_data is not None)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -27,7 +27,8 @@ class UnifiedPaintPanel:
|
||||
|
||||
@staticmethod
|
||||
def get_brush_mode(context):
|
||||
"""Get the correct mode for this context. For any context where this returns None, no brush options should be displayed."""
|
||||
""" Get the correct mode for this context. For any context where this returns None,
|
||||
no brush options should be displayed."""
|
||||
|
||||
if context.mode == 'PARTICLE':
|
||||
# Particle brush settings currently completely do their own thing.
|
||||
@ -61,6 +62,7 @@ class UnifiedPaintPanel:
|
||||
else:
|
||||
return None
|
||||
return context.mode
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def paint_settings(context):
|
||||
@ -89,22 +91,35 @@ class UnifiedPaintPanel:
|
||||
return tool_settings.gpencil_paint
|
||||
elif mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
|
||||
return tool_settings.gpencil_sculpt
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def prop_unified(layout, context, brush, prop_name, unified_name=None, pressure_name=None, icon='NONE', text=None, slider=False, display_unified_toggle=True):
|
||||
""" Generalized way of adding brush options to the UI, along with their pen pressure setting and global toggle, if they exist """
|
||||
def prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
prop_name,
|
||||
unified_name=None,
|
||||
pressure_name=None,
|
||||
icon='NONE',
|
||||
text=None,
|
||||
slider=False,
|
||||
display_unified_toggle=True,
|
||||
):
|
||||
""" Generalized way of adding brush options to the UI,
|
||||
along with their pen pressure setting and global toggle, if they exist. """
|
||||
row = layout.row(align=True)
|
||||
ups = context.tool_settings.unified_paint_settings
|
||||
prop_owner = brush
|
||||
if(unified_name and getattr(ups, unified_name) and display_unified_toggle):
|
||||
if unified_name and getattr(ups, unified_name) and display_unified_toggle:
|
||||
prop_owner = ups
|
||||
|
||||
row.prop(prop_owner, prop_name, icon=icon, text=text, slider=slider)
|
||||
|
||||
if(pressure_name):
|
||||
if pressure_name:
|
||||
row.prop(brush, pressure_name, text="")
|
||||
|
||||
if(unified_name and display_unified_toggle):
|
||||
if unified_name and display_unified_toggle:
|
||||
row.prop(ups, unified_name, text="", icon="WORLD")
|
||||
|
||||
return row
|
||||
@ -138,7 +153,7 @@ class BrushSelectPanel(BrushPanel):
|
||||
brush = settings.brush
|
||||
|
||||
row = layout.row()
|
||||
large_preview=True
|
||||
large_preview = True
|
||||
if large_preview:
|
||||
row.column().template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8, hide_buttons=False)
|
||||
else:
|
||||
@ -170,6 +185,7 @@ class ColorPalettePanel(BrushPanel):
|
||||
elif context.vertex_paint_object:
|
||||
capabilities = brush.vertex_paint_capabilities
|
||||
return capabilities.has_color
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -195,6 +211,7 @@ class ClonePanel(BrushPanel):
|
||||
if mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
|
||||
brush = settings.brush
|
||||
return brush.image_tool == 'CLONE'
|
||||
return False
|
||||
|
||||
def draw_header(self, context):
|
||||
settings = self.paint_settings(context)
|
||||
@ -203,7 +220,6 @@ class ClonePanel(BrushPanel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
layout.active = settings.use_clone_layer
|
||||
|
||||
@ -213,16 +229,22 @@ class ClonePanel(BrushPanel):
|
||||
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)
|
||||
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)
|
||||
col.template_list(
|
||||
"TEXTURE_UL_texpaintslots", "",
|
||||
mat, "texture_paint_images",
|
||||
mat, "paint_clone_slot",
|
||||
rows=2,
|
||||
)
|
||||
|
||||
elif settings.mode == 'IMAGE':
|
||||
mesh = ob.data
|
||||
@ -286,7 +308,6 @@ class StrokePanel(BrushPanel):
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
mode = self.get_brush_mode(context)
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
@ -356,6 +377,7 @@ class SmoothStrokePanel(BrushPanel):
|
||||
brush = settings.brush
|
||||
if brush.brush_capabilities.has_smooth_stroke:
|
||||
return True
|
||||
return False
|
||||
|
||||
def draw_header(self, context):
|
||||
settings = self.paint_settings(context)
|
||||
@ -497,7 +519,8 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu):
|
||||
|
||||
|
||||
def brush_settings(layout, context, brush, popover=False):
|
||||
""" Draw simple brush settings for Sculpt, Texture/Vertex/Weight Paint modes, or skip certain settings for the popover """
|
||||
""" Draw simple brush settings for Sculpt,
|
||||
Texture/Vertex/Weight Paint modes, or skip certain settings for the popover """
|
||||
|
||||
mode = UnifiedPaintPanel.get_brush_mode(context)
|
||||
|
||||
@ -513,7 +536,14 @@ def brush_settings(layout, context, brush, popover=False):
|
||||
|
||||
# auto_smooth_factor and use_inverse_smooth_pressure
|
||||
if capabilities.has_auto_smooth:
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "auto_smooth_factor", pressure_name="use_inverse_smooth_pressure", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"auto_smooth_factor",
|
||||
pressure_name="use_inverse_smooth_pressure",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
# topology_rake_factor
|
||||
if (
|
||||
@ -540,7 +570,14 @@ def brush_settings(layout, context, brush, popover=False):
|
||||
# plane_offset, use_offset_pressure, use_plane_trim, plane_trim
|
||||
if capabilities.has_plane_offset:
|
||||
layout.separator()
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "plane_offset", pressure_name="use_offset_pressure", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"plane_offset",
|
||||
pressure_name="use_offset_pressure",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
layout.prop(brush, "use_plane_trim", text="Plane Trim")
|
||||
row = layout.row()
|
||||
@ -581,11 +618,11 @@ def brush_settings(layout, context, brush, popover=False):
|
||||
|
||||
if brush.sculpt_tool == 'SCRAPE':
|
||||
row = layout.row()
|
||||
row.prop(brush, "invert_to_scrape_fill", text = "Invert to Fill")
|
||||
row.prop(brush, "invert_to_scrape_fill", text="Invert to Fill")
|
||||
|
||||
if brush.sculpt_tool == 'FILL':
|
||||
row = layout.row()
|
||||
row.prop(brush, "invert_to_scrape_fill", text = "Invert to Scrape")
|
||||
row.prop(brush, "invert_to_scrape_fill", text="Invert to Scrape")
|
||||
|
||||
if brush.sculpt_tool == 'GRAB':
|
||||
layout.prop(brush, "use_grab_active_vertex")
|
||||
@ -599,14 +636,16 @@ def brush_settings(layout, context, brush, popover=False):
|
||||
if brush.sculpt_tool == 'MASK':
|
||||
layout.row().prop(brush, "mask_tool", expand=True)
|
||||
|
||||
# 3D and 2D Texture Paint Mode #
|
||||
# 3D and 2D Texture Paint Mode.
|
||||
elif mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
|
||||
capabilities = brush.image_paint_capabilities
|
||||
|
||||
if brush.image_tool == 'FILL':
|
||||
if(brush.color_type == 'COLOR' and mode=='PAINT_2D'): # For some reason fill threshold only appears to be implemented in 2D paint.
|
||||
layout.prop(brush, "fill_threshold", text="Fill Threshold", slider=True)
|
||||
if(brush.color_type == 'GRADIENT'):
|
||||
# For some reason fill threshold only appears to be implemented in 2D paint.
|
||||
if brush.color_type == 'COLOR':
|
||||
if mode == 'PAINT_2D':
|
||||
layout.prop(brush, "fill_threshold", text="Fill Threshold", slider=True)
|
||||
elif brush.color_type == 'GRADIENT':
|
||||
layout.row().prop(brush, "gradient_fill_mode", expand=True)
|
||||
|
||||
|
||||
@ -654,7 +693,8 @@ def brush_shared_settings(layout, context, brush, popover=False):
|
||||
size = True
|
||||
weight = brush.weight_paint_capabilities.has_weight
|
||||
strength = strength_pressure = True
|
||||
if(brush.weight_tool=='DRAW'): # Only draw blend mode for the Draw tool, because for other tools it is pointless. D5928#137944
|
||||
# Only draw blend mode for the Draw tool, because for other tools it is pointless. D5928#137944
|
||||
if brush.weight_tool == 'DRAW':
|
||||
blend_mode = True
|
||||
|
||||
# UV Sculpt #
|
||||
@ -670,7 +710,14 @@ def brush_shared_settings(layout, context, brush, popover=False):
|
||||
layout.separator()
|
||||
|
||||
if weight:
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", unified_name="use_unified_weight", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"weight",
|
||||
unified_name="use_unified_weight",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
size_owner = ups if ups.use_unified_size else brush
|
||||
size_prop = "size"
|
||||
@ -678,14 +725,31 @@ def brush_shared_settings(layout, context, brush, popover=False):
|
||||
size_prop = "unprojected_radius"
|
||||
if size or size_mode:
|
||||
if size:
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, size_prop, unified_name="use_unified_size", pressure_name="use_pressure_size", text="Radius", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
size_prop,
|
||||
unified_name="use_unified_size",
|
||||
pressure_name="use_pressure_size",
|
||||
text="Radius",
|
||||
slider=True,
|
||||
)
|
||||
if size_mode:
|
||||
layout.row().prop(size_owner, "use_locked_size", expand=True)
|
||||
layout.separator()
|
||||
|
||||
if strength:
|
||||
pressure_name = "use_pressure_strength" if strength_pressure else None
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name=pressure_name, slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
unified_name="use_unified_strength",
|
||||
pressure_name=pressure_name,
|
||||
slider=True,
|
||||
)
|
||||
layout.separator()
|
||||
|
||||
if direction:
|
||||
@ -722,7 +786,7 @@ def brush_settings_advanced(layout, context, brush, popover=False):
|
||||
layout.prop(brush, "use_original_plane")
|
||||
layout.separator()
|
||||
|
||||
# 3D and 2D Texture Paint #
|
||||
# 3D and 2D Texture Paint.
|
||||
elif mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
|
||||
capabilities = brush.image_paint_capabilities
|
||||
use_accumulate = capabilities.has_accumulate
|
||||
@ -762,9 +826,7 @@ def brush_settings_advanced(layout, context, brush, popover=False):
|
||||
use_accumulate = True
|
||||
use_frontface = True
|
||||
|
||||
### Draw shared settings. ###
|
||||
ups = context.scene.tool_settings.unified_paint_settings
|
||||
|
||||
# Draw shared settings.
|
||||
if use_accumulate:
|
||||
layout.prop(brush, "use_accumulate")
|
||||
|
||||
@ -800,7 +862,15 @@ def draw_color_settings(context, layout, brush, color_type=False):
|
||||
col = layout.column()
|
||||
|
||||
if brush.image_tool == 'DRAW':
|
||||
UnifiedPaintPanel.prop_unified(col, context, brush, "secondary_color", unified_name="use_unified_color", text="Background Color", display_unified_toggle=False)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
col,
|
||||
context,
|
||||
brush,
|
||||
"secondary_color",
|
||||
unified_name="use_unified_color",
|
||||
text="Background Color",
|
||||
display_unified_toggle=False,
|
||||
)
|
||||
|
||||
col.prop(brush, "gradient_stroke_mode", text="Gradient Mapping")
|
||||
if brush.gradient_stroke_mode in {'SPACING_REPEAT', 'SPACING_CLAMP'}:
|
||||
@ -885,18 +955,33 @@ def brush_mask_texture_settings(layout, brush):
|
||||
# scale and offset
|
||||
col.prop(mask_tex_slot, "offset")
|
||||
col.prop(mask_tex_slot, "scale")
|
||||
|
||||
|
||||
def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
|
||||
"""Draw Tool Settings header for Vertex Paint and 2D and 3D Texture Paint modes."""
|
||||
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
|
||||
capabilities = brush.image_paint_capabilities
|
||||
|
||||
|
||||
if capabilities.has_color:
|
||||
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
|
||||
layout.prop(brush, "blend", text="" if compact else "Blend")
|
||||
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True, text="Radius")
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength")
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"size",
|
||||
pressure_name="use_pressure_size",
|
||||
slider=True,
|
||||
text="Radius",
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
pressure_name="use_pressure_strength",
|
||||
)
|
||||
|
||||
|
||||
def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False):
|
||||
|
@ -119,6 +119,7 @@ def find_modifier(ob, psys):
|
||||
if md.type == 'PARTICLE_SYSTEM':
|
||||
if md.particle_system == psys:
|
||||
return md
|
||||
return None
|
||||
|
||||
|
||||
class PARTICLE_UL_particle_systems(bpy.types.UIList):
|
||||
@ -159,7 +160,10 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
engine = context.engine
|
||||
return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES)
|
||||
return (
|
||||
(context.particle_system or context.object or context.space_data.pin_id) and
|
||||
(engine in cls.COMPAT_ENGINES)
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -160,6 +160,7 @@ class PHYSICS_PT_cloth_damping(PhysicButtonsPanel, Panel):
|
||||
col = flow.column()
|
||||
col.prop(cloth, "bending_damping", text="Bending")
|
||||
|
||||
|
||||
class PHYSICS_PT_cloth_internal_springs(PhysicButtonsPanel, Panel):
|
||||
bl_label = "Internal Springs"
|
||||
bl_parent_id = 'PHYSICS_PT_cloth_physical_properties'
|
||||
@ -201,6 +202,7 @@ class PHYSICS_PT_cloth_internal_springs(PhysicButtonsPanel, Panel):
|
||||
col = flow.column()
|
||||
col.prop(cloth, "internal_compression_stiffness_max", text="Max Compression")
|
||||
|
||||
|
||||
class PHYSICS_PT_cloth_pressure(PhysicButtonsPanel, Panel):
|
||||
bl_label = "Pressure"
|
||||
bl_parent_id = 'PHYSICS_PT_cloth_physical_properties'
|
||||
|
@ -657,6 +657,7 @@ class DOPESHEET_MT_snap_pie(Menu):
|
||||
pie.operator("action.snap", text="Nearest Second").type = 'NEAREST_SECOND'
|
||||
pie.operator("action.snap", text="Nearest Marker").type = 'NEAREST_MARKER'
|
||||
|
||||
|
||||
class LayersDopeSheetPanel:
|
||||
bl_space_type = 'DOPESHEET_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
|
@ -162,7 +162,7 @@ def panel_poll_is_upper_region(region):
|
||||
|
||||
|
||||
class FILEBROWSER_UL_dir(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, icon, _active_data, active_propname, _index):
|
||||
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
|
||||
direntry = item
|
||||
# space = context.space_data
|
||||
|
||||
|
@ -294,7 +294,9 @@ class GRAPH_MT_key(Menu):
|
||||
operator_context = layout.operator_context
|
||||
|
||||
layout.operator("graph.decimate", text="Decimate (Ratio)").mode = 'RATIO'
|
||||
# Using the modal operation doesn't make sense for this variant as we do not have a modal mode for it, so just execute it.
|
||||
|
||||
# Using the modal operation doesn't make sense for this variant
|
||||
# as we do not have a modal mode for it, so just execute it.
|
||||
layout.operator_context = 'EXEC_DEFAULT'
|
||||
layout.operator("graph.decimate", text="Decimate (Allowed Change)").mode = 'ERROR'
|
||||
layout.operator_context = operator_context
|
||||
|
@ -231,7 +231,7 @@ class IMAGE_MT_image(Menu):
|
||||
|
||||
if ima and not show_render:
|
||||
if ima.packed_file:
|
||||
if len(ima.filepath):
|
||||
if ima.filepath:
|
||||
layout.separator()
|
||||
layout.operator("image.unpack", text="Unpack")
|
||||
else:
|
||||
@ -590,8 +590,22 @@ class _draw_tool_settings_context_mode:
|
||||
brush = uv_sculpt.brush
|
||||
if brush:
|
||||
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"size",
|
||||
pressure_name="use_pressure_size",
|
||||
slider=True,
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
pressure_name="use_pressure_strength",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def PAINT(context, layout, tool):
|
||||
@ -738,7 +752,6 @@ class MASK_MT_editor_menus(Menu):
|
||||
|
||||
show_uvedit = sima.show_uvedit
|
||||
show_maskedit = sima.show_maskedit
|
||||
show_paint = sima.show_paint
|
||||
|
||||
layout.menu("IMAGE_MT_view")
|
||||
|
||||
@ -1037,7 +1050,7 @@ class IMAGE_PT_render_slots(Panel):
|
||||
|
||||
|
||||
class IMAGE_UL_udim_tiles(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
def draw_item(self, _context, layout, _data, item, _icon, _active_data, _active_propname, _index):
|
||||
tile = item
|
||||
layout.prop(tile, "label", text="", emboss=False)
|
||||
|
||||
@ -1079,6 +1092,7 @@ class IMAGE_PT_paint_select(Panel, ImagePaintPanel, BrushSelectPanel):
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_category = "Tool"
|
||||
|
||||
|
||||
class IMAGE_PT_paint_settings(Panel, ImagePaintPanel):
|
||||
bl_context = ".paint_common_2d"
|
||||
bl_category = "Tool"
|
||||
@ -1226,6 +1240,7 @@ class IMAGE_PT_tools_imagepaint_symmetry(BrushButtonsPanel, Panel):
|
||||
row.prop(ipaint, "tile_x", text="X", toggle=True)
|
||||
row.prop(ipaint, "tile_y", text="Y", toggle=True)
|
||||
|
||||
|
||||
class UVSculptPanel(UnifiedPaintPanel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@ -1255,7 +1270,9 @@ class IMAGE_PT_uv_sculpt_brush_settings(Panel, ImagePaintPanel, UVSculptPanel):
|
||||
|
||||
if brush:
|
||||
if brush.uv_sculpt_tool == 'RELAX':
|
||||
# Although this settings is stored in the scene, it is only used by a single tool, so it doesn't make sense from a user perspective to move it to the Options panel.
|
||||
# Although this settings is stored in the scene,
|
||||
# it is only used by a single tool,
|
||||
# so it doesn't make sense from a user perspective to move it to the Options panel.
|
||||
layout.prop(tool_settings, "uv_relax_method")
|
||||
|
||||
|
||||
@ -1266,6 +1283,7 @@ class IMAGE_PT_uv_sculpt_curve(Panel, FalloffPanel, ImagePaintPanel, UVSculptPan
|
||||
bl_label = "Falloff"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
|
||||
class IMAGE_PT_uv_sculpt_options(Panel, ImagePaintPanel, UVSculptPanel):
|
||||
bl_context = ".uv_sculpt" # dot on purpose (access from topbar)
|
||||
bl_category = "Tool"
|
||||
|
@ -676,7 +676,6 @@ class ToolSelectPanelHelper:
|
||||
space_type = context.space_data.type
|
||||
return ToolSelectPanelHelper._tool_active_from_context(context, space_type)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def draw_active_tool_fallback(
|
||||
context, layout, tool,
|
||||
|
@ -594,7 +594,7 @@ class _defs_edit_mesh:
|
||||
props = tool.operator_properties("mesh.bevel")
|
||||
region_type = context.region.type
|
||||
|
||||
if extra == False:
|
||||
if not extra:
|
||||
if props.offset_type == 'PERCENT':
|
||||
layout.prop(props, "offset_pct")
|
||||
else:
|
||||
|
@ -1213,7 +1213,12 @@ class ThemeGenericClassGenerator():
|
||||
"datapath": new_datapath,
|
||||
})
|
||||
|
||||
yield from generate_child_panel_classes_recurse(panel_id, prop.fixed_type, theme_area, new_datapath)
|
||||
yield from generate_child_panel_classes_recurse(
|
||||
panel_id,
|
||||
prop.fixed_type,
|
||||
theme_area,
|
||||
new_datapath,
|
||||
)
|
||||
|
||||
yield from generate_child_panel_classes_recurse(parent_id, rna_type, theme_area, datapath)
|
||||
|
||||
|
@ -262,11 +262,26 @@ class _draw_tool_settings_context_mode:
|
||||
size = "unprojected_radius"
|
||||
|
||||
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, size, pressure_name="use_pressure_size", text="Radius", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
size,
|
||||
pressure_name="use_pressure_size",
|
||||
text="Radius",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
# strength, use_strength_pressure
|
||||
pressure_name = "use_pressure_strength" if capabilities.has_strength_pressure else None
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name=pressure_name, text="Strength")
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
pressure_name=pressure_name,
|
||||
text="Strength",
|
||||
)
|
||||
|
||||
# direction
|
||||
if not capabilities.has_direction:
|
||||
@ -316,8 +331,22 @@ class _draw_tool_settings_context_mode:
|
||||
if capabilities.has_weight:
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", slider=True)
|
||||
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True, text="Radius")
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength")
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"size",
|
||||
pressure_name="use_pressure_size",
|
||||
slider=True,
|
||||
text="Radius",
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
pressure_name="use_pressure_strength",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def PAINT_GPENCIL(context, layout, tool):
|
||||
@ -5502,9 +5531,10 @@ class VIEW3D_PT_shading_render_pass(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.space_data.shading.type == 'MATERIAL'
|
||||
or (context.engine in cls.COMPAT_ENGINES
|
||||
and context.space_data.shading.type == 'RENDERED'))
|
||||
return (
|
||||
(context.space_data.shading.type == 'MATERIAL') or
|
||||
(context.engine in cls.COMPAT_ENGINES and context.space_data.shading.type == 'RENDERED')
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
shading = context.space_data.shading
|
||||
@ -6690,8 +6720,25 @@ class VIEW3D_PT_paint_vertex_context_menu(Panel):
|
||||
UnifiedPaintPanel.prop_unified_color_picker(split, context, brush, "color", value_slider=True)
|
||||
layout.prop(brush, "blend", text="")
|
||||
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"size",
|
||||
unified_name="use_unified_size",
|
||||
pressure_name="use_pressure_size",
|
||||
slider=True,
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
unified_name="use_unified_strength",
|
||||
pressure_name="use_pressure_strength",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
|
||||
class VIEW3D_PT_paint_texture_context_menu(Panel):
|
||||
# Only for popover, these are dummy values.
|
||||
@ -6712,8 +6759,24 @@ class VIEW3D_PT_paint_texture_context_menu(Panel):
|
||||
layout.prop(brush, "blend", text="")
|
||||
|
||||
if capabilities.has_radius:
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"size",
|
||||
unified_name="use_unified_size",
|
||||
pressure_name="use_pressure_size",
|
||||
slider=True,
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
unified_name="use_unified_strength",
|
||||
pressure_name="use_pressure_strength",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
|
||||
class VIEW3D_PT_paint_weight_context_menu(Panel):
|
||||
@ -6726,9 +6789,32 @@ class VIEW3D_PT_paint_weight_context_menu(Panel):
|
||||
layout = self.layout
|
||||
|
||||
brush = context.tool_settings.weight_paint.brush
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", unified_name="use_unified_weight", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"weight",
|
||||
unified_name="use_unified_weight",
|
||||
slider=True,
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"size",
|
||||
unified_name="use_unified_size",
|
||||
pressure_name="use_pressure_size",
|
||||
slider=True,
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
unified_name="use_unified_strength",
|
||||
pressure_name="use_pressure_strength",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
|
||||
class VIEW3D_PT_sculpt_context_menu(Panel):
|
||||
@ -6743,8 +6829,24 @@ class VIEW3D_PT_sculpt_context_menu(Panel):
|
||||
brush = context.tool_settings.sculpt.brush
|
||||
capabilities = brush.sculpt_capabilities
|
||||
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"size",
|
||||
unified_name="use_unified_size",
|
||||
pressure_name="use_pressure_size",
|
||||
slider=True,
|
||||
)
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
layout,
|
||||
context,
|
||||
brush,
|
||||
"strength",
|
||||
unified_name="use_unified_strength",
|
||||
pressure_name="use_pressure_strength",
|
||||
slider=True,
|
||||
)
|
||||
|
||||
if capabilities.has_auto_smooth:
|
||||
layout.prop(brush, "auto_smooth_factor", slider=True)
|
||||
|
@ -321,6 +321,7 @@ class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
|
||||
|
||||
# ********** default tools for paint modes ****************
|
||||
|
||||
|
||||
class TEXTURE_UL_texpaintslots(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
|
||||
# mat = data
|
||||
@ -331,6 +332,7 @@ class TEXTURE_UL_texpaintslots(UIList):
|
||||
layout.alignment = 'CENTER'
|
||||
layout.label(text="")
|
||||
|
||||
|
||||
class View3DPaintPanel(View3DPanel, UnifiedPaintPanel):
|
||||
bl_category = "Tool"
|
||||
|
||||
@ -409,6 +411,7 @@ class VIEW3D_PT_tools_brush_settings(Panel, View3DPaintBrushPanel):
|
||||
|
||||
brush_settings(layout.column(), context, brush, popover=self.is_popover)
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel):
|
||||
bl_context = ".paint_common"
|
||||
bl_parent_id = "VIEW3D_PT_tools_brush_settings"
|
||||
@ -436,20 +439,22 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
|
||||
def poll(cls, context):
|
||||
settings = cls.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
if context.image_paint_object:
|
||||
capabilities = brush.image_paint_capabilities
|
||||
return capabilities.has_color
|
||||
|
||||
elif context.vertex_paint_object:
|
||||
capabilities = brush.vertex_paint_capabilities
|
||||
return capabilities.has_color
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
settings = self.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
draw_color_settings(context, layout, brush, color_type = not context.vertex_paint_object)
|
||||
draw_color_settings(context, layout, brush, color_type=not context.vertex_paint_object)
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel, ColorPalettePanel):
|
||||
@ -852,6 +857,7 @@ class VIEW3D_PT_sculpt_voxel_remesh(Panel, View3DPaintPanel):
|
||||
col.prop(mesh, "use_remesh_preserve_paint_mask")
|
||||
col.operator("object.voxel_remesh", text="Remesh")
|
||||
|
||||
|
||||
# TODO, move to space_view3d.py
|
||||
class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
|
||||
bl_context = ".sculpt_mode" # dot on purpose (access from topbar)
|
||||
@ -879,6 +885,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
|
||||
col = flow.column()
|
||||
col.prop(sculpt, "use_deform_only")
|
||||
|
||||
|
||||
class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel):
|
||||
bl_context = ".sculpt_mode" # dot on purpose (access from topbar)
|
||||
bl_parent_id = "VIEW3D_PT_sculpt_options"
|
||||
@ -1047,11 +1054,11 @@ class VIEW3D_PT_tools_vertexpaint_options(Panel, View3DPaintPanel):
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(self, context):
|
||||
def poll(self, _context):
|
||||
# This is currently unused, since there aren't any Vertex Paint mode specific options.
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
@ -1206,12 +1213,12 @@ class VIEW3D_PT_imagepaint_options(View3DPaintPanel):
|
||||
bl_label = "Options"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
def poll(cls, _context):
|
||||
# This is currently unused, since there aren't any Vertex Paint mode specific options.
|
||||
return False
|
||||
return (context.image_paint_object and context.tool_settings.image_paint)
|
||||
# return (context.image_paint_object and context.tool_settings.image_paint)
|
||||
|
||||
def draw(self, context):
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
@ -1370,7 +1377,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_select(Panel, View3DPanel, GreasePenci
|
||||
|
||||
col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
|
||||
|
||||
if(brush.use_custom_icon):
|
||||
if brush.use_custom_icon:
|
||||
layout.row().prop(brush, "icon_filepath", text="")
|
||||
else:
|
||||
layout.row().prop(gp_settings, "gp_icon", text="Icon")
|
||||
@ -1482,7 +1489,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(Panel, View3DPanel):
|
||||
return brush is not None and brush.gpencil_tool == 'DRAW'
|
||||
|
||||
def draw_header(self, context):
|
||||
if self.is_popover: return
|
||||
if self.is_popover:
|
||||
return
|
||||
|
||||
brush = context.tool_settings.gpencil_paint.brush
|
||||
gp_settings = brush.gpencil_settings
|
||||
@ -1521,7 +1529,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_post_processing(View3DPanel, Panel):
|
||||
return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL'}
|
||||
|
||||
def draw_header(self, context):
|
||||
if self.is_popover: return
|
||||
if self.is_popover:
|
||||
return
|
||||
|
||||
brush = context.tool_settings.gpencil_paint.brush
|
||||
gp_settings = brush.gpencil_settings
|
||||
@ -1575,7 +1584,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel):
|
||||
return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL'}
|
||||
|
||||
def draw_header(self, context):
|
||||
if self.is_popover: return
|
||||
if self.is_popover:
|
||||
return
|
||||
|
||||
brush = context.tool_settings.gpencil_paint.brush
|
||||
gp_settings = brush.gpencil_settings
|
||||
@ -1734,7 +1744,6 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_select(Panel, View3DPanel):
|
||||
layout.use_property_decorate = False
|
||||
|
||||
settings = context.tool_settings.gpencil_sculpt
|
||||
brush = settings.brush
|
||||
|
||||
layout.template_icon_view(settings, "sculpt_tool", show_labels=True)
|
||||
|
||||
@ -1760,6 +1769,7 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_settings(Panel, View3DPanel):
|
||||
|
||||
# Grease Pencil weight painting tools
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_grease_pencil_weight_paint_select(View3DPanel, Panel):
|
||||
bl_context = ".greasepencil_weight"
|
||||
bl_label = "Brushes"
|
||||
@ -1771,7 +1781,6 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint_select(View3DPanel, Panel):
|
||||
layout.use_property_decorate = False
|
||||
|
||||
settings = context.tool_settings.gpencil_sculpt
|
||||
brush = settings.brush
|
||||
|
||||
layout.template_icon_view(settings, "weight_tool", show_labels=True)
|
||||
|
||||
@ -1789,7 +1798,6 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint_settings(Panel, View3DPanel):
|
||||
settings = context.tool_settings.gpencil_sculpt
|
||||
brush = settings.brush
|
||||
|
||||
|
||||
if not self.is_popover:
|
||||
from bl_ui.properties_paint_common import (
|
||||
brush_basic_gpencil_weight_settings,
|
||||
|
Loading…
x
Reference in New Issue
Block a user