Merge branch 'blender-v4.2-release'

This commit is contained in:
Campbell Barton 2024-06-25 19:16:41 +10:00
commit 2da9e89523
4 changed files with 40 additions and 20 deletions

@ -5,7 +5,7 @@
bl_info = {
"name": "Node Wrangler",
"author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer",
"version": (3, 54),
"version": (3, 55),
"blender": (4, 2, 0),
"location": "Node Editor Toolbar or Shift-W",
"description": "Various tools to enhance and speed up node-based workflow",

@ -5,6 +5,7 @@
import bpy
from bpy.types import Panel, Menu
from bpy.props import StringProperty
from bpy.app.translations import contexts as i18n_contexts
from nodeitems_utils import node_categories_iter, NodeItemCustom
from . import operators
@ -46,7 +47,7 @@ def drawlayout(context, layout, mode='non-panel'):
else:
col.operator(operators.NWClearLabel.bl_idname).option = True
col.operator(operators.NWModifyLabels.bl_idname)
col.menu(NWBatchChangeNodesMenu.bl_idname, text="Batch Change")
col.menu(NWBatchChangeNodesMenu.bl_idname, text="Batch Change", text_ctxt=i18n_contexts.operator_default)
col.separator()
col.menu(NWCopyToSelectedMenu.bl_idname)
col.separator()
@ -131,7 +132,7 @@ class NWMergeGeometryMenu(Menu, NWBaseMenu):
layout = self.layout
# The boolean node + Join Geometry node
for type, name, description in geo_combine_operations:
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name)
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name, text_ctxt=i18n_contexts.default)
props.mode = type
props.merge_type = 'GEOMETRY'
@ -144,7 +145,7 @@ class NWMergeShadersMenu(Menu, NWBaseMenu):
layout = self.layout
for type in ('MIX', 'ADD'):
name = f'{type.capitalize()} Shader'
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name)
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name, text_ctxt=i18n_contexts.default)
props.mode = type
props.merge_type = 'SHADER'
@ -156,7 +157,7 @@ class NWMergeMixMenu(Menu, NWBaseMenu):
def draw(self, context):
layout = self.layout
for type, name, description in blend_types:
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name)
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name, text_ctxt=i18n_contexts.default)
props.mode = type
props.merge_type = 'MIX'
@ -176,7 +177,9 @@ class NWConnectionListOutputs(Menu, NWBaseMenu):
layout.operator(
operators.NWCallInputsMenu.bl_idname,
text=output.name,
icon="RADIOBUT_OFF").from_socket = index
text_ctxt=i18n_contexts.default,
icon="RADIOBUT_OFF",
).from_socket = index
class NWConnectionListInputs(Menu, NWBaseMenu):
@ -195,7 +198,11 @@ class NWConnectionListInputs(Menu, NWBaseMenu):
# of the vector math node being added to the list when
# the mode is not 'SCALE'.
if input.enabled:
op = layout.operator(operators.NWMakeLink.bl_idname, text=input.name, icon="FORWARD")
op = layout.operator(
operators.NWMakeLink.bl_idname, text=input.name,
text_ctxt=i18n_contexts.default,
icon="FORWARD",
)
op.from_socket = context.scene.NWSourceSocket
op.to_socket = index
@ -207,7 +214,7 @@ class NWMergeMathMenu(Menu, NWBaseMenu):
def draw(self, context):
layout = self.layout
for type, name, description in operations:
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name)
props = layout.operator(operators.NWMergeNodes.bl_idname, text=name, text_ctxt=i18n_contexts.default)
props.mode = type
props.merge_type = 'MATH'
@ -229,7 +236,11 @@ class NWBatchChangeBlendTypeMenu(Menu, NWBaseMenu):
def draw(self, context):
layout = self.layout
for type, name, description in blend_types:
props = layout.operator(operators.NWBatchChangeNodes.bl_idname, text=name)
props = layout.operator(
operators.NWBatchChangeNodes.bl_idname,
text=name,
text_ctxt=i18n_contexts.default
)
props.blend_type = type
props.operation = 'CURRENT'
@ -241,7 +252,7 @@ class NWBatchChangeOperationMenu(Menu, NWBaseMenu):
def draw(self, context):
layout = self.layout
for type, name, description in operations:
props = layout.operator(operators.NWBatchChangeNodes.bl_idname, text=name)
props = layout.operator(operators.NWBatchChangeNodes.bl_idname, text=name, text_ctxt=i18n_contexts.default)
props.blend_type = 'CURRENT'
props.operation = type
@ -262,9 +273,9 @@ class NWCopyLabelMenu(Menu, NWBaseMenu):
def draw(self, context):
layout = self.layout
layout.operator(operators.NWCopyLabel.bl_idname, text="from Active Node's Label").option = 'FROM_ACTIVE'
layout.operator(operators.NWCopyLabel.bl_idname, text="from Linked Node's Label").option = 'FROM_NODE'
layout.operator(operators.NWCopyLabel.bl_idname, text="from Linked Output's Name").option = 'FROM_SOCKET'
layout.operator(operators.NWCopyLabel.bl_idname, text="From Active Node's Label").option = 'FROM_ACTIVE'
layout.operator(operators.NWCopyLabel.bl_idname, text="From Linked Node's Label").option = 'FROM_NODE'
layout.operator(operators.NWCopyLabel.bl_idname, text="From Linked Output's Name").option = 'FROM_SOCKET'
class NWAddReroutesMenu(Menu, NWBaseMenu):
@ -274,9 +285,9 @@ class NWAddReroutesMenu(Menu, NWBaseMenu):
def draw(self, context):
layout = self.layout
layout.operator(operators.NWAddReroutes.bl_idname, text="to All Outputs").option = 'ALL'
layout.operator(operators.NWAddReroutes.bl_idname, text="to Loose Outputs").option = 'LOOSE'
layout.operator(operators.NWAddReroutes.bl_idname, text="to Linked Outputs").option = 'LINKED'
layout.operator(operators.NWAddReroutes.bl_idname, text="To All Outputs").option = 'ALL'
layout.operator(operators.NWAddReroutes.bl_idname, text="To Loose Outputs").option = 'LOOSE'
layout.operator(operators.NWAddReroutes.bl_idname, text="To Linked Outputs").option = 'LINKED'
class NWLinkActiveToSelectedMenu(Menu, NWBaseMenu):
@ -370,7 +381,11 @@ class NWAttributeMenu(bpy.types.Menu):
if attrs:
for attr in attrs:
l.operator(operators.NWAddAttrNode.bl_idname, text=attr).attr_name = attr
l.operator(
operators.NWAddAttrNode.bl_idname,
text=attr,
translate=False,
).attr_name = attr
else:
l.label(text="No attributes on objects with this material")

