Cleanup: reduce right-shift in startup scripts

Also un-wrap lines that fit in the column width.
This commit is contained in:
Campbell Barton 2024-04-30 12:46:05 +10:00
parent 85e4a7e445
commit 56388dc8fe
29 changed files with 284 additions and 188 deletions

@ -248,8 +248,8 @@ class NLA_OT_bake(Operator):
description="Which data's transformations to bake",
options={'ENUM_FLAG'},
items=(
('POSE', "Pose", "Bake bones transformations"),
('OBJECT', "Object", "Bake object transformations"),
('POSE', "Pose", "Bake bones transformations"),
('OBJECT', "Object", "Bake object transformations"),
),
default={'POSE'},
)

@ -208,8 +208,10 @@ def find_next(ele_dst, ele_src):
continue
depth_test = tuple(zip(depth_test_a, depth_test_b))
# square so a few high values win over many small ones
diff_test = sum((abs(a[0] - b[0]) ** 2) +
(abs(a[1] - b[1]) ** 2) for a, b in zip(depth_src, depth_test))
diff_test = sum(
(abs(a[0] - b[0]) ** 2) +
(abs(a[1] - b[1]) ** 2) for a, b in zip(depth_src, depth_test)
)
if diff_test > diff_best:
diff_best = diff_test
ele_best = ele_test

@ -440,8 +440,7 @@ class CLIP_OT_constraint_to_fcurve(Operator):
con = x
if not con:
self.report({'ERROR'},
"Motion Tracking constraint to be converted not found")
self.report({'ERROR'}, "Motion Tracking constraint to be converted not found")
return {'CANCELLED'}
@ -452,8 +451,7 @@ class CLIP_OT_constraint_to_fcurve(Operator):
clip = con.clip
if not clip:
self.report({'ERROR'},
"Movie clip to use tracking data from isn't set")
self.report({'ERROR'}, "Movie clip to use tracking data from isn't set")
return {'CANCELLED'}

@ -294,8 +294,10 @@ class WM_OT_blend_strings_utf8_validate(Operator):
for it in getattr(bpy.data, prop.identifier):
changed |= self.validate_strings(it, done_items)
if changed:
self.report({'WARNING'},
"Some strings were fixed, don't forget to save the .blend file to keep those changes")
self.report(
{'WARNING'},
"Some strings were fixed, don't forget to save the .blend file to keep those changes",
)
return {'FINISHED'}

@ -143,9 +143,14 @@ def create_wrapper_group(modifier, old_group):
group.interface.new_socket(data_("Geometry"), in_out='OUTPUT', socket_type='NodeSocketGeometry')
group.is_modifier = True
first_geometry_input = next((item for item in old_group.interface.items_tree if item.item_type == 'SOCKET' and
item.in_out == 'INPUT' and
item.bl_socket_idname == 'NodeSocketGeometry'), None)
first_geometry_input = next(
(
item for item in old_group.interface.items_tree if item.item_type == 'SOCKET' and
item.in_out == 'INPUT' and
item.bl_socket_idname == 'NodeSocketGeometry'
),
None,
)
if first_geometry_input:
group.interface.new_socket(data_("Geometry"), in_out='INPUT', socket_type='NodeSocketGeometry')
group_input_node = group.nodes.new('NodeGroupInput')
@ -180,8 +185,10 @@ def create_wrapper_group(modifier, old_group):
group_node_input.default_value = modifier[identifier]
if first_geometry_input:
group.links.new(group_input_node.outputs[0],
get_socket_with_identifier(group_node.inputs, first_geometry_input.identifier))
group.links.new(
group_input_node.outputs[0],
get_socket_with_identifier(group_node.inputs, first_geometry_input.identifier),
)
# Adjust locations of named attribute input nodes and group input node to make some space.
if input_nodes:

@ -75,9 +75,11 @@ class EditExternally(Operator):
except BaseException:
import traceback
traceback.print_exc()
self.report({'ERROR'},
"Image editor could not be launched, ensure that "
"the path in User Preferences > File is valid, and Blender has rights to launch it")
self.report(
{'ERROR'},
"Image editor could not be launched, ensure that "
"the path in User Preferences > File is valid, and Blender has rights to launch it",
)
return {'CANCELLED'}

