Cleanup: tweak multi-line parenthesis for Python scripts
Reduce right shift, moving closing parenthesis onto own line for clarity & reducing diff noise in some cases. Ref !147857
This commit is contained in:
@@ -328,7 +328,9 @@ class GreasePencilStroke(AttributeGetterSetter):
|
||||
previous_end = self._points_end_index
|
||||
new_size = self._points_end_index - self._points_start_index + count
|
||||
self._drawing.resize_strokes(
|
||||
sizes=[new_size], indices=[self._curve_index])
|
||||
sizes=[new_size],
|
||||
indices=[self._curve_index],
|
||||
)
|
||||
self._points_end_index = self._points_start_index + new_size
|
||||
return GreasePencilStrokePointSlice(self._drawing, self._curve_index, previous_end, self._points_end_index)
|
||||
|
||||
@@ -341,7 +343,9 @@ class GreasePencilStroke(AttributeGetterSetter):
|
||||
if new_size < 1:
|
||||
new_size = 1
|
||||
self._drawing.resize_strokes(
|
||||
sizes=[new_size], indices=[self._curve_index])
|
||||
sizes=[new_size],
|
||||
indices=[self._curve_index],
|
||||
)
|
||||
self._points_end_index = self._points_start_index + new_size
|
||||
|
||||
@property
|
||||
|
||||
@@ -129,8 +129,10 @@ def write(output):
|
||||
output.write("OpenColorIO: ")
|
||||
if ocio.supported:
|
||||
if ocio.version_string == "fallback":
|
||||
output.write("Blender was built with OpenColorIO, "
|
||||
"but it currently uses fallback color management.\n")
|
||||
output.write(
|
||||
"Blender was built with OpenColorIO, "
|
||||
"but it currently uses fallback color management.\n"
|
||||
)
|
||||
else:
|
||||
output.write("{:s}\n".format(ocio.version_string))
|
||||
else:
|
||||
|
||||
@@ -142,10 +142,12 @@ class Library(_types.ID):
|
||||
"fonts", "worlds",
|
||||
)
|
||||
|
||||
return tuple(id_block
|
||||
for attr in attr_links
|
||||
for id_block in getattr(bpy.data, attr)
|
||||
if id_block.library == self)
|
||||
return tuple(
|
||||
id_block
|
||||
for attr in attr_links
|
||||
for id_block in getattr(bpy.data, attr)
|
||||
if id_block.library == self
|
||||
)
|
||||
|
||||
|
||||
class Texture(_types.ID):
|
||||
@@ -1197,10 +1199,17 @@ class Header(_StructRNA, _GenericUI, metaclass=_RNAMeta):
|
||||
class Menu(_StructRNA, _GenericUI, metaclass=_RNAMeta):
|
||||
__slots__ = ()
|
||||
|
||||
def path_menu(self, searchpaths, operator, *,
|
||||
props_default=None, prop_filepath="filepath",
|
||||
filter_ext=None, filter_path=None, display_name=None,
|
||||
add_operator=None, add_operator_props=None):
|
||||
def path_menu(
|
||||
self, searchpaths, operator,
|
||||
*,
|
||||
props_default=None,
|
||||
prop_filepath="filepath",
|
||||
filter_ext=None,
|
||||
filter_path=None,
|
||||
display_name=None,
|
||||
add_operator=None,
|
||||
add_operator_props=None,
|
||||
):
|
||||
"""
|
||||
Populate a menu from a list of paths.
|
||||
|
||||
@@ -1370,14 +1379,16 @@ class NodeSocket(_StructRNA, metaclass=_RNAMetaPropGroup):
|
||||
|
||||
.. note:: Takes ``O(len(nodetree.links))`` time.
|
||||
"""
|
||||
links = (link for link in self.id_data.links
|
||||
if self in (link.from_socket, link.to_socket))
|
||||
|
||||
links = (
|
||||
link for link in self.id_data.links
|
||||
if self in (link.from_socket, link.to_socket)
|
||||
)
|
||||
if not self.is_output:
|
||||
links = sorted(links,
|
||||
key=lambda link: link.multi_input_sort_id,
|
||||
reverse=True)
|
||||
|
||||
links = sorted(
|
||||
links,
|
||||
key=lambda link: link.multi_input_sort_id,
|
||||
reverse=True,
|
||||
)
|
||||
return tuple(links)
|
||||
|
||||
|
||||
|
||||
@@ -168,8 +168,11 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
|
||||
|
||||
if km_items_data := get_transform_modal_map():
|
||||
def use_alt_navigate():
|
||||
km_item = next((i for i in km_items_data["items"] if i[0] ==
|
||||
"PROPORTIONAL_SIZE" and i[1]["type"] == 'TRACKPADPAN'), None)
|
||||
km_item = next(
|
||||
(i for i in km_items_data["items"] if i[0] ==
|
||||
"PROPORTIONAL_SIZE" and i[1]["type"] == 'TRACKPADPAN'),
|
||||
None,
|
||||
)
|
||||
if km_item:
|
||||
return "alt" not in km_item[1] or km_item[1]["alt"] is False
|
||||
|
||||
|
||||
@@ -341,8 +341,10 @@ def bake_action_iter(
|
||||
for name, pbone in obj.pose.bones.items():
|
||||
if bake_options.do_visual_keying:
|
||||
# Get the final transform of the bone in its own local space...
|
||||
matrix[name] = obj.convert_space(pose_bone=pbone, matrix=pbone.matrix,
|
||||
from_space='POSE', to_space='LOCAL')
|
||||
matrix[name] = obj.convert_space(
|
||||
pose_bone=pbone, matrix=pbone.matrix,
|
||||
from_space='POSE', to_space='LOCAL',
|
||||
)
|
||||
else:
|
||||
matrix[name] = pbone.matrix_basis.copy()
|
||||
|
||||
@@ -461,8 +463,12 @@ def bake_action_iter(
|
||||
|
||||
if bake_options.do_pose:
|
||||
for f, armature_custom_properties in armature_info:
|
||||
bake_custom_properties(obj, custom_props=armature_custom_properties,
|
||||
frame=f, group_name="Armature Custom Properties")
|
||||
bake_custom_properties(
|
||||
obj,
|
||||
custom_props=armature_custom_properties,
|
||||
frame=f,
|
||||
group_name="Armature Custom Properties"
|
||||
)
|
||||
|
||||
for name, pbone in obj.pose.bones.items():
|
||||
if bake_options.only_selected and not pbone.select:
|
||||
|
||||
@@ -121,7 +121,11 @@ class ImportHelper:
|
||||
confirm_text = iface_(self.bl_label, i18n_contexts.operator_default)
|
||||
|
||||
return context.window_manager.invoke_props_dialog(
|
||||
self, confirm_text=confirm_text, title=title, translate=False)
|
||||
self,
|
||||
confirm_text=confirm_text,
|
||||
title=title,
|
||||
translate=False,
|
||||
)
|
||||
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
@@ -309,8 +313,7 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'):
|
||||
return Matrix().to_3x3()
|
||||
|
||||
if from_forward[-1] == from_up[-1] or to_forward[-1] == to_up[-1]:
|
||||
raise Exception("Invalid axis arguments passed, "
|
||||
"cannot use up/forward on the same axis")
|
||||
raise Exception("Invalid axis arguments passed, cannot use up/forward on the same axis")
|
||||
|
||||
value = reduce(
|
||||
int.__or__,
|
||||
@@ -498,9 +501,10 @@ def path_reference(
|
||||
elif mode == 'MATCH':
|
||||
mode = 'RELATIVE' if is_relative else 'ABSOLUTE'
|
||||
elif mode == 'AUTO':
|
||||
mode = ('RELATIVE'
|
||||
if bpy.path.is_subdir(filepath_abs, base_dst)
|
||||
else 'ABSOLUTE')
|
||||
mode = (
|
||||
'RELATIVE' if bpy.path.is_subdir(filepath_abs, base_dst) else
|
||||
'ABSOLUTE'
|
||||
)
|
||||
elif mode == 'COPY':
|
||||
subdir_abs = os.path.normpath(base_dst)
|
||||
if copy_subdir:
|
||||
|
||||
@@ -591,8 +591,10 @@ class ShaderImageTextureWrapper:
|
||||
owner_shader._textures[(node_dst, socket_dst)] = instance
|
||||
return instance
|
||||
|
||||
def __init__(self, owner_shader: ShaderWrapper, node_dst, socket_dst, grid_row_diff=0,
|
||||
use_alpha=False, colorspace_is_data=..., colorspace_name=...):
|
||||
def __init__(
|
||||
self, owner_shader: ShaderWrapper, node_dst, socket_dst, grid_row_diff=0,
|
||||
use_alpha=False, colorspace_is_data=..., colorspace_name=...,
|
||||
):
|
||||
self.owner_shader = owner_shader
|
||||
self.is_readonly = owner_shader.is_readonly
|
||||
self.node_dst = node_dst
|
||||
@@ -779,8 +781,10 @@ class ShaderImageTextureWrapper:
|
||||
# Find potential existing link into image's Vector input.
|
||||
socket_dst = self.node_image.inputs["Vector"]
|
||||
# If not already existing, we need to create texcoords -> mapping link (from UV).
|
||||
socket_src = (socket_dst.links[0].from_socket if socket_dst.is_linked
|
||||
else self.owner_shader.node_texcoords.outputs['UV'])
|
||||
socket_src = (
|
||||
socket_dst.links[0].from_socket if socket_dst.is_linked
|
||||
else self.owner_shader.node_texcoords.outputs['UV']
|
||||
)
|
||||
|
||||
tree = self.owner_shader.material.node_tree
|
||||
node_mapping = tree.nodes.new(type='ShaderNodeMapping')
|
||||
|
||||
@@ -107,9 +107,12 @@ def draw_km(display_keymaps, kc, km, children, layout, level):
|
||||
# "Add New" at end of keymap item list
|
||||
subcol = _indented_layout(col, kmi_level)
|
||||
subcol = subcol.split(factor=0.2).column()
|
||||
subcol.operator("preferences.keyitem_add", text="Add New", text_ctxt=i18n_contexts.id_windowmanager,
|
||||
icon='ADD')
|
||||
|
||||
subcol.operator(
|
||||
"preferences.keyitem_add",
|
||||
text="Add New",
|
||||
text_ctxt=i18n_contexts.id_windowmanager,
|
||||
icon='ADD',
|
||||
)
|
||||
col.separator()
|
||||
|
||||
# Child key maps
|
||||
@@ -275,8 +278,10 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout):
|
||||
if not _EVENT_TYPES:
|
||||
enum = bpy.types.Event.bl_rna.properties["type"].enum_items
|
||||
_EVENT_TYPES.update(enum.keys())
|
||||
_EVENT_TYPE_MAP.update({item.name.replace(" ", "_").upper(): key
|
||||
for key, item in enum.items()})
|
||||
_EVENT_TYPE_MAP.update({
|
||||
item.name.replace(" ", "_").upper(): key
|
||||
for key, item in enum.items()
|
||||
})
|
||||
|
||||
del enum
|
||||
_EVENT_TYPE_MAP_EXTRA.update({
|
||||
@@ -395,9 +400,11 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout):
|
||||
col = layout.column()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.label(text=km.name, icon='DOT',
|
||||
text_ctxt=i18n_contexts.id_windowmanager)
|
||||
|
||||
row.label(
|
||||
text=km.name,
|
||||
icon='DOT',
|
||||
text_ctxt=i18n_contexts.id_windowmanager,
|
||||
)
|
||||
if km.is_user_modified:
|
||||
subrow = row.row()
|
||||
subrow.alignment = 'RIGHT'
|
||||
|
||||
@@ -880,9 +880,11 @@ def km_screen(params):
|
||||
|
||||
def km_screen_editing(params):
|
||||
items = []
|
||||
keymap = ("Screen Editing",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": items})
|
||||
keymap = (
|
||||
"Screen Editing",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": items},
|
||||
)
|
||||
|
||||
items.extend([
|
||||
# Action zones
|
||||
@@ -1426,7 +1428,7 @@ def km_uv_editor(params):
|
||||
(
|
||||
"uv.move_on_axis",
|
||||
{"type": key, "value": 'PRESS', **mod_dict},
|
||||
{"properties": [("axis", axis), ("type", move_type), ("distance", distance)]}
|
||||
{"properties": [("axis", axis), ("type", move_type), ("distance", distance)]},
|
||||
)
|
||||
for mod_dict, move_type in (
|
||||
({"ctrl": True}, 'DYNAMIC'),
|
||||
@@ -4210,8 +4212,10 @@ def km_grease_pencil_sculpt_mode(params):
|
||||
op_menu("GREASE_PENCIL_MT_layer_active", {"type": 'Y', "value": 'PRESS'}),
|
||||
|
||||
# Auto-masking menu.
|
||||
op_menu_pie("VIEW3D_MT_grease_pencil_sculpt_automasking_pie", {
|
||||
"type": 'A', "value": 'PRESS', "shift": True, "alt": True}),
|
||||
op_menu_pie(
|
||||
"VIEW3D_MT_grease_pencil_sculpt_automasking_pie",
|
||||
{"type": 'A', "value": 'PRESS', "shift": True, "alt": True},
|
||||
),
|
||||
("wm.context_menu_enum", {"type": 'E', "value": 'PRESS', "alt": True},
|
||||
{"properties": [("data_path", "tool_settings.gpencil_sculpt_paint.brush.stroke_method")]}),
|
||||
|
||||
|
||||
@@ -261,9 +261,11 @@ def km_screen(params):
|
||||
|
||||
def km_screen_editing(params):
|
||||
items = []
|
||||
keymap = ("Screen Editing",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": items})
|
||||
keymap = (
|
||||
"Screen Editing",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": items},
|
||||
)
|
||||
|
||||
items.extend([
|
||||
# Action zones
|
||||
@@ -2703,15 +2705,16 @@ def _template_paint_radial_control(
|
||||
items.extend([
|
||||
("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True, "alt": True},
|
||||
radial_control_properties(
|
||||
paint, "mask_texture_slot.angle", None, secondary_rotation=secondary_rotation, color=color)),
|
||||
paint, "mask_texture_slot.angle", None, secondary_rotation=secondary_rotation, color=color,
|
||||
)),
|
||||
])
|
||||
|
||||
if weight:
|
||||
items.extend([
|
||||
("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True, "alt": True},
|
||||
radial_control_properties(
|
||||
paint, "mask_texture_slot.angle", None, secondary_rotation=secondary_rotation, color=color)),
|
||||
|
||||
paint, "mask_texture_slot.angle", None, secondary_rotation=secondary_rotation, color=color,
|
||||
)),
|
||||
("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True},
|
||||
radial_control_properties(
|
||||
paint, "weight", "use_unified_weight"))
|
||||
@@ -2766,8 +2769,10 @@ def km_image_paint(params):
|
||||
("wm.context_toggle", {"type": 'L', "value": 'PRESS'},
|
||||
{"properties": [("data_path", "tool_settings.image_paint.brush.use_smooth_stroke")]}),
|
||||
# Context menu.
|
||||
*_template_items_context_panel("VIEW3D_PT_paint_texture_context_menu",
|
||||
{"type": 'RIGHTMOUSE', "value": 'PRESS'}),
|
||||
*_template_items_context_panel(
|
||||
"VIEW3D_PT_paint_texture_context_menu",
|
||||
{"type": 'RIGHTMOUSE', "value": 'PRESS'},
|
||||
),
|
||||
# Tools
|
||||
op_tool_cycle("builtin.select_box", {"type": 'Q', "value": 'PRESS'}),
|
||||
op_tool_cycle("builtin.annotate", {"type": 'D', "value": 'PRESS'}),
|
||||
|
||||
@@ -392,8 +392,10 @@ class UpdateAnimatedTransformConstraint(Operator):
|
||||
|
||||
use_convert_to_radians: BoolProperty(
|
||||
name="Convert to Radians",
|
||||
description="Convert f-curves/drivers affecting rotations to radians.\n"
|
||||
"Warning: Use this only once",
|
||||
description=(
|
||||
"Convert f-curves/drivers affecting rotations to radians.\n"
|
||||
"Warning: Use this only once"
|
||||
),
|
||||
default=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -345,10 +345,14 @@ def _uniqify(name, other_names):
|
||||
|
||||
# Construct the list of numbers already in use.
|
||||
offset = len(name) + 1
|
||||
others = (n[offset:] for n in other_names
|
||||
if n.startswith(name + '.'))
|
||||
numbers = sorted(int(suffix) for suffix in others
|
||||
if suffix.isdigit())
|
||||
others = (
|
||||
n[offset:] for n in other_names
|
||||
if n.startswith(name + '.')
|
||||
)
|
||||
numbers = sorted(
|
||||
int(suffix) for suffix in others
|
||||
if suffix.isdigit()
|
||||
)
|
||||
|
||||
# Find the first unused number.
|
||||
min_index = 1
|
||||
|
||||
@@ -297,7 +297,9 @@ class MaterialProperties_MixIn:
|
||||
('BLENDED',
|
||||
"Blended",
|
||||
"Allows for colored transparency, but incompatible with render passes and ray-tracing. "
|
||||
"Also known as forward rendering.")))
|
||||
"Also known as forward rendering."),
|
||||
),
|
||||
)
|
||||
|
||||
use_backface_culling: BoolProperty(
|
||||
name="Backface Culling",
|
||||
|
||||
@@ -211,8 +211,10 @@ class NodeAddOperator(NodeOperator):
|
||||
def poll(cls, context):
|
||||
space = context.space_data
|
||||
# Needs active node editor and a tree to add nodes to.
|
||||
return (space and (space.type == 'NODE_EDITOR') and
|
||||
space.edit_tree and space.edit_tree.is_editable)
|
||||
return (
|
||||
space and (space.type == 'NODE_EDITOR') and
|
||||
space.edit_tree and space.edit_tree.is_editable
|
||||
)
|
||||
|
||||
# Default invoke stores the mouse position to place the node correctly
|
||||
# and optionally invokes the transform operator.
|
||||
|
||||
@@ -49,8 +49,10 @@ class SelectPattern(Operator):
|
||||
if self.case_sensitive:
|
||||
pattern_match = fnmatch.fnmatchcase
|
||||
else:
|
||||
pattern_match = (lambda a, b:
|
||||
fnmatch.fnmatchcase(a.upper(), b.upper()))
|
||||
pattern_match = (
|
||||
lambda a, b:
|
||||
fnmatch.fnmatchcase(a.upper(), b.upper())
|
||||
)
|
||||
is_ebone = False
|
||||
is_pbone = False
|
||||
obj = context.object
|
||||
@@ -424,8 +426,10 @@ class ShapeTransfer(Operator):
|
||||
# Method 1, edge
|
||||
if mode == 'OFFSET':
|
||||
for i, vert_cos in enumerate(median_coords):
|
||||
vert_cos.append(target_coords[i] +
|
||||
(orig_shape_coords[i] - orig_coords[i]))
|
||||
vert_cos.append(
|
||||
target_coords[i] +
|
||||
(orig_shape_coords[i] - orig_coords[i])
|
||||
)
|
||||
|
||||
elif mode == 'RELATIVE_FACE':
|
||||
for poly in me.polygons:
|
||||
@@ -625,11 +629,12 @@ class MakeDupliFace(Operator):
|
||||
|
||||
SCALE_FAC = 0.01
|
||||
offset = 0.5 * SCALE_FAC
|
||||
base_tri = (Vector((-offset, -offset, 0.0)),
|
||||
Vector((+offset, -offset, 0.0)),
|
||||
Vector((+offset, +offset, 0.0)),
|
||||
Vector((-offset, +offset, 0.0)),
|
||||
)
|
||||
base_tri = (
|
||||
Vector((-offset, -offset, 0.0)),
|
||||
Vector((+offset, -offset, 0.0)),
|
||||
Vector((+offset, +offset, 0.0)),
|
||||
Vector((-offset, +offset, 0.0)),
|
||||
)
|
||||
|
||||
def matrix_to_quad(matrix):
|
||||
# scale = matrix.median_scale
|
||||
|
||||
@@ -54,9 +54,11 @@ def randomize_selected(context, seed, delta, loc, rot, scale, scale_even, _scale
|
||||
else:
|
||||
org_sca_x, org_sca_y, org_sca_z = obj.scale
|
||||
|
||||
sca_x, sca_y, sca_z = (uniform(-scale[0] + 2.0, scale[0]),
|
||||
uniform(-scale[1] + 2.0, scale[1]),
|
||||
uniform(-scale[2] + 2.0, scale[2]))
|
||||
sca_x, sca_y, sca_z = (
|
||||
uniform(-scale[0] + 2.0, scale[0]),
|
||||
uniform(-scale[1] + 2.0, scale[1]),
|
||||
uniform(-scale[2] + 2.0, scale[2]),
|
||||
)
|
||||
|
||||
if scale_even:
|
||||
aX = sca_x * org_sca_x
|
||||
|
||||
@@ -215,8 +215,10 @@ class prettyface:
|
||||
yspan = y2 - y1
|
||||
for uvco in uv:
|
||||
x, y = uvco
|
||||
uvco[:] = ((x1 + (x * xspan)),
|
||||
(y1 + (y * yspan)))
|
||||
uvco[:] = (
|
||||
(x1 + (x * xspan)),
|
||||
(y1 + (y * yspan))
|
||||
)
|
||||
|
||||
def __hash__(self):
|
||||
# None unique hash
|
||||
|
||||
@@ -32,7 +32,8 @@ def add_node_type(layout, node_type, *, label=None, poll=None, search_weight=0.0
|
||||
label=label,
|
||||
poll=poll,
|
||||
search_weight=search_weight,
|
||||
translate=translate)
|
||||
translate=translate,
|
||||
)
|
||||
|
||||
|
||||
def add_node_type_with_searchable_enum(context, layout, node_idname, property_name, search_weight=0.0):
|
||||
@@ -45,9 +46,11 @@ def add_node_type_with_searchable_enum_socket(
|
||||
node_idname,
|
||||
socket_identifier,
|
||||
enum_names,
|
||||
search_weight=0.0):
|
||||
search_weight=0.0,
|
||||
):
|
||||
return AddNodeMenu.node_operator_with_searchable_enum_socket(
|
||||
context, layout, node_idname, socket_identifier, enum_names, search_weight)
|
||||
context, layout, node_idname, socket_identifier, enum_names, search_weight,
|
||||
)
|
||||
|
||||
|
||||
def add_node_type_with_outputs(context, layout, node_type, subnames, *, label=None, search_weight=0.0):
|
||||
@@ -57,7 +60,8 @@ def add_node_type_with_outputs(context, layout, node_type, subnames, *, label=No
|
||||
node_type,
|
||||
subnames,
|
||||
label=label,
|
||||
search_weight=search_weight)
|
||||
search_weight=search_weight,
|
||||
)
|
||||
|
||||
|
||||
def add_color_mix_node(context, layout):
|
||||
@@ -98,7 +102,10 @@ def add_foreach_geometry_element_zone(layout, label):
|
||||
|
||||
def add_closure_zone(layout, label):
|
||||
props = layout.operator(
|
||||
"node.add_closure_zone", text=label, text_ctxt=i18n_contexts.default)
|
||||
"node.add_closure_zone",
|
||||
text=label,
|
||||
text_ctxt=i18n_contexts.default,
|
||||
)
|
||||
props.use_transform = True
|
||||
return props
|
||||
|
||||
@@ -135,7 +142,8 @@ class NodeMenu(Menu):
|
||||
text=label,
|
||||
text_ctxt=translation_context,
|
||||
translate=translate,
|
||||
search_weight=search_weight)
|
||||
search_weight=search_weight,
|
||||
)
|
||||
props.type = node_type
|
||||
|
||||
if hasattr(props, "use_transform"):
|
||||
@@ -159,13 +167,12 @@ class NodeMenu(Menu):
|
||||
layout,
|
||||
node_idname,
|
||||
label="{:s} \u25B8 {:s}".format(
|
||||
iface_(
|
||||
node_type.bl_rna.name),
|
||||
iface_(
|
||||
item.name,
|
||||
translation_context)),
|
||||
iface_(node_type.bl_rna.name),
|
||||
iface_(item.name, translation_context),
|
||||
),
|
||||
translate=False,
|
||||
search_weight=search_weight)
|
||||
search_weight=search_weight,
|
||||
)
|
||||
prop = props.settings.add()
|
||||
prop.name = property_name
|
||||
prop.value = repr(item.identifier)
|
||||
@@ -198,7 +205,8 @@ class NodeMenu(Menu):
|
||||
node_idname,
|
||||
label="{:s} \u25B8 {:s}".format(iface_(node_type.bl_rna.name), iface_(enum_name)),
|
||||
translate=False,
|
||||
search_weight=search_weight)
|
||||
search_weight=search_weight,
|
||||
)
|
||||
prop = props.settings.add()
|
||||
prop.name = "inputs[\"{:s}\"].default_value".format(bpy.utils.escape_identifier(socket_identifier))
|
||||
prop.value = repr(enum_name)
|
||||
@@ -253,10 +261,10 @@ class NodeMenu(Menu):
|
||||
"ShaderNodeMix",
|
||||
label="{:s} \u25B8 {:s}".format(
|
||||
label,
|
||||
iface_(
|
||||
item.name,
|
||||
translation_context)),
|
||||
translate=False)
|
||||
iface_(item.name, translation_context),
|
||||
),
|
||||
translate=False,
|
||||
)
|
||||
prop = props.settings.add()
|
||||
prop.name = "data_type"
|
||||
prop.value = "'RGBA'"
|
||||
@@ -278,8 +286,8 @@ class NodeMenu(Menu):
|
||||
cls.new_empty_group_operator_id,
|
||||
text="New Group",
|
||||
text_ctxt=i18n_contexts.default,
|
||||
icon='ADD')
|
||||
|
||||
icon='ADD',
|
||||
)
|
||||
if hasattr(props, "use_transform"):
|
||||
props.use_transform = cls.use_transform
|
||||
|
||||
@@ -316,10 +324,12 @@ class NodeMenu(Menu):
|
||||
layout.separator()
|
||||
for group in groups:
|
||||
search_weight = -1.0 if group.is_linked_packed else 0.0
|
||||
props = cls.node_operator(layout,
|
||||
node_tree_group_type[group.bl_idname],
|
||||
label=group.name,
|
||||
search_weight=search_weight)
|
||||
props = cls.node_operator(
|
||||
layout,
|
||||
node_tree_group_type[group.bl_idname],
|
||||
label=group.name,
|
||||
search_weight=search_weight,
|
||||
)
|
||||
ops = props.settings.add()
|
||||
ops.name = "node_tree"
|
||||
ops.value = "bpy.data.node_groups[{!r}]".format(group.name)
|
||||
|
||||
@@ -147,10 +147,14 @@ class NODE_MT_compositor_node_filter_base(node_add_menu.NodeMenu):
|
||||
layout.separator()
|
||||
self.node_operator_with_searchable_enum_socket(
|
||||
context, layout, "CompositorNodeFilter", "Type", [
|
||||
"Soften", "Box Sharpen", "Diamond Sharpen", "Laplace", "Sobel", "Prewitt", "Kirsch", "Shadow"])
|
||||
"Soften", "Box Sharpen", "Diamond Sharpen", "Laplace", "Sobel", "Prewitt", "Kirsch", "Shadow",
|
||||
],
|
||||
)
|
||||
self.node_operator_with_searchable_enum_socket(
|
||||
context, layout, "CompositorNodeGlare", "Type", [
|
||||
"Bloom", "Ghosts", "Streaks", "Fog Glow", "Simple Star", "Sun Beams", "Kernel"])
|
||||
"Bloom", "Ghosts", "Streaks", "Fog Glow", "Simple Star", "Sun Beams", "Kernel",
|
||||
],
|
||||
)
|
||||
|
||||
self.draw_assets_for_catalog(layout, self.bl_label)
|
||||
|
||||
|
||||
@@ -334,9 +334,12 @@ class POSE_PT_selection_sets(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.object and
|
||||
context.object.type == 'ARMATURE' and
|
||||
context.object.pose)
|
||||
ob = context.object
|
||||
return (
|
||||
(ob is not None) and
|
||||
(ob.type == 'ARMATURE') and
|
||||
(ob.pose is not None)
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@@ -184,8 +184,12 @@ class GreasePencilBrushFalloff:
|
||||
col.prop(brush, "curve_distance_falloff_preset", text="")
|
||||
|
||||
if brush.curve_distance_falloff_preset == 'CUSTOM':
|
||||
layout.template_curve_mapping(brush, "curve_distance_falloff", brush=True,
|
||||
use_negative_slope=True, show_presets=True)
|
||||
layout.template_curve_mapping(
|
||||
brush, "curve_distance_falloff",
|
||||
brush=True,
|
||||
use_negative_slope=True,
|
||||
show_presets=True,
|
||||
)
|
||||
|
||||
|
||||
class GREASE_PENCIL_MT_move_to_layer(Menu):
|
||||
|
||||
@@ -172,8 +172,10 @@ class MASK_PT_point:
|
||||
|
||||
if mask and sc.mode == 'MASK':
|
||||
mask_layer_active = mask.layers.active
|
||||
return (mask_layer_active and
|
||||
mask_layer_active.splines.active_point)
|
||||
return (
|
||||
mask_layer_active and
|
||||
mask_layer_active.splines.active_point
|
||||
)
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -309,8 +309,8 @@ class UnifiedPaintPanel:
|
||||
curve_visibility_name,
|
||||
text="",
|
||||
icon='DOWNARROW_HLT' if is_active else 'RIGHTARROW',
|
||||
emboss=False)
|
||||
|
||||
emboss=False,
|
||||
)
|
||||
if is_active:
|
||||
subcol = layout.column()
|
||||
subcol.active = getattr(brush, pressure_name)
|
||||
@@ -582,7 +582,8 @@ class StrokePanel(BrushPanel):
|
||||
"show_jitter_curve",
|
||||
icon='DOWNARROW_HLT' if settings.show_jitter_curve else 'RIGHTARROW',
|
||||
text="",
|
||||
emboss=False)
|
||||
emboss=False,
|
||||
)
|
||||
# Pen pressure mapping curve for Jitter.
|
||||
if settings.show_jitter_curve and self.is_popover is False:
|
||||
subcol = col.column()
|
||||
@@ -670,9 +671,12 @@ class FalloffPanel(BrushPanel):
|
||||
col.prop(brush, "curve_distance_falloff_preset", text="")
|
||||
|
||||
if brush.curve_distance_falloff_preset == 'CUSTOM':
|
||||
layout.template_curve_mapping(brush, "curve_distance_falloff", brush=True,
|
||||
use_negative_slope=True, show_presets=True)
|
||||
|
||||
layout.template_curve_mapping(
|
||||
brush, "curve_distance_falloff",
|
||||
brush=True,
|
||||
use_negative_slope=True,
|
||||
show_presets=True,
|
||||
)
|
||||
col = layout.column(align=True)
|
||||
row = col.row(align=True)
|
||||
|
||||
@@ -1730,8 +1734,8 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
|
||||
"show_size_curve",
|
||||
text="",
|
||||
icon='DOWNARROW_HLT' if paint.show_size_curve else 'RIGHTARROW',
|
||||
emboss=False)
|
||||
|
||||
emboss=False,
|
||||
)
|
||||
if paint.show_size_curve:
|
||||
col = layout.column()
|
||||
col.active = brush.use_pressure_size
|
||||
@@ -1746,8 +1750,8 @@ def brush_basic_grease_pencil_paint_settings(layout, context, brush, props, *, c
|
||||
"show_strength_curve",
|
||||
text="",
|
||||
icon='DOWNARROW_HLT' if paint.show_strength_curve else 'RIGHTARROW',
|
||||
emboss=False)
|
||||
|
||||
emboss=False,
|
||||
)
|
||||
if paint.show_strength_curve:
|
||||
col = layout.column()
|
||||
col.active = brush.use_pressure_strength
|
||||
|
||||
@@ -1285,8 +1285,10 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
|
||||
|
||||
# Currently boids can only use the first state so these are commented out for now.
|
||||
# row = layout.row()
|
||||
# row.template_list("UI_UL_list", "particle_boids", boids, "states",
|
||||
# boids, "active_boid_state_index", compact="True")
|
||||
# row.template_list(
|
||||
# "UI_UL_list", "particle_boids", boids, "states",
|
||||
# boids, "active_boid_state_index", compact="True",
|
||||
# )
|
||||
# col = row.row()
|
||||
# sub = col.row(align=True)
|
||||
# sub.operator("boid.state_add", icon='ADD', text="")
|
||||
@@ -1386,8 +1388,10 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
|
||||
|
||||
if (
|
||||
part.type == 'EMITTER' or
|
||||
part.type in {'FLIP', 'SPRAY', 'BUBBLE', 'FOAM', 'TRACER',
|
||||
'SPRAYFOAM', 'SPRAYBUBBLE', 'FOAMBUBBLE', 'SPRAYFOAMBUBBLE'} or
|
||||
part.type in {
|
||||
'FLIP', 'SPRAY', 'BUBBLE', 'FOAM', 'TRACER',
|
||||
'SPRAYFOAM', 'SPRAYBUBBLE', 'FOAMBUBBLE', 'SPRAYFOAMBUBBLE',
|
||||
} or
|
||||
(part.render_type in {'OBJECT', 'COLLECTION'} and part.type == 'HAIR')
|
||||
):
|
||||
if part.render_type != 'NONE':
|
||||
|
||||
@@ -27,8 +27,10 @@ def drivers_editor_footer(layout, context):
|
||||
layout.label(
|
||||
text=iface_("Driver: {:s} ({:s})").format(
|
||||
act_fcurve.id_data.name,
|
||||
act_fcurve.data_path),
|
||||
translate=False)
|
||||
act_fcurve.data_path,
|
||||
),
|
||||
translate=False,
|
||||
)
|
||||
|
||||
if act_driver.variables:
|
||||
layout.separator(type='LINE')
|
||||
|
||||
@@ -873,12 +873,18 @@ class IMAGE_HT_header(Header):
|
||||
else:
|
||||
row = layout.row(align=True)
|
||||
uv_select_mode = tool_settings.uv_select_mode[:]
|
||||
row.operator("uv.select_mode", text="", icon='UV_VERTEXSEL',
|
||||
depress=(uv_select_mode == 'VERTEX')).type = 'VERTEX'
|
||||
row.operator("uv.select_mode", text="", icon='UV_EDGESEL',
|
||||
depress=(uv_select_mode == 'EDGE')).type = 'EDGE'
|
||||
row.operator("uv.select_mode", text="", icon='UV_FACESEL',
|
||||
depress=(uv_select_mode == 'FACE')).type = 'FACE'
|
||||
row.operator(
|
||||
"uv.select_mode", text="", icon='UV_VERTEXSEL',
|
||||
depress=(uv_select_mode == 'VERTEX'),
|
||||
).type = 'VERTEX'
|
||||
row.operator(
|
||||
"uv.select_mode", text="", icon='UV_EDGESEL',
|
||||
depress=(uv_select_mode == 'EDGE'),
|
||||
).type = 'EDGE'
|
||||
row.operator(
|
||||
"uv.select_mode", text="", icon='UV_FACESEL',
|
||||
depress=(uv_select_mode == 'FACE'),
|
||||
).type = 'FACE'
|
||||
|
||||
layout.prop(tool_settings, "use_uv_select_island", icon_only=True)
|
||||
layout.prop(tool_settings, "uv_sticky_select_mode", icon_only=True)
|
||||
|
||||
@@ -167,7 +167,8 @@ class NODE_HT_header(Header):
|
||||
row.template_ID(
|
||||
active_modifier,
|
||||
"node_group",
|
||||
new="node.new_compositor_sequencer_node_group")
|
||||
new="node.new_compositor_sequencer_node_group",
|
||||
)
|
||||
else:
|
||||
row.enabled = False
|
||||
row.template_ID(snode, "node_tree", new="node.new_compositor_sequencer_node_group")
|
||||
|
||||
@@ -1945,9 +1945,10 @@ class _defs_vertex_paint:
|
||||
if context is None:
|
||||
return True
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH' and
|
||||
(ob.data.use_paint_mask or
|
||||
ob.data.use_paint_mask_vertex))
|
||||
return (
|
||||
ob and ob.type == 'MESH' and
|
||||
(ob.data.use_paint_mask or ob.data.use_paint_mask_vertex)
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def blur():
|
||||
|
||||
@@ -775,8 +775,10 @@ class TOPBAR_PT_name_marker(Panel):
|
||||
@staticmethod
|
||||
def is_using_pose_markers(context):
|
||||
sd = context.space_data
|
||||
return (sd.type == 'DOPESHEET_EDITOR' and sd.mode in {'ACTION', 'SHAPEKEY'} and
|
||||
sd.show_pose_markers and context.active_action)
|
||||
return (
|
||||
sd.type == 'DOPESHEET_EDITOR' and sd.mode in {'ACTION', 'SHAPEKEY'} and
|
||||
sd.show_pose_markers and context.active_action
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_selected_marker(context):
|
||||
|
||||
@@ -2589,8 +2589,10 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
|
||||
(search in bl_info["name"].casefold() or
|
||||
search in iface_(bl_info["name"]).casefold()) or
|
||||
(bl_info["author"] and (search in bl_info["author"].casefold())) or
|
||||
((filter == "All") and (search in bl_info["category"].casefold() or
|
||||
search in iface_(bl_info["category"]).casefold()))
|
||||
((filter == "All") and (
|
||||
search in bl_info["category"].casefold() or
|
||||
search in iface_(bl_info["category"]).casefold()
|
||||
))
|
||||
):
|
||||
continue
|
||||
|
||||
|
||||
@@ -3070,21 +3070,24 @@ class VIEW3D_MT_object_context_menu(Menu):
|
||||
if selected_objects_len > 1:
|
||||
layout.operator("object.join")
|
||||
|
||||
if obj.type in {'MESH', 'CURVE', 'CURVES', 'SURFACE', 'POINTCLOUD',
|
||||
'META', 'FONT', 'GREASEPENCIL'}:
|
||||
if obj.type in {
|
||||
'MESH', 'CURVE', 'CURVES', 'SURFACE', 'POINTCLOUD',
|
||||
'META', 'FONT', 'GREASEPENCIL'
|
||||
}:
|
||||
layout.operator_menu_enum("object.convert", "target")
|
||||
|
||||
if (obj.type in {'MESH',
|
||||
'CURVE',
|
||||
'CURVES',
|
||||
'SURFACE',
|
||||
'GREASEPENCIL',
|
||||
'LATTICE',
|
||||
'ARMATURE',
|
||||
'META',
|
||||
'FONT',
|
||||
'POINTCLOUD',
|
||||
} or (obj.type == 'EMPTY' and obj.instance_collection is not None)):
|
||||
if (obj.type in {
|
||||
'MESH',
|
||||
'CURVE',
|
||||
'CURVES',
|
||||
'SURFACE',
|
||||
'GREASEPENCIL',
|
||||
'LATTICE',
|
||||
'ARMATURE',
|
||||
'META',
|
||||
'FONT',
|
||||
'POINTCLOUD',
|
||||
} or (obj.type == 'EMPTY' and obj.instance_collection is not None)):
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator_menu_enum("object.origin_set", text="Set Origin", property="type")
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
@@ -9019,7 +9022,8 @@ class VIEW3D_PT_curves_sculpt_parameter_falloff(Panel):
|
||||
brush.curves_sculpt_settings,
|
||||
"curve_parameter_falloff",
|
||||
brush=True,
|
||||
show_presets=True)
|
||||
show_presets=True,
|
||||
)
|
||||
|
||||
|
||||
class VIEW3D_PT_curves_sculpt_grow_shrink_scaling(Panel):
|
||||
|
||||
@@ -868,8 +868,12 @@ class VIEW3D_PT_tools_weight_gradient(Panel, View3DPaintPanel):
|
||||
col.prop(brush, "curve_distance_falloff_preset", expand=True)
|
||||
|
||||
if brush.curve_distance_falloff_preset == 'CUSTOM':
|
||||
layout.template_curve_mapping(brush, "curve_distance_falloff", brush=True,
|
||||
use_negative_slope=True, show_presets=True)
|
||||
layout.template_curve_mapping(
|
||||
brush, "curve_distance_falloff",
|
||||
brush=True,
|
||||
use_negative_slope=True,
|
||||
show_presets=True,
|
||||
)
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_brush_falloff(Panel, View3DPaintPanel, FalloffPanel):
|
||||
@@ -2124,7 +2128,8 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_random(View3DPanel, Panel):
|
||||
"show_jitter_curve",
|
||||
text="",
|
||||
icon='DOWNARROW_HLT' if paint.show_jitter_curve else 'RIGHTARROW',
|
||||
emboss=False)
|
||||
emboss=False,
|
||||
)
|
||||
if paint.show_jitter_curve:
|
||||
col.active = gp_settings.use_jitter_pressure
|
||||
col.template_curve_mapping(gp_settings, "curve_jitter", brush=True, show_presets=True)
|
||||
|
||||
@@ -16,11 +16,11 @@ class CustomMenu(bpy.types.Menu):
|
||||
layout.label(text="Hello world!", icon='WORLD_DATA')
|
||||
|
||||
# use an operator enum property to populate a sub-menu
|
||||
layout.operator_menu_enum("object.select_by_type",
|
||||
property="type",
|
||||
text="Select All by Type",
|
||||
)
|
||||
|
||||
layout.operator_menu_enum(
|
||||
"object.select_by_type",
|
||||
property="type",
|
||||
text="Select All by Type",
|
||||
)
|
||||
# call another menu
|
||||
layout.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user