Cleanup: tool settings access
This commit is contained in:
parent
64ecd3d2e7
commit
f7083b00ee
|
@ -38,7 +38,7 @@ class VIEW3D_HT_header(Header):
|
|||
# mode_string = context.mode
|
||||
obj = context.active_object
|
||||
overlay = view.overlay
|
||||
toolsettings = context.tool_settings
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.template_header()
|
||||
|
@ -62,7 +62,7 @@ class VIEW3D_HT_header(Header):
|
|||
# Particle edit
|
||||
if mode == 'PARTICLE_EDIT':
|
||||
row = layout.row()
|
||||
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
|
||||
row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True)
|
||||
|
||||
# Occlude geometry
|
||||
if ((shading.type not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH'))) or
|
||||
|
@ -87,8 +87,8 @@ class VIEW3D_HT_header(Header):
|
|||
layout.prop(context.gpencil_data, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH')
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(context.tool_settings.gpencil_sculpt, "use_select_mask")
|
||||
row.prop(context.tool_settings.gpencil_sculpt, "selection_alpha", slider=True)
|
||||
row.prop(tool_settings.gpencil_sculpt, "use_select_mask")
|
||||
row.prop(tool_settings.gpencil_sculpt, "selection_alpha", slider=True)
|
||||
|
||||
VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
|
||||
|
||||
|
@ -99,7 +99,7 @@ class VIEW3D_HT_header(Header):
|
|||
scene = context.scene
|
||||
|
||||
# Pivot & Orientation
|
||||
pivot_point = context.tool_settings.transform_pivot_point
|
||||
pivot_point = tool_settings.transform_pivot_point
|
||||
act_pivot_point = bpy.types.ToolSettings.bl_rna.properties['transform_pivot_point'].enum_items[pivot_point]
|
||||
row = layout.row(align=True)
|
||||
row.popover(
|
||||
|
@ -116,33 +116,33 @@ class VIEW3D_HT_header(Header):
|
|||
# Proportional editing
|
||||
if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "proportional_edit", icon_only=True)
|
||||
row.prop(tool_settings, "proportional_edit", icon_only=True)
|
||||
|
||||
sub = row.row(align=True)
|
||||
sub.active = toolsettings.proportional_edit != 'DISABLED'
|
||||
sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
|
||||
sub.active = tool_settings.proportional_edit != 'DISABLED'
|
||||
sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
|
||||
|
||||
elif object_mode in {'EDIT', 'PARTICLE_EDIT'}:
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "proportional_edit", icon_only=True)
|
||||
row.prop(tool_settings, "proportional_edit", icon_only=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = toolsettings.proportional_edit != 'DISABLED'
|
||||
sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
|
||||
sub.active = tool_settings.proportional_edit != 'DISABLED'
|
||||
sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
|
||||
|
||||
elif object_mode == 'OBJECT':
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "use_proportional_edit_objects", icon_only=True)
|
||||
row.prop(tool_settings, "use_proportional_edit_objects", icon_only=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = toolsettings.use_proportional_edit_objects
|
||||
sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
|
||||
sub.active = tool_settings.use_proportional_edit_objects
|
||||
sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
|
||||
else:
|
||||
# Proportional editing
|
||||
if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "proportional_edit", icon_only=True)
|
||||
row.prop(tool_settings, "proportional_edit", icon_only=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = toolsettings.proportional_edit != 'DISABLED'
|
||||
sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
|
||||
sub.active = tool_settings.proportional_edit != 'DISABLED'
|
||||
sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
|
||||
|
||||
# Snap
|
||||
show_snap = False
|
||||
|
@ -163,7 +163,7 @@ class VIEW3D_HT_header(Header):
|
|||
|
||||
if show_snap:
|
||||
snap_items = bpy.types.ToolSettings.bl_rna.properties['snap_elements'].enum_items
|
||||
for elem in toolsettings.snap_elements:
|
||||
for elem in tool_settings.snap_elements:
|
||||
# TODO: Display multiple icons.
|
||||
# (Currently only one of the enabled modes icons is displayed)
|
||||
icon = snap_items[elem].icon
|
||||
|
@ -172,7 +172,7 @@ class VIEW3D_HT_header(Header):
|
|||
icon = 'NONE'
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "use_snap", text="")
|
||||
row.prop(tool_settings, "use_snap", text="")
|
||||
|
||||
sub = row.row(align=True)
|
||||
sub.popover(
|
||||
|
@ -487,12 +487,12 @@ class VIEW3D_MT_edit_proportional(Menu):
|
|||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.props_enum(context.tool_settings, "proportional_edit")
|
||||
layout.props_enum(tool_settings, "proportional_edit")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.label("Falloff:")
|
||||
layout.props_enum(context.tool_settings, "proportional_edit_falloff")
|
||||
layout.props_enum(tool_settings, "proportional_edit_falloff")
|
||||
|
||||
|
||||
# ********** View menus **********
|
||||
|
@ -846,7 +846,8 @@ class VIEW3D_MT_edit_mesh_select_by_trait(Menu):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
if context.scene.tool_settings.mesh_select_mode[2] is False:
|
||||
tool_settings = context.tool_settings
|
||||
if tool_settings.mesh_select_mode[2] is False:
|
||||
layout.operator("mesh.select_non_manifold", text="Non Manifold")
|
||||
layout.operator("mesh.select_loose", text="Loose Geometry")
|
||||
layout.operator("mesh.select_interior_faces", text="Interior Faces")
|
||||
|
@ -1927,10 +1928,11 @@ class VIEW3D_MT_brush(Menu):
|
|||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
settings = UnifiedPaintPanel.paint_settings(context)
|
||||
brush = getattr(settings, "brush", None)
|
||||
|
||||
ups = context.tool_settings.unified_paint_settings
|
||||
ups = tool_settings.unified_paint_settings
|
||||
layout.prop(ups, "use_unified_size", text="Unified Size")
|
||||
layout.prop(ups, "use_unified_strength", text="Unified Strength")
|
||||
if context.image_paint_object or context.vertex_paint_object:
|
||||
|
@ -2113,8 +2115,8 @@ class VIEW3D_MT_sculpt(Menu):
|
|||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
toolsettings = context.tool_settings
|
||||
sculpt = toolsettings.sculpt
|
||||
tool_settings = context.tool_settings
|
||||
sculpt = tool_settings.sculpt
|
||||
|
||||
layout.prop(sculpt, "use_symmetry_x")
|
||||
layout.prop(sculpt, "use_symmetry_y")
|
||||
|
@ -2180,8 +2182,9 @@ class VIEW3D_MT_particle(Menu):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
particle_edit = context.tool_settings.particle_edit
|
||||
particle_edit = tool_settings.particle_edit
|
||||
|
||||
layout.operator("particle.mirror")
|
||||
|
||||
|
@ -2210,8 +2213,9 @@ class VIEW3D_MT_particle_specials(Menu):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
particle_edit = context.tool_settings.particle_edit
|
||||
particle_edit = tool_settings.particle_edit
|
||||
|
||||
layout.operator("particle.rekey")
|
||||
|
||||
|
@ -2546,9 +2550,9 @@ class VIEW3D_MT_edit_mesh(Menu):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
with_bullet = bpy.app.build_options.bullet
|
||||
toolsettings = context.tool_settings
|
||||
|
||||
layout.menu("VIEW3D_MT_transform")
|
||||
layout.menu("VIEW3D_MT_mirror")
|
||||
|
@ -2709,8 +2713,9 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
|
|||
|
||||
@staticmethod
|
||||
def extrude_options(context):
|
||||
tool_settings = context.tool_settings
|
||||
select_mode = tool_settings.mesh_select_mode
|
||||
mesh = context.object.data
|
||||
select_mode = context.tool_settings.mesh_select_mode
|
||||
|
||||
menu = []
|
||||
if mesh.total_face_sel:
|
||||
|
@ -3401,7 +3406,7 @@ class VIEW3D_MT_edit_gpencil(Menu):
|
|||
bl_label = "GPencil"
|
||||
|
||||
def draw(self, context):
|
||||
toolsettings = context.tool_settings
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
layout = self.layout
|
||||
|
||||
|
@ -3412,7 +3417,7 @@ class VIEW3D_MT_edit_gpencil(Menu):
|
|||
layout.separator()
|
||||
|
||||
layout.operator("gpencil.brush_paint", text="Sculpt Strokes").wait_for_input = True
|
||||
layout.prop_menu_enum(toolsettings.gpencil_sculpt, "tool", text="Sculpt Brush")
|
||||
layout.prop_menu_enum(tool_settings.gpencil_sculpt, "tool", text="Sculpt Brush")
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
@ -3696,7 +3701,6 @@ class VIEW3D_PT_overlay(Panel):
|
|||
view = context.space_data
|
||||
shading = view.shading
|
||||
overlay = view.overlay
|
||||
toolsettings = context.tool_settings
|
||||
display_all = overlay.show_overlays
|
||||
|
||||
col = layout.column()
|
||||
|
@ -3772,10 +3776,10 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
|
|||
view = context.space_data
|
||||
shading = view.shading
|
||||
overlay = view.overlay
|
||||
toolsettings = context.tool_settings
|
||||
tool_settings = context.tool_settings
|
||||
display_all = overlay.show_overlays
|
||||
data = context.active_object.data
|
||||
statvis = context.tool_settings.statvis
|
||||
statvis = tool_settings.statvis
|
||||
with_freestyle = bpy.app.build_options.freestyle
|
||||
|
||||
col = layout.column()
|
||||
|
@ -3823,7 +3827,7 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
|
|||
col.prop(overlay, "show_weight")
|
||||
if overlay.show_weight:
|
||||
col.label("Show Zero Weights:")
|
||||
col.row().prop(toolsettings, "vertex_group_user", expand=True)
|
||||
col.row().prop(tool_settings, "vertex_group_user", expand=True)
|
||||
|
||||
col.prop(data, "show_statvis", text="Mesh Analysis")
|
||||
if data.show_statvis:
|
||||
|
@ -3894,8 +3898,8 @@ class VIEW3D_PT_overlay_sculpt(Panel):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
toolsettings = context.tool_settings
|
||||
sculpt = toolsettings.sculpt
|
||||
tool_settings = context.tool_settings
|
||||
sculpt = tool_settings.sculpt
|
||||
|
||||
layout.prop(sculpt, "show_diffuse_color")
|
||||
layout.prop(sculpt, "show_mask")
|
||||
|
|
Loading…
Reference in New Issue