@ -58,8 +58,10 @@ class MeshMirrorUV(Operator):
mirror_lt[co] = i
vmap = {}
for mirror_a, mirror_b in ((mirror_gt, mirror_lt),
(mirror_lt, mirror_gt)):
for mirror_a, mirror_b in (
(mirror_gt, mirror_lt),
(mirror_lt, mirror_gt),
):
for co, i in mirror_a.items():
nco = (-co[0], co[1], co[2])
j = mirror_b.get(nco)

@ -363,13 +363,17 @@ class ShapeTransfer(Operator):
for ob_other in objects:
if ob_other.type != 'MESH':
self.report({'WARNING'},
rpt_("Skipping '{:s}', not a mesh").format(ob_other.name))
self.report(
{'WARNING'},
rpt_("Skipping '{:s}', not a mesh").format(ob_other.name),
)
continue
me_other = ob_other.data
if len(me_other.vertices) != len(me.vertices):
self.report({'WARNING'},
rpt_("Skipping '{:s}', vertex count differs").format(ob_other.name))
self.report(
{'WARNING'},
rpt_("Skipping '{:s}', vertex count differs").format(ob_other.name),
)
continue
target_normals = me_nos(me_other.vertices)
@ -397,14 +401,15 @@ class ShapeTransfer(Operator):
v_before = idxs[-2]
v = idxs[-1]
for v_after in idxs:
pt = barycentric_transform(orig_shape_coords[v],
orig_coords[v_before],
orig_coords[v],
orig_coords[v_after],
target_coords[v_before],
target_coords[v],
target_coords[v_after],
)
pt = barycentric_transform(
orig_shape_coords[v],
orig_coords[v_before],
orig_coords[v],
orig_coords[v_after],
target_coords[v_before],
target_coords[v],
target_coords[v_after],
)
median_coords[v].append(pt)
v_before = v
v = v_after
@ -467,10 +472,7 @@ class ShapeTransfer(Operator):
if 1: # swap from/to, means we can't copy to many at once.
if len(objects) != 1:
self.report({'ERROR'},
("Expected one other selected "
"mesh object to copy from"))
self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
return {'CANCELLED'}
ob_act, objects = objects[0], [ob_act]
@ -524,44 +526,47 @@ class JoinUVs(Operator):
obj_other.data.tag = False
for obj_other in objects:
if obj_other != obj and obj_other.type == 'MESH':
mesh_other = obj_other.data
if mesh_other != mesh:
if mesh_other.tag is False:
mesh_other.tag = True
if not (obj_other != obj and obj_other.type == 'MESH'):
continue
mesh_other = obj_other.data
if mesh_other == mesh:
continue
if mesh_other.tag is True:
continue
if len(mesh_other.loops) != nbr_loops:
self.report(
{'WARNING'},
rpt_(
"Object: {:s}, Mesh: '{:s}' has {:d} loops (for {:d} faces), expected {:d}\n"
).format(
obj_other.name,
mesh_other.name,
len(mesh_other.loops),
len(mesh_other.polygons),
nbr_loops,
),
)
else:
uv_other = mesh_other.uv_layers.active
if not uv_other:
mesh_other.uv_layers.new()
uv_other = mesh_other.uv_layers.active
if not uv_other:
self.report(
{'ERROR'},
rpt_(
"Could not add a new UV map to object '{:s}' (Mesh '{:s}')\n"
).format(
obj_other.name,
mesh_other.name,
),
)
mesh_other.tag = True
if len(mesh_other.loops) != nbr_loops:
self.report(
{'WARNING'},
rpt_(
"Object: {:s}, Mesh: '{:s}' has {:d} loops (for {:d} faces), expected {:d}"
).format(
obj_other.name,
mesh_other.name,
len(mesh_other.loops),
len(mesh_other.polygons),
nbr_loops,
),
)
else:
uv_other = mesh_other.uv_layers.active
if not uv_other:
mesh_other.uv_layers.new()
uv_other = mesh_other.uv_layers.active
if not uv_other:
self.report(
{'ERROR'},
rpt_(
"Could not add a new UV map to object '{:s}' (Mesh '{:s}')"
).format(
obj_other.name,
mesh_other.name,
),
)
# finally do the copy
uv_other.data.foreach_set("uv", uv_array)
mesh_other.update()
# finally do the copy
uv_other.data.foreach_set("uv", uv_array)
mesh_other.update()
if is_editmode:
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
@ -821,9 +826,12 @@ class TransformsToDeltasAnim(Operator):
# ensure that this index hasn't occurred before
if fcu.array_index in existingFCurves[dpath]:
# conflict
self.report({'ERROR'},
rpt_("Object {!r} already has {!r} F-Curve(s). "
"Remove these before trying again").format(obj.name, dpath))
self.report(
{'ERROR'},
rpt_(
"Object {!r} already has {!r} F-Curve(s). "
"Remove these before trying again"
).format(obj.name, dpath))
return {'CANCELLED'}
else:
# no conflict here

