Merge branch 'blender-v4.2-release'

This commit is contained in:
Campbell Barton
2024-06-25 19:16:38 +10:00

View File

@@ -14,6 +14,7 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
from bpy.app.translations import pgettext_rpt as rpt_
from bpy_extras.io_utils import ImportHelper, ExportHelper
from bpy_extras.node_utils import connect_sockets
from mathutils import Vector
@@ -316,15 +317,16 @@ class NWDeleteUnused(Operator, NWBase):
# get unique list of deleted nodes (iterations would count the same node more than once)
deleted_nodes = list(set(deleted_nodes))
for n in deleted_nodes:
self.report({'INFO'}, "Node " + n + " deleted")
self.report({'INFO'}, rpt_("Node {} deleted").format(n))
num_deleted = len(deleted_nodes)
n = ' node'
if num_deleted > 1:
n += 's'
if num_deleted:
self.report({'INFO'}, "Deleted " + str(num_deleted) + n)
if num_deleted == 0:
self.report({'INFO'}, "Nothing to delete")
else:
self.report({'INFO'}, "Nothing deleted")
if num_deleted > 1:
message = rpt_("Deleted {} nodes".format(num_deleted))
else:
message = rpt_("Deleted 1 node")
self.report({'INFO'}, message)
# Restore selection
nodes, links = get_nodes_links(context)
@@ -1106,18 +1108,18 @@ class NWCopySettings(Operator, NWBase):
valid_nodes = [n for n in node_selected if n.type == node_active.type]
if not (len(valid_nodes) > 1) and node_active:
self.report({'ERROR'}, "Selected nodes are not of the same type as {}".format(node_active.name))
self.report({'ERROR'}, rpt_("Selected nodes are not of the same type as {}").format(node_active.name))
return {'CANCELLED'}
if len(valid_nodes) != len(node_selected):
# Report nodes that are not valid
valid_node_names = [n.name for n in valid_nodes]
not_valid_names = list(set(selected_node_names) - set(valid_node_names))
invalid_names = set(selected_node_names) - set(valid_node_names)
self.report(
{'INFO'},
"Ignored {} (not of the same type as {})".format(
", ".join(not_valid_names),
node_active.name))
rpt_("Ignored {} (not of the same type as {})").format(", ".join(sorted(invalid_names)),
node_active.name),
)
# Reference original
orig = node_active
@@ -1182,11 +1184,11 @@ class NWCopySettings(Operator, NWBase):
orig.select = True
node_tree.nodes.active = orig
self.report(
{'INFO'},
"Successfully copied attributes from {} to: {}".format(
orig.name,
", ".join(success_names)))
message = rpt_("Successfully copied attributes from {} to {}").format(
orig.name,
", ".join(success_names)
)
self.report({'INFO'}, message)
return {'FINISHED'}
@@ -1338,7 +1340,7 @@ class NWAddTextureSetup(Operator, NWBase):
target_input = input
break
else:
self.report({'WARNING'}, "No free inputs for node: " + node.name)
self.report({'WARNING'}, rpt_("No free inputs for node {}").format(node.name))
continue
x_offset = 0
@@ -2154,14 +2156,14 @@ class NWAddSequence(Operator, NWBase, ImportHelper):
filename = files[0].name
if not path.exists(directory + filename):
self.report({'ERROR'}, filename + " does not exist")
self.report({'ERROR'}, rpt_("{} does not exist").format(filename))
return {'CANCELLED'}
without_ext = '.'.join(filename.split('.')[:-1])
# if last digit isn't a number, it's not a sequence
if not without_ext[-1].isdigit():
self.report({'ERROR'}, filename + " does not seem to be part of a sequence")
self.report({'ERROR'}, rpt_("{} does not seem to be part of a sequence").format(filename))
return {'CANCELLED'}
extension = filename.split('.')[-1]
@@ -2246,9 +2248,6 @@ class NWAddMultipleImages(Operator, NWBase, ImportHelper):
node_type = "ShaderNodeTexImage"
elif context.space_data.node_tree.type == 'COMPOSITING':
node_type = "CompositorNodeImage"
else:
self.report({'ERROR'}, "Unsupported Node Tree type")
return {'CANCELLED'}
new_nodes = []
for f in self.files:
@@ -2380,7 +2379,7 @@ class NWResetNodes(bpy.types.Operator):
if len(valid_nodes) != len(node_selected) and node_active_is_frame is False:
valid_node_names = [n.name for n in valid_nodes]
not_valid_names = list(set(selected_node_names) - set(valid_node_names))
self.report({'INFO'}, "Ignored {}".format(", ".join(not_valid_names)))
self.report({'INFO'}, rpt_("Ignored {}").format(", ".join(not_valid_names)))
# Deselect all nodes
for i in node_selected:
@@ -2432,7 +2431,8 @@ class NWResetNodes(bpy.types.Operator):
node_tree.nodes[active_node_name].select = True
node_tree.nodes.active = node_tree.nodes[active_node_name]
self.report({'INFO'}, "Successfully reset {}".format(", ".join(success_names)))
message = rpt_("Successfully reset {}").format(", ".join(success_names))
self.report({'INFO'}, message)
return {'FINISHED'}