1 # SPDX-FileCopyrightText: 2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from bpy
.props
import EnumProperty
, BoolProperty
, StringProperty
7 from nodeitems_utils
import node_categories_iter
9 from . import operators
10 from . import interface
12 from .utils
.constants
import nice_hotkey_name
16 class NWPrincipledPreferences(bpy
.types
.PropertyGroup
):
17 base_color
: StringProperty(
19 default
='diffuse diff albedo base col color basecolor',
20 description
='Naming Components for Base Color maps')
21 metallic
: StringProperty(
23 default
='metallic metalness metal mtl',
24 description
='Naming Components for metallness maps')
25 specular
: StringProperty(
27 default
='specularity specular spec spc',
28 description
='Naming Components for Specular maps')
29 normal
: StringProperty(
31 default
='normal nor nrm nrml norm',
32 description
='Naming Components for Normal maps')
36 description
='Naming Components for bump maps')
37 rough
: StringProperty(
39 default
='roughness rough rgh',
40 description
='Naming Components for roughness maps')
41 gloss
: StringProperty(
43 default
='gloss glossy glossiness',
44 description
='Naming Components for glossy maps')
45 displacement
: StringProperty(
47 default
='displacement displace disp dsp height heightmap',
48 description
='Naming Components for displacement maps')
49 transmission
: StringProperty(
51 default
='transmission transparency',
52 description
='Naming Components for transmission maps')
53 emission
: StringProperty(
55 default
='emission emissive emit',
56 description
='Naming Components for emission maps')
57 alpha
: StringProperty(
59 default
='alpha opacity',
60 description
='Naming Components for alpha maps')
61 ambient_occlusion
: StringProperty(
62 name
='Ambient Occlusion',
63 default
='ao ambient occlusion',
64 description
='Naming Components for AO maps')
68 class NWNodeWrangler(bpy
.types
.AddonPreferences
):
69 bl_idname
= __package__
71 merge_hide
: EnumProperty(
72 name
="Hide Mix nodes",
74 ("ALWAYS", "Always", "Always collapse the new merge nodes"),
75 ("NON_SHADER", "Non-Shader", "Collapse in all cases except for shaders"),
76 ("NEVER", "Never", "Never collapse the new merge nodes")
79 description
="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specify whether to collapse them or show the full node with options expanded")
80 merge_position
: EnumProperty(
81 name
="Mix Node Position",
83 ("CENTER", "Center", "Place the Mix node between the two nodes"),
84 ("BOTTOM", "Bottom", "Place the Mix node at the same height as the lowest node")
87 description
="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specify the position of the new nodes")
89 show_hotkey_list
: BoolProperty(
90 name
="Show Hotkey List",
92 description
="Expand this box into a list of all the hotkeys for functions in this addon"
94 hotkey_list_filter
: StringProperty(
95 name
=" Filter by Name",
97 description
="Show only hotkeys that have this text in their name",
98 options
={'TEXTEDIT_UPDATE'}
100 show_principled_lists
: BoolProperty(
101 name
="Show Principled naming tags",
103 description
="Expand this box into a list of all naming tags for principled texture setup"
105 principled_tags
: bpy
.props
.PointerProperty(type=NWPrincipledPreferences
)
107 def draw(self
, context
):
109 col
= layout
.column()
110 col
.prop(self
, "merge_position")
111 col
.prop(self
, "merge_hide")
114 col
= box
.column(align
=True)
117 "show_principled_lists",
118 text
='Edit tags for auto texture detection in Principled BSDF setup',
120 if self
.show_principled_lists
:
121 tags
= self
.principled_tags
123 col
.prop(tags
, "base_color")
124 col
.prop(tags
, "metallic")
125 col
.prop(tags
, "specular")
126 col
.prop(tags
, "rough")
127 col
.prop(tags
, "gloss")
128 col
.prop(tags
, "normal")
129 col
.prop(tags
, "bump")
130 col
.prop(tags
, "displacement")
131 col
.prop(tags
, "transmission")
132 col
.prop(tags
, "emission")
133 col
.prop(tags
, "alpha")
134 col
.prop(tags
, "ambient_occlusion")
137 col
= box
.column(align
=True)
138 hotkey_button_name
= "Show Hotkey List"
139 if self
.show_hotkey_list
:
140 hotkey_button_name
= "Hide Hotkey List"
141 col
.prop(self
, "show_hotkey_list", text
=hotkey_button_name
, toggle
=True)
142 if self
.show_hotkey_list
:
143 col
.prop(self
, "hotkey_list_filter", icon
="VIEWZOOM")
145 for hotkey
in kmi_defs
:
147 hotkey_name
= hotkey
[7]
149 if self
.hotkey_list_filter
.lower() in hotkey_name
.lower():
150 row
= col
.row(align
=True)
151 row
.label(text
=hotkey_name
)
152 keystr
= nice_hotkey_name(hotkey
[1])
154 keystr
= "Shift " + keystr
156 keystr
= "Alt " + keystr
158 keystr
= "Ctrl " + keystr
159 row
.label(text
=keystr
)
163 # REGISTER/UNREGISTER CLASSES AND KEYMAP ITEMS
166 # kmi_defs entry: (identifier, key, action, CTRL, SHIFT, ALT, props, nice name)
167 # props entry: (property name, property value)
170 # NWMergeNodes with Ctrl (AUTO).
171 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_0', 'PRESS', True, False, False,
172 (('mode', 'MIX'), ('merge_type', 'AUTO'),), "Merge Nodes (Automatic)"),
173 (operators
.NWMergeNodes
.bl_idname
, 'ZERO', 'PRESS', True, False, False,
174 (('mode', 'MIX'), ('merge_type', 'AUTO'),), "Merge Nodes (Automatic)"),
175 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_PLUS', 'PRESS', True, False, False,
176 (('mode', 'ADD'), ('merge_type', 'AUTO'),), "Merge Nodes (Add)"),
177 (operators
.NWMergeNodes
.bl_idname
, 'EQUAL', 'PRESS', True, False, False,
178 (('mode', 'ADD'), ('merge_type', 'AUTO'),), "Merge Nodes (Add)"),
179 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_ASTERIX', 'PRESS', True, False, False,
180 (('mode', 'MULTIPLY'), ('merge_type', 'AUTO'),), "Merge Nodes (Multiply)"),
181 (operators
.NWMergeNodes
.bl_idname
, 'EIGHT', 'PRESS', True, False, False,
182 (('mode', 'MULTIPLY'), ('merge_type', 'AUTO'),), "Merge Nodes (Multiply)"),
183 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_MINUS', 'PRESS', True, False, False,
184 (('mode', 'SUBTRACT'), ('merge_type', 'AUTO'),), "Merge Nodes (Subtract)"),
185 (operators
.NWMergeNodes
.bl_idname
, 'MINUS', 'PRESS', True, False, False,
186 (('mode', 'SUBTRACT'), ('merge_type', 'AUTO'),), "Merge Nodes (Subtract)"),
187 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_SLASH', 'PRESS', True, False, False,
188 (('mode', 'DIVIDE'), ('merge_type', 'AUTO'),), "Merge Nodes (Divide)"),
189 (operators
.NWMergeNodes
.bl_idname
, 'SLASH', 'PRESS', True, False, False,
190 (('mode', 'DIVIDE'), ('merge_type', 'AUTO'),), "Merge Nodes (Divide)"),
191 (operators
.NWMergeNodes
.bl_idname
, 'COMMA', 'PRESS', True, False, False,
192 (('mode', 'LESS_THAN'), ('merge_type', 'MATH'),), "Merge Nodes (Less than)"),
193 (operators
.NWMergeNodes
.bl_idname
, 'PERIOD', 'PRESS', True, False, False,
194 (('mode', 'GREATER_THAN'), ('merge_type', 'MATH'),), "Merge Nodes (Greater than)"),
195 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_PERIOD', 'PRESS', True, False, False,
196 (('mode', 'MIX'), ('merge_type', 'ZCOMBINE'),), "Merge Nodes (Z-Combine)"),
197 # NWMergeNodes with Ctrl Alt (MIX or ALPHAOVER)
198 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_0', 'PRESS', True, False, True,
199 (('mode', 'MIX'), ('merge_type', 'ALPHAOVER'),), "Merge Nodes (Alpha Over)"),
200 (operators
.NWMergeNodes
.bl_idname
, 'ZERO', 'PRESS', True, False, True,
201 (('mode', 'MIX'), ('merge_type', 'ALPHAOVER'),), "Merge Nodes (Alpha Over)"),
202 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_PLUS', 'PRESS', True, False, True,
203 (('mode', 'ADD'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Add)"),
204 (operators
.NWMergeNodes
.bl_idname
, 'EQUAL', 'PRESS', True, False, True,
205 (('mode', 'ADD'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Add)"),
206 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_ASTERIX', 'PRESS', True, False, True,
207 (('mode', 'MULTIPLY'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Multiply)"),
208 (operators
.NWMergeNodes
.bl_idname
, 'EIGHT', 'PRESS', True, False, True,
209 (('mode', 'MULTIPLY'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Multiply)"),
210 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_MINUS', 'PRESS', True, False, True,
211 (('mode', 'SUBTRACT'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Subtract)"),
212 (operators
.NWMergeNodes
.bl_idname
, 'MINUS', 'PRESS', True, False, True,
213 (('mode', 'SUBTRACT'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Subtract)"),
214 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_SLASH', 'PRESS', True, False, True,
215 (('mode', 'DIVIDE'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Divide)"),
216 (operators
.NWMergeNodes
.bl_idname
, 'SLASH', 'PRESS', True, False, True,
217 (('mode', 'DIVIDE'), ('merge_type', 'MIX'),), "Merge Nodes (Color, Divide)"),
218 # NWMergeNodes with Ctrl Shift (MATH)
219 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_PLUS', 'PRESS', True, True, False,
220 (('mode', 'ADD'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Add)"),
221 (operators
.NWMergeNodes
.bl_idname
, 'EQUAL', 'PRESS', True, True, False,
222 (('mode', 'ADD'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Add)"),
223 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_ASTERIX', 'PRESS', True, True, False,
224 (('mode', 'MULTIPLY'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Multiply)"),
225 (operators
.NWMergeNodes
.bl_idname
, 'EIGHT', 'PRESS', True, True, False,
226 (('mode', 'MULTIPLY'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Multiply)"),
227 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_MINUS', 'PRESS', True, True, False,
228 (('mode', 'SUBTRACT'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Subtract)"),
229 (operators
.NWMergeNodes
.bl_idname
, 'MINUS', 'PRESS', True, True, False,
230 (('mode', 'SUBTRACT'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Subtract)"),
231 (operators
.NWMergeNodes
.bl_idname
, 'NUMPAD_SLASH', 'PRESS', True, True, False,
232 (('mode', 'DIVIDE'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Divide)"),
233 (operators
.NWMergeNodes
.bl_idname
, 'SLASH', 'PRESS', True, True, False,
234 (('mode', 'DIVIDE'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Divide)"),
235 (operators
.NWMergeNodes
.bl_idname
, 'COMMA', 'PRESS', True, True, False,
236 (('mode', 'LESS_THAN'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Less than)"),
237 (operators
.NWMergeNodes
.bl_idname
, 'PERIOD', 'PRESS', True, True, False,
238 (('mode', 'GREATER_THAN'), ('merge_type', 'MATH'),), "Merge Nodes (Math, Greater than)"),
240 # NWBatchChangeNodes with Alt
241 (operators
.NWBatchChangeNodes
.bl_idname
, 'NUMPAD_0', 'PRESS', False, False, True,
242 (('blend_type', 'MIX'), ('operation', 'CURRENT'),), "Batch change blend type (Mix)"),
243 (operators
.NWBatchChangeNodes
.bl_idname
, 'ZERO', 'PRESS', False, False, True,
244 (('blend_type', 'MIX'), ('operation', 'CURRENT'),), "Batch change blend type (Mix)"),
245 (operators
.NWBatchChangeNodes
.bl_idname
, 'NUMPAD_PLUS', 'PRESS', False, False, True,
246 (('blend_type', 'ADD'), ('operation', 'ADD'),), "Batch change blend type (Add)"),
247 (operators
.NWBatchChangeNodes
.bl_idname
, 'EQUAL', 'PRESS', False, False, True,
248 (('blend_type', 'ADD'), ('operation', 'ADD'),), "Batch change blend type (Add)"),
249 (operators
.NWBatchChangeNodes
.bl_idname
, 'NUMPAD_ASTERIX', 'PRESS', False, False, True,
250 (('blend_type', 'MULTIPLY'), ('operation', 'MULTIPLY'),), "Batch change blend type (Multiply)"),
251 (operators
.NWBatchChangeNodes
.bl_idname
, 'EIGHT', 'PRESS', False, False, True,
252 (('blend_type', 'MULTIPLY'), ('operation', 'MULTIPLY'),), "Batch change blend type (Multiply)"),
253 (operators
.NWBatchChangeNodes
.bl_idname
, 'NUMPAD_MINUS', 'PRESS', False, False, True,
254 (('blend_type', 'SUBTRACT'), ('operation', 'SUBTRACT'),), "Batch change blend type (Subtract)"),
255 (operators
.NWBatchChangeNodes
.bl_idname
, 'MINUS', 'PRESS', False, False, True,
256 (('blend_type', 'SUBTRACT'), ('operation', 'SUBTRACT'),), "Batch change blend type (Subtract)"),
257 (operators
.NWBatchChangeNodes
.bl_idname
, 'NUMPAD_SLASH', 'PRESS', False, False, True,
258 (('blend_type', 'DIVIDE'), ('operation', 'DIVIDE'),), "Batch change blend type (Divide)"),
259 (operators
.NWBatchChangeNodes
.bl_idname
, 'SLASH', 'PRESS', False, False, True,
260 (('blend_type', 'DIVIDE'), ('operation', 'DIVIDE'),), "Batch change blend type (Divide)"),
261 (operators
.NWBatchChangeNodes
.bl_idname
, 'COMMA', 'PRESS', False, False, True,
262 (('blend_type', 'CURRENT'), ('operation', 'LESS_THAN'),), "Batch change blend type (Current)"),
263 (operators
.NWBatchChangeNodes
.bl_idname
, 'PERIOD', 'PRESS', False, False, True,
264 (('blend_type', 'CURRENT'), ('operation', 'GREATER_THAN'),), "Batch change blend type (Current)"),
265 (operators
.NWBatchChangeNodes
.bl_idname
, 'DOWN_ARROW', 'PRESS', False, False, True,
266 (('blend_type', 'NEXT'), ('operation', 'NEXT'),), "Batch change blend type (Next)"),
267 (operators
.NWBatchChangeNodes
.bl_idname
, 'UP_ARROW', 'PRESS', False, False, True,
268 (('blend_type', 'PREV'), ('operation', 'PREV'),), "Batch change blend type (Previous)"),
269 # LINK ACTIVE TO SELECTED
270 # Don't use names, don't replace links (K)
271 (operators
.NWLinkActiveToSelected
.bl_idname
, 'K', 'PRESS', False, False, False,
272 (('replace', False), ('use_node_name', False), ('use_outputs_names', False),), "Link active to selected (Don't replace links)"),
273 # Don't use names, replace links (Shift K)
274 (operators
.NWLinkActiveToSelected
.bl_idname
, 'K', 'PRESS', False, True, False,
275 (('replace', True), ('use_node_name', False), ('use_outputs_names', False),), "Link active to selected (Replace links)"),
276 # Use node name, don't replace links (')
277 (operators
.NWLinkActiveToSelected
.bl_idname
, 'QUOTE', 'PRESS', False, False, False,
278 (('replace', False), ('use_node_name', True), ('use_outputs_names', False),), "Link active to selected (Don't replace links, node names)"),
279 # Use node name, replace links (Shift ')
280 (operators
.NWLinkActiveToSelected
.bl_idname
, 'QUOTE', 'PRESS', False, True, False,
281 (('replace', True), ('use_node_name', True), ('use_outputs_names', False),), "Link active to selected (Replace links, node names)"),
282 # Don't use names, don't replace links (;)
283 (operators
.NWLinkActiveToSelected
.bl_idname
, 'SEMI_COLON', 'PRESS', False, False, False,
284 (('replace', False), ('use_node_name', False), ('use_outputs_names', True),), "Link active to selected (Don't replace links, output names)"),
285 # Don't use names, replace links (')
286 (operators
.NWLinkActiveToSelected
.bl_idname
, 'SEMI_COLON', 'PRESS', False, True, False,
287 (('replace', True), ('use_node_name', False), ('use_outputs_names', True),), "Link active to selected (Replace links, output names)"),
289 (operators
.NWChangeMixFactor
.bl_idname
, 'LEFT_ARROW', 'PRESS', False,
290 False, True, (('option', -0.1),), "Reduce Mix Factor by 0.1"),
291 (operators
.NWChangeMixFactor
.bl_idname
, 'RIGHT_ARROW', 'PRESS', False,
292 False, True, (('option', 0.1),), "Increase Mix Factor by 0.1"),
293 (operators
.NWChangeMixFactor
.bl_idname
, 'LEFT_ARROW', 'PRESS', False,
294 True, True, (('option', -0.01),), "Reduce Mix Factor by 0.01"),
295 (operators
.NWChangeMixFactor
.bl_idname
, 'RIGHT_ARROW', 'PRESS', False,
296 True, True, (('option', 0.01),), "Increase Mix Factor by 0.01"),
297 (operators
.NWChangeMixFactor
.bl_idname
, 'LEFT_ARROW', 'PRESS',
298 True, True, True, (('option', 0.0),), "Set Mix Factor to 0.0"),
299 (operators
.NWChangeMixFactor
.bl_idname
, 'RIGHT_ARROW', 'PRESS',
300 True, True, True, (('option', 1.0),), "Set Mix Factor to 1.0"),
301 (operators
.NWChangeMixFactor
.bl_idname
, 'NUMPAD_0', 'PRESS',
302 True, True, True, (('option', 0.0),), "Set Mix Factor to 0.0"),
303 (operators
.NWChangeMixFactor
.bl_idname
, 'ZERO', 'PRESS', True, True, True, (('option', 0.0),), "Set Mix Factor to 0.0"),
304 (operators
.NWChangeMixFactor
.bl_idname
, 'NUMPAD_1', 'PRESS', True, True, True, (('option', 1.0),), "Mix Factor to 1.0"),
305 (operators
.NWChangeMixFactor
.bl_idname
, 'ONE', 'PRESS', True, True, True, (('option', 1.0),), "Set Mix Factor to 1.0"),
306 # CLEAR LABEL (Alt L)
307 (operators
.NWClearLabel
.bl_idname
, 'L', 'PRESS', False, False, True, (('option', False),), "Clear node labels"),
308 # MODIFY LABEL (Alt Shift L)
309 (operators
.NWModifyLabels
.bl_idname
, 'L', 'PRESS', False, True, True, None, "Modify node labels"),
310 # Copy Label from active to selected
311 (operators
.NWCopyLabel
.bl_idname
, 'V', 'PRESS', False, True, False,
312 (('option', 'FROM_ACTIVE'),), "Copy label from active to selected"),
313 # DETACH OUTPUTS (Alt Shift D)
314 (operators
.NWDetachOutputs
.bl_idname
, 'D', 'PRESS', False, True, True, None, "Detach outputs"),
315 # LINK TO OUTPUT NODE (O)
316 (operators
.NWLinkToOutputNode
.bl_idname
, 'O', 'PRESS', False, False, False, None, "Link to output node"),
317 # SELECT PARENT/CHILDREN
319 (operators
.NWSelectParentChildren
.bl_idname
, 'RIGHT_BRACKET', 'PRESS',
320 False, False, False, (('option', 'CHILD'),), "Select children"),
322 (operators
.NWSelectParentChildren
.bl_idname
, 'LEFT_BRACKET', 'PRESS',
323 False, False, False, (('option', 'PARENT'),), "Select Parent"),
325 (operators
.NWAddTextureSetup
.bl_idname
, 'T', 'PRESS', True, False, False, None, "Add texture setup"),
326 # Add Principled BSDF Texture Setup
327 (operators
.NWAddPrincipledSetup
.bl_idname
, 'T', 'PRESS', True, True, False, None, "Add Principled texture setup"),
329 (operators
.NWResetBG
.bl_idname
, 'Z', 'PRESS', False, False, False, None, "Reset backdrop image zoom"),
331 (operators
.NWDeleteUnused
.bl_idname
, 'X', 'PRESS', False, False, True, None, "Delete unused nodes"),
333 (operators
.NWFrameSelected
.bl_idname
, 'P', 'PRESS', False, True, False, None, "Frame selected nodes"),
335 (operators
.NWSwapLinks
.bl_idname
, 'S', 'PRESS', False, False, True, None, "Swap Links"),
337 (operators
.NWPreviewNode
.bl_idname
, 'LEFTMOUSE', 'PRESS', True, True,
338 False, (('run_in_geometry_nodes', False),), "Preview node output"),
339 (operators
.NWPreviewNode
.bl_idname
, 'LEFTMOUSE', 'PRESS', False, True,
340 True, (('run_in_geometry_nodes', True),), "Preview node output"),
342 (operators
.NWReloadImages
.bl_idname
, 'R', 'PRESS', False, False, True, None, "Reload images"),
344 (operators
.NWLazyMix
.bl_idname
, 'RIGHTMOUSE', 'PRESS', True, True, False, None, "Lazy Mix"),
346 (operators
.NWLazyConnect
.bl_idname
, 'RIGHTMOUSE', 'PRESS', False, False, True, (('with_menu', False),), "Lazy Connect"),
347 # Lazy Connect with Menu
348 (operators
.NWLazyConnect
.bl_idname
, 'RIGHTMOUSE', 'PRESS', False,
349 True, True, (('with_menu', True),), "Lazy Connect with Socket Menu"),
351 (operators
.NWAlignNodes
.bl_idname
, 'EQUAL', 'PRESS', False, True,
352 False, None, "Align selected nodes neatly in a row/column"),
353 # Reset Nodes (Back Space)
354 (operators
.NWResetNodes
.bl_idname
, 'BACK_SPACE', 'PRESS', False, False,
355 False, None, "Revert node back to default state, but keep connections"),
357 ('wm.call_menu', 'W', 'PRESS', False, True, False, (('name', interface
.NodeWranglerMenu
.bl_idname
),), "Node Wrangler menu"),
358 ('wm.call_menu', 'SLASH', 'PRESS', False, False, False,
359 (('name', interface
.NWAddReroutesMenu
.bl_idname
),), "Add Reroutes menu"),
360 ('wm.call_menu', 'NUMPAD_SLASH', 'PRESS', False, False, False,
361 (('name', interface
.NWAddReroutesMenu
.bl_idname
),), "Add Reroutes menu"),
362 ('wm.call_menu', 'BACK_SLASH', 'PRESS', False, False, False,
363 (('name', interface
.NWLinkActiveToSelectedMenu
.bl_idname
),), "Link active to selected (menu)"),
364 ('wm.call_menu', 'C', 'PRESS', False, True, False,
365 (('name', interface
.NWCopyToSelectedMenu
.bl_idname
),), "Copy to selected (menu)"),
366 ('wm.call_menu', 'S', 'PRESS', False, True, False,
367 (('name', interface
.NWSwitchNodeTypeMenu
.bl_idname
),), "Switch node type menu"),
371 NWPrincipledPreferences
, NWNodeWrangler
376 from bpy
.utils
import register_class
381 addon_keymaps
.clear()
382 kc
= bpy
.context
.window_manager
.keyconfigs
.addon
384 km
= kc
.keymaps
.new(name
='Node Editor', space_type
="NODE_EDITOR")
385 for (identifier
, key
, action
, CTRL
, SHIFT
, ALT
, props
, nicename
) in kmi_defs
:
386 kmi
= km
.keymap_items
.new(identifier
, key
, action
, ctrl
=CTRL
, shift
=SHIFT
, alt
=ALT
)
388 for prop
, value
in props
:
389 setattr(kmi
.properties
, prop
, value
)
390 addon_keymaps
.append((km
, kmi
))
396 for km
, kmi
in addon_keymaps
:
397 km
.keymap_items
.remove(kmi
)
398 addon_keymaps
.clear()
400 from bpy
.utils
import unregister_class
402 unregister_class(cls
)