@ -107,17 +107,21 @@ class QuickFur(ObjectModeOperator, Operator):
node_groups_to_append.add("Hair Curves Noise")
if self.use_frizz:
node_groups_to_append.add("Frizz Hair Curves")
assets_directory = os.path.join(bpy.utils.system_resource('DATAFILES'),
"assets",
"geometry_nodes",
"procedural_hair_node_assets.blend",
"NodeTree")
assets_directory = os.path.join(
bpy.utils.system_resource('DATAFILES'),
"assets",
"geometry_nodes",
"procedural_hair_node_assets.blend",
"NodeTree",
)
for name in node_groups_to_append:
bpy.ops.wm.append(directory=assets_directory,
filename=name,
use_recursive=True,
clear_asset_data=True,
do_reuse_local_id=True)
bpy.ops.wm.append(
directory=assets_directory,
filename=name,
use_recursive=True,
clear_asset_data=True,
do_reuse_local_id=True,
)
generate_group = bpy.data.node_groups["Generate Hair Curves"]
interpolate_group = bpy.data.node_groups["Interpolate Hair Curves"]
radius_group = bpy.data.node_groups["Set Hair Curve Profile"]

@ -174,13 +174,17 @@ def extend(obj, EXTEND_MODE, use_uv_selection):
else:
fac = 1.0
extrapolate_uv(fac,
l_a_uv[3], l_a_uv[0],
l_b_uv[3], l_b_uv[0])
extrapolate_uv(
fac,
l_a_uv[3], l_a_uv[0],
l_b_uv[3], l_b_uv[0],
)
extrapolate_uv(fac,
l_a_uv[2], l_a_uv[1],
l_b_uv[2], l_b_uv[1])
extrapolate_uv(
fac,
l_a_uv[2], l_a_uv[1],
l_b_uv[2], l_b_uv[1],
)
# -------------------------------------------
# Calculate average length per loop if needed.

@ -127,8 +127,10 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
layer_rows = 7
col = row.column()
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, sort_reverse=True, sort_lock=True)
col.template_list(
"GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, sort_reverse=True, sort_lock=True,
)
col = row.column()
sub = col.column(align=True)

@ -63,8 +63,10 @@ class GreasePencil_LayerMaskPanel:
rows = 4
row = layout.row()
col = row.column()
col.template_list("GREASE_PENCIL_UL_masks", "", layer, "mask_layers", layer.mask_layers,
"active_mask_index", rows=rows, sort_lock=True)
col.template_list(
"GREASE_PENCIL_UL_masks", "", layer, "mask_layers", layer.mask_layers,
"active_mask_index", rows=rows, sort_lock=True,
)
col = row.column(align=True)
col.menu("GREASE_PENCIL_MT_layer_mask_add", icon='ADD', text="")

@ -57,8 +57,10 @@ class OBJECT_MT_modifier_add(ModifierAddMenu, Menu):
def draw(self, context):
layout = self.layout
ob_type = context.object.type
geometry_nodes_supported = ob_type in {'MESH', 'CURVE', 'CURVES',
'FONT', 'VOLUME', 'POINTCLOUD', 'GREASEPENCIL'}
geometry_nodes_supported = ob_type in {
'MESH', 'CURVE', 'CURVES',
'FONT', 'VOLUME', 'POINTCLOUD', 'GREASEPENCIL',
}
if layout.operator_context == 'EXEC_REGION_WIN':
layout.operator_context = 'INVOKE_REGION_WIN'