@ -14,7 +14,11 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
from bpy.app.translations import pgettext_rpt as rpt_
from bpy.app.translations import (
pgettext_rpt as rpt_,
contexts as i18n_contexts,
)
from bpy_extras.io_utils import ImportHelper, ExportHelper
from bpy_extras.node_utils import connect_sockets
from mathutils import Vector
@ -492,6 +496,7 @@ class NWAddAttrNode(Operator, NWBase):
class NWFrameSelected(Operator, NWBase):
bl_idname = "node.nw_frame_selected"
bl_label = "Frame Selected"
bl_translation_context = i18n_contexts.id_nodetree
bl_description = "Add a frame node and parent the selected nodes to it"
bl_options = {'REGISTER', 'UNDO'}

@ -54,8 +54,8 @@ blend_types = [
('DARKEN', 'Darken', 'Darken Mode'),
('LIGHTEN', 'Lighten', 'Lighten Mode'),
('OVERLAY', 'Overlay', 'Overlay Mode'),
('DODGE', 'Dodge', 'Dodge Mode'),
('BURN', 'Burn', 'Burn Mode'),
('DODGE', 'Color Dodge', 'Dodge Mode'),
('BURN', 'Color Burn', 'Burn Mode'),
('HUE', 'Hue', 'Hue Mode'),
('SATURATION', 'Saturation', 'Saturation Mode'),
('VALUE', 'Value', 'Value Mode'),