@ -468,8 +468,10 @@ class AnnotationDataPanel:
layer_rows = 5
else:
layer_rows = 3
col.template_list("GPENCIL_UL_annotation_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, sort_reverse=True, sort_lock=True)
col.template_list(
"GPENCIL_UL_annotation_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, sort_reverse=True, sort_lock=True,
)
col = row.column()

@ -98,8 +98,10 @@ class MASK_PT_layers:
rows = 4 if active_layer else 1
row = layout.row()
row.template_list("MASK_UL_layers", "", mask, "layers",
mask, "active_layer_index", rows=rows)
row.template_list(
"MASK_UL_layers", "", mask, "layers",
mask, "active_layer_index", rows=rows,
)
sub = row.column(align=True)

@ -33,8 +33,10 @@ class GPENCIL_MT_material_context_menu(Menu):
layout.operator(
"grease_pencil.material_copy_to_object",
text="Copy Material to Selected").only_active = True
layout.operator("grease_pencil.material_copy_to_object",
text="Copy All Materials to Selected").only_active = False
layout.operator(
"grease_pencil.material_copy_to_object",
text="Copy All Materials to Selected",
).only_active = False
else:
layout.operator("gpencil.material_reveal", icon='RESTRICT_VIEW_OFF', text="Show All")
@ -56,8 +58,10 @@ class GPENCIL_MT_material_context_menu(Menu):
layout.separator()
layout.operator("gpencil.materials_copy_to_object", text="Copy Material to Selected").only_active = True
layout.operator("gpencil.materials_copy_to_object",
text="Copy All Materials to Selected").only_active = False
layout.operator(
"gpencil.materials_copy_to_object",
text="Copy All Materials to Selected",
).only_active = False
layout.separator()

@ -1092,8 +1092,10 @@ class PARTICLE_PT_physics_relations(ParticleButtonsPanel, Panel):
part = particle_get_settings(context)
row = layout.row()
row.template_list("UI_UL_list", "particle_targets", psys, "targets",
psys, "active_particle_target_index", rows=4)
row.template_list(
"UI_UL_list", "particle_targets", psys, "targets",
psys, "active_particle_target_index", rows=4,
)
col = row.column()
sub = col.row()
@ -1150,8 +1152,10 @@ class PARTICLE_PT_physics_fluid_interaction(ParticleButtonsPanel, Panel):
psys = context.particle_system
row = layout.row()
row.template_list("UI_UL_list", "particle_targets", psys, "targets",
psys, "active_particle_target_index", rows=4)
row.template_list(
"UI_UL_list", "particle_targets", psys, "targets",
psys, "active_particle_target_index", rows=4,
)
col = row.column()
sub = col.row()
@ -1324,8 +1328,10 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
# layout.prop(state, "name", text="State name")
row = layout.row()
row.template_list("UI_UL_list", "particle_boids_rules", state,
"rules", state, "active_boid_rule_index", rows=4)
row.template_list(
"UI_UL_list", "particle_boids_rules", state,
"rules", state, "active_boid_rule_index", rows=4,
)
col = row.column()
sub = col.row()
@ -1619,8 +1625,10 @@ class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel):
layout.active = part.use_collection_count and not part.use_whole_collection
row = layout.row()
row.template_list("UI_UL_list", "particle_instance_weights", part, "instance_weights",
part, "active_instanceweight_index")
row.template_list(
"UI_UL_list", "particle_instance_weights", part, "instance_weights",
part, "active_instanceweight_index",
)
col = row.column()
sub = col.row()

@ -38,8 +38,10 @@ class PHYSICS_PT_geometry_nodes(Panel):
calc_text = iface_("Calculate to Frame")
bake_text = iface_("Bake")
layout.operator("object.simulation_nodes_cache_calculate_to_frame",
text=calc_text, translate=False).selected = True
layout.operator(
"object.simulation_nodes_cache_calculate_to_frame",
text=calc_text, translate=False,
).selected = True
row = layout.row(align=True)
row.operator("object.simulation_nodes_cache_bake", text=bake_text, translate=False).selected = True

@ -261,9 +261,11 @@ class ViewLayerCryptomattePanel(ViewLayerButtonsPanel, Panel):
col.prop(view_layer, "use_pass_cryptomatte_material", text="Material")
col.prop(view_layer, "use_pass_cryptomatte_asset", text="Asset")
col = layout.column()
col.active = any((view_layer.use_pass_cryptomatte_object,
view_layer.use_pass_cryptomatte_material,
view_layer.use_pass_cryptomatte_asset))
col.active = any((
view_layer.use_pass_cryptomatte_object,
view_layer.use_pass_cryptomatte_material,
view_layer.use_pass_cryptomatte_asset,
))
col.prop(view_layer, "pass_cryptomatte_depth", text="Levels")
if context.engine == 'BLENDER_EEVEE':
@ -298,8 +300,10 @@ class ViewLayerLightgroupsPanel(ViewLayerButtonsPanel, Panel):
row = layout.row()
col = row.column()
col.template_list("UI_UL_list", "lightgroups", view_layer,
"lightgroups", view_layer, "active_lightgroup_index", rows=3)
col.template_list(
"UI_UL_list", "lightgroups", view_layer,
"lightgroups", view_layer, "active_lightgroup_index", rows=3,
)
col = row.column()
sub = col.column(align=True)

@ -21,14 +21,16 @@ class CLIP_UL_tracking_objects(UIList):
# assert(isinstance(item, bpy.types.MovieTrackingObject)
tobj = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.prop(tobj, "name", text="", emboss=False,
icon='CAMERA_DATA' if tobj.is_camera
else 'OBJECT_DATA')
layout.prop(
tobj, "name", text="", emboss=False,
icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA',
)
elif self.layout_type == 'GRID':
layout.alignment = 'CENTER'
layout.label(text="",
icon='CAMERA_DATA' if tobj.is_camera
else 'OBJECT_DATA')
layout.label(
text="",
icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA',
)
class CLIP_PT_display(Panel):
@ -573,9 +575,13 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
col = layout.column(align=True)
col.scale_y = 2.0
col.operator("clip.solve_camera",
text="Solve Camera Motion" if tracking_object.is_camera
else "Solve Object Motion")
col.operator(
"clip.solve_camera",
text=(
"Solve Camera Motion" if tracking_object.is_camera else
"Solve Object Motion"
),
)
class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):

@ -795,8 +795,10 @@ class ASSETBROWSER_PT_metadata_tags(asset_utils.AssetMetaDataPanel, Panel):
asset_data = asset_utils.SpaceAssetInfo.get_active_asset(context)
row = layout.row()
row.template_list("ASSETBROWSER_UL_metadata_tags", "asset_tags", asset_data, "tags",
asset_data, "active_tag", rows=4)
row.template_list(
"ASSETBROWSER_UL_metadata_tags", "asset_tags", asset_data, "tags",
asset_data, "active_tag", rows=4,
)
col = row.column(align=True)
col.operator("asset.tag_add", icon='ADD', text="")

@ -264,10 +264,14 @@ class NLA_MT_strips(Menu):
layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
else:
layout.operator("nla.tweakmode_enter", text="Start Editing Stashed Action").isolate_action = True
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Full Stack)").use_upper_stack_evaluation = True
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Lower Stack)").use_upper_stack_evaluation = False
layout.operator(
"nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Full Stack)",
).use_upper_stack_evaluation = True
layout.operator(
"nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Lower Stack)",
).use_upper_stack_evaluation = False
class NLA_MT_strips_transform(Menu):
@ -325,10 +329,14 @@ class NLA_MT_context_menu(Menu):
layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
else:
layout.operator("nla.tweakmode_enter", text="Start Editing Stashed Action").isolate_action = True
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Full Stack)").use_upper_stack_evaluation = True
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Lower Stack)").use_upper_stack_evaluation = False
layout.operator(
"nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Full Stack)",
).use_upper_stack_evaluation = True
layout.operator(
"nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Lower Stack)",
).use_upper_stack_evaluation = False
layout.separator()

@ -359,19 +359,25 @@ class OUTLINER_MT_liboverride(Menu):
def draw(self, _context):
layout = self.layout
layout.operator_menu_enum("outliner.liboverride_operation", "selection_set",
text="Make").type = 'OVERRIDE_LIBRARY_CREATE_HIERARCHY'
layout.operator_menu_enum(
"outliner.liboverride_operation", "selection_set",
text="Make",
).type = 'OVERRIDE_LIBRARY_CREATE_HIERARCHY'
layout.operator_menu_enum(
"outliner.liboverride_operation",
"selection_set",
text="Reset").type = 'OVERRIDE_LIBRARY_RESET'
layout.operator_menu_enum("outliner.liboverride_operation", "selection_set",
text="Clear").type = 'OVERRIDE_LIBRARY_CLEAR_SINGLE'
layout.operator_menu_enum(
"outliner.liboverride_operation", "selection_set",
text="Clear",
).type = 'OVERRIDE_LIBRARY_CLEAR_SINGLE'
layout.separator()
layout.operator_menu_enum("outliner.liboverride_troubleshoot_operation", "type",
text="Troubleshoot").selection_set = 'SELECTED'
layout.operator_menu_enum(
"outliner.liboverride_troubleshoot_operation", "type",
text="Troubleshoot",
).selection_set = 'SELECTED'
class OUTLINER_PT_filter(Panel):

@ -367,12 +367,8 @@ class TEXT_MT_edit_to3d(Menu):
def draw(self, _context):
layout = self.layout
layout.operator("text.to_3d_object",
text="One Object",
).split_lines = False
layout.operator("text.to_3d_object",
text="One Object Per Line",
).split_lines = True
layout.operator("text.to_3d_object", text="One Object").split_lines = False
layout.operator("text.to_3d_object", text="One Object Per Line").split_lines = True
class TEXT_MT_edit(Menu):

@ -134,8 +134,10 @@ class TOPBAR_PT_gpencil_layers(Panel):
col = row.column()
layer_rows = 10
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, sort_reverse=True, sort_lock=True)
col.template_list(
"GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, sort_reverse=True, sort_lock=True,
)
gpl = context.active_gpencil_layer
if gpl:
@ -377,10 +379,11 @@ class TOPBAR_MT_file_defaults(Menu):
display_name = bpy.path.display_name(iface_(app_template))
props = layout.operator("wm.read_factory_settings", text="Load Factory Blender Settings")
props.app_template = app_template
props = layout.operator("wm.read_factory_settings",
text=iface_("Load Factory {:s} Settings",
i18n_contexts.operator_default).format(display_name),
translate=False)
props = layout.operator(
"wm.read_factory_settings",
text=iface_("Load Factory {:s} Settings", i18n_contexts.operator_default).format(display_name),
translate=False,
)
props.app_template = app_template
props.use_factory_startup_app_template_only = True
del display_name

@ -122,9 +122,11 @@ class USERPREF_MT_save_load(Menu):
if app_template:
display_name = bpy.path.display_name(iface_(app_template))
layout.operator("wm.read_factory_userpref", text="Load Factory Blender Preferences")
props = layout.operator("wm.read_factory_userpref",
text=iface_("Load Factory {:s} Preferences").format(display_name),
translate=False)
props = layout.operator(
"wm.read_factory_userpref",
text=iface_("Load Factory {:s} Preferences").format(display_name),
translate=False,
)
props.use_factory_startup_app_template_only = True
del display_name
else:

@ -1186,24 +1186,28 @@ class VIEW3D_HT_header(Header):
@staticmethod
def _sculpt_automasking_icon(sculpt):
automask_enabled = (sculpt.use_automasking_topology or
sculpt.use_automasking_face_sets or
sculpt.use_automasking_boundary_edges or
sculpt.use_automasking_boundary_face_sets or
sculpt.use_automasking_cavity or
sculpt.use_automasking_cavity_inverted or
sculpt.use_automasking_start_normal or
sculpt.use_automasking_view_normal)
automask_enabled = (
sculpt.use_automasking_topology or
sculpt.use_automasking_face_sets or
sculpt.use_automasking_boundary_edges or
sculpt.use_automasking_boundary_face_sets or
sculpt.use_automasking_cavity or
sculpt.use_automasking_cavity_inverted or
sculpt.use_automasking_start_normal or
sculpt.use_automasking_view_normal
)
return "CLIPUV_DEHLT" if automask_enabled else "CLIPUV_HLT"
@staticmethod
def _gpencil_sculpt_automasking_icon(gpencil_sculpt):
automask_enabled = (gpencil_sculpt.use_automasking_stroke or
gpencil_sculpt.use_automasking_layer_stroke or
gpencil_sculpt.use_automasking_material_stroke or
gpencil_sculpt.use_automasking_material_active or
gpencil_sculpt.use_automasking_layer_active)
automask_enabled = (
gpencil_sculpt.use_automasking_stroke or
gpencil_sculpt.use_automasking_layer_stroke or
gpencil_sculpt.use_automasking_material_stroke or
gpencil_sculpt.use_automasking_material_active or
gpencil_sculpt.use_automasking_layer_active
)
return "CLIPUV_DEHLT" if automask_enabled else "CLIPUV_HLT"
@ -2552,8 +2556,10 @@ class VIEW3D_MT_surface_add(Menu):
layout.operator("surface.primitive_nurbs_surface_curve_add", text="Nurbs Curve", icon='SURFACE_NCURVE')
layout.operator("surface.primitive_nurbs_surface_circle_add", text="Nurbs Circle", icon='SURFACE_NCIRCLE')
layout.operator("surface.primitive_nurbs_surface_surface_add", text="Nurbs Surface", icon='SURFACE_NSURFACE')
layout.operator("surface.primitive_nurbs_surface_cylinder_add",
text="Nurbs Cylinder", icon='SURFACE_NCYLINDER')
layout.operator(
"surface.primitive_nurbs_surface_cylinder_add",
text="Nurbs Cylinder", icon='SURFACE_NCYLINDER',
)
layout.operator("surface.primitive_nurbs_surface_sphere_add", text="Nurbs Sphere", icon='SURFACE_NSPHERE')
layout.operator("surface.primitive_nurbs_surface_torus_add", text="Nurbs Torus", icon='SURFACE_NTORUS')
@ -2682,9 +2688,11 @@ class VIEW3D_MT_volume_add(Menu):
def draw(self, _context):
layout = self.layout
layout.operator("object.volume_import", text="Import OpenVDB...", icon='OUTLINER_DATA_VOLUME')
layout.operator("object.volume_add", text="Empty",
text_ctxt=i18n_contexts.id_volume,
icon='OUTLINER_DATA_VOLUME')
layout.operator(
"object.volume_add", text="Empty",
text_ctxt=i18n_contexts.id_volume,
icon='OUTLINER_DATA_VOLUME',
)
class VIEW3D_MT_grease_pencil_add(Menu):
@ -2757,9 +2765,11 @@ class VIEW3D_MT_add(Menu):
layout.separator()
layout.operator_menu_enum("object.empty_add", "type", text="Empty",
text_ctxt=i18n_contexts.id_id,
icon='OUTLINER_OB_EMPTY')
layout.operator_menu_enum(
"object.empty_add", "type", text="Empty",
text_ctxt=i18n_contexts.id_id,
icon='OUTLINER_OB_EMPTY',
)
layout.menu("VIEW3D_MT_image_add", text="Image", icon='OUTLINER_OB_IMAGE')
layout.separator()

@ -1481,8 +1481,10 @@ class VIEW3D_PT_tools_particlemode_options(View3DPanel, Panel):
if pe.type == 'PARTICLES':
if ob.particle_systems:
if len(ob.particle_systems) > 1:
layout.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
ob.particle_systems, "active_index", rows=2, maxrows=3)
layout.template_list(
"UI_UL_list", "particle_systems", ob, "particle_systems",
ob.particle_systems, "active_index", rows=2, maxrows=3,
)
ptcache = ob.particle_systems.active.point_cache
else:
@ -1491,8 +1493,10 @@ class VIEW3D_PT_tools_particlemode_options(View3DPanel, Panel):
ptcache = md.point_cache
if ptcache and len(ptcache.point_caches) > 1:
layout.template_list("UI_UL_list", "particles_point_caches", ptcache, "point_caches",
ptcache.point_caches, "active_index", rows=2, maxrows=3)
layout.template_list(
"UI_UL_list", "particles_point_caches", ptcache, "point_caches",
ptcache.point_caches, "active_index", rows=2, maxrows=3,
)
if not pe.is_editable:
layout.label(text="Point cache must be baked")

@ -80,9 +80,11 @@ def node_group_items(context):
# Filter out hidden node-trees.
if group.name.startswith('.'):
continue
yield NodeItem(node_tree_group_type[group.bl_idname],
label=group.name,
settings={"node_tree": "bpy.data.node_groups[{!r}]".format(group.name)})
yield NodeItem(
node_tree_group_type[group.bl_idname],
label=group.name,
settings={"node_tree": "bpy.data.node_groups[{!r}]".format(group.name)},
)
# only show input/output nodes inside node groups