Node Wrangler: apply autopep8 formatting #104444
@ -192,11 +192,13 @@ draw_color_sets = {
|
|||||||
|
|
||||||
viewer_socket_name = "tmp_viewer"
|
viewer_socket_name = "tmp_viewer"
|
||||||
|
|
||||||
|
|
||||||
def get_nodes_from_category(category_name, context):
|
def get_nodes_from_category(category_name, context):
|
||||||
for category in node_categories_iter(context):
|
for category in node_categories_iter(context):
|
||||||
if category.name == category_name:
|
if category.name == category_name:
|
||||||
return sorted(category.items(context), key=lambda node: node.label)
|
return sorted(category.items(context), key=lambda node: node.label)
|
||||||
|
|
||||||
|
|
||||||
def get_first_enabled_output(node):
|
def get_first_enabled_output(node):
|
||||||
for output in node.outputs:
|
for output in node.outputs:
|
||||||
if output.enabled:
|
if output.enabled:
|
||||||
@ -204,9 +206,11 @@ def get_first_enabled_output(node):
|
|||||||
else:
|
else:
|
||||||
return node.outputs[0]
|
return node.outputs[0]
|
||||||
|
|
||||||
|
|
||||||
def is_visible_socket(socket):
|
def is_visible_socket(socket):
|
||||||
return not socket.hide and socket.enabled and socket.type != 'CUSTOM'
|
return not socket.hide and socket.enabled and socket.type != 'CUSTOM'
|
||||||
|
|
||||||
|
|
||||||
def nice_hotkey_name(punc):
|
def nice_hotkey_name(punc):
|
||||||
# convert the ugly string name into the actual character
|
# convert the ugly string name into the actual character
|
||||||
nice_name = {
|
nice_name = {
|
||||||
@ -329,12 +333,14 @@ def autolink(node1, node2, links):
|
|||||||
print("Could not make a link from " + node1.name + " to " + node2.name)
|
print("Could not make a link from " + node1.name + " to " + node2.name)
|
||||||
return link_made
|
return link_made
|
||||||
|
|
||||||
|
|
||||||
def abs_node_location(node):
|
def abs_node_location(node):
|
||||||
abs_location = node.location
|
abs_location = node.location
|
||||||
if node.parent is None:
|
if node.parent is None:
|
||||||
return abs_location
|
return abs_location
|
||||||
return abs_location + abs_node_location(node.parent)
|
return abs_location + abs_node_location(node.parent)
|
||||||
|
|
||||||
|
|
||||||
def node_at_pos(nodes, context, event):
|
def node_at_pos(nodes, context, event):
|
||||||
nodes_under_mouse = []
|
nodes_under_mouse = []
|
||||||
target_node = None
|
target_node = None
|
||||||
@ -395,6 +401,7 @@ def store_mouse_cursor(context, event):
|
|||||||
else:
|
else:
|
||||||
space.cursor_location = tree.view_center
|
space.cursor_location = tree.view_center
|
||||||
|
|
||||||
|
|
||||||
def draw_line(x1, y1, x2, y2, size, colour=(1.0, 1.0, 1.0, 0.7)):
|
def draw_line(x1, y1, x2, y2, size, colour=(1.0, 1.0, 1.0, 0.7)):
|
||||||
shader = gpu.shader.from_builtin('POLYLINE_SMOOTH_COLOR')
|
shader = gpu.shader.from_builtin('POLYLINE_SMOOTH_COLOR')
|
||||||
shader.uniform_float("viewportSize", gpu.state.viewport_get()[2:])
|
shader.uniform_float("viewportSize", gpu.state.viewport_get()[2:])
|
||||||
@ -552,6 +559,7 @@ def draw_rounded_node_border(node, radius=8, colour=(1.0, 1.0, 1.0, 0.7)):
|
|||||||
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
|
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
|
||||||
batch.draw(shader)
|
batch.draw(shader)
|
||||||
|
|
||||||
|
|
||||||
def draw_callback_nodeoutline(self, context, mode):
|
def draw_callback_nodeoutline(self, context, mode):
|
||||||
if self.mouse_path:
|
if self.mouse_path:
|
||||||
gpu.state.blend_set('ALPHA')
|
gpu.state.blend_set('ALPHA')
|
||||||
@ -602,6 +610,7 @@ def draw_callback_nodeoutline(self, context, mode):
|
|||||||
|
|
||||||
gpu.state.blend_set('NONE')
|
gpu.state.blend_set('NONE')
|
||||||
|
|
||||||
|
|
||||||
def get_active_tree(context):
|
def get_active_tree(context):
|
||||||
tree = context.space_data.node_tree
|
tree = context.space_data.node_tree
|
||||||
path = []
|
path = []
|
||||||
@ -616,14 +625,17 @@ def get_active_tree(context):
|
|||||||
path.append(tree)
|
path.append(tree)
|
||||||
return tree, path
|
return tree, path
|
||||||
|
|
||||||
|
|
||||||
def get_nodes_links(context):
|
def get_nodes_links(context):
|
||||||
tree, path = get_active_tree(context)
|
tree, path = get_active_tree(context)
|
||||||
return tree.nodes, tree.links
|
return tree.nodes, tree.links
|
||||||
|
|
||||||
|
|
||||||
def is_viewer_socket(socket):
|
def is_viewer_socket(socket):
|
||||||
# checks if a internal socket is a valid viewer socket
|
# checks if a internal socket is a valid viewer socket
|
||||||
return socket.name == viewer_socket_name and socket.NWViewerSocket
|
return socket.name == viewer_socket_name and socket.NWViewerSocket
|
||||||
|
|
||||||
|
|
||||||
def get_internal_socket(socket):
|
def get_internal_socket(socket):
|
||||||
# get the internal socket from a socket inside or outside the group
|
# get the internal socket from a socket inside or outside the group
|
||||||
node = socket.node
|
node = socket.node
|
||||||
@ -648,6 +660,7 @@ def get_internal_socket(socket):
|
|||||||
break
|
break
|
||||||
return iterator[i]
|
return iterator[i]
|
||||||
|
|
||||||
|
|
||||||
def is_viewer_link(link, output_node):
|
def is_viewer_link(link, output_node):
|
||||||
if link.to_node == output_node and link.to_socket == output_node.inputs[0]:
|
if link.to_node == output_node and link.to_socket == output_node.inputs[0]:
|
||||||
return True
|
return True
|
||||||
@ -657,11 +670,13 @@ def is_viewer_link(link, output_node):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_group_output_node(tree):
|
def get_group_output_node(tree):
|
||||||
for node in tree.nodes:
|
for node in tree.nodes:
|
||||||
if node.type == 'GROUP_OUTPUT' and node.is_active_output == True:
|
if node.type == 'GROUP_OUTPUT' and node.is_active_output:
|
||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
||||||
def get_output_location(tree):
|
def get_output_location(tree):
|
||||||
# get right-most location
|
# get right-most location
|
||||||
sorted_by_xloc = (sorted(tree.nodes, key=lambda x: x.location.x))
|
sorted_by_xloc = (sorted(tree.nodes, key=lambda x: x.location.x))
|
||||||
@ -677,6 +692,8 @@ def get_output_location(tree):
|
|||||||
return loc_x, loc_y
|
return loc_x, loc_y
|
||||||
|
|
||||||
# Principled prefs
|
# Principled prefs
|
||||||
|
|
||||||
|
|
||||||
class NWPrincipledPreferences(bpy.types.PropertyGroup):
|
class NWPrincipledPreferences(bpy.types.PropertyGroup):
|
||||||
base_color: StringProperty(
|
base_color: StringProperty(
|
||||||
name='Base Color',
|
name='Base Color',
|
||||||
@ -732,6 +749,8 @@ class NWPrincipledPreferences(bpy.types.PropertyGroup):
|
|||||||
description='Naming Components for AO maps')
|
description='Naming Components for AO maps')
|
||||||
|
|
||||||
# Addon prefs
|
# Addon prefs
|
||||||
|
|
||||||
|
|
||||||
class NWNodeWrangler(bpy.types.AddonPreferences):
|
class NWNodeWrangler(bpy.types.AddonPreferences):
|
||||||
bl_idname = __name__
|
bl_idname = __name__
|
||||||
|
|
||||||
@ -779,7 +798,11 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
|
|||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
col = box.column(align=True)
|
col = box.column(align=True)
|
||||||
col.prop(self, "show_principled_lists", text='Edit tags for auto texture detection in Principled BSDF setup', toggle=True)
|
col.prop(
|
||||||
|
self,
|
||||||
|
"show_principled_lists",
|
||||||
|
text='Edit tags for auto texture detection in Principled BSDF setup',
|
||||||
|
toggle=True)
|
||||||
if self.show_principled_lists:
|
if self.show_principled_lists:
|
||||||
tags = self.principled_tags
|
tags = self.principled_tags
|
||||||
|
|
||||||
@ -823,7 +846,6 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
|
|||||||
row.label(text=keystr)
|
row.label(text=keystr)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def nw_check(context):
|
def nw_check(context):
|
||||||
space = context.space_data
|
space = context.space_data
|
||||||
valid_trees = ["ShaderNodeTree", "CompositorNodeTree", "TextureNodeTree", "GeometryNodeTree"]
|
valid_trees = ["ShaderNodeTree", "CompositorNodeTree", "TextureNodeTree", "GeometryNodeTree"]
|
||||||
@ -836,6 +858,7 @@ def nw_check(context):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class NWBase:
|
class NWBase:
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@ -908,7 +931,8 @@ class NWLazyMix(Operator, NWBase):
|
|||||||
args = (self, context, 'MIX')
|
args = (self, context, 'MIX')
|
||||||
# Add the region OpenGL drawing callback
|
# Add the region OpenGL drawing callback
|
||||||
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
||||||
self._handle = bpy.types.SpaceNodeEditor.draw_handler_add(draw_callback_nodeoutline, args, 'WINDOW', 'POST_PIXEL')
|
self._handle = bpy.types.SpaceNodeEditor.draw_handler_add(
|
||||||
|
draw_callback_nodeoutline, args, 'WINDOW', 'POST_PIXEL')
|
||||||
|
|
||||||
self.mouse_path = []
|
self.mouse_path = []
|
||||||
|
|
||||||
@ -966,7 +990,7 @@ class NWLazyConnect(Operator, NWBase):
|
|||||||
original_sel = []
|
original_sel = []
|
||||||
original_unsel = []
|
original_unsel = []
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
if node.select == True:
|
if node.select:
|
||||||
node.select = False
|
node.select = False
|
||||||
original_sel.append(node)
|
original_sel.append(node)
|
||||||
else:
|
else:
|
||||||
@ -1013,7 +1037,8 @@ class NWLazyConnect(Operator, NWBase):
|
|||||||
args = (self, context, mode)
|
args = (self, context, mode)
|
||||||
# Add the region OpenGL drawing callback
|
# Add the region OpenGL drawing callback
|
||||||
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
||||||
self._handle = bpy.types.SpaceNodeEditor.draw_handler_add(draw_callback_nodeoutline, args, 'WINDOW', 'POST_PIXEL')
|
self._handle = bpy.types.SpaceNodeEditor.draw_handler_add(
|
||||||
|
draw_callback_nodeoutline, args, 'WINDOW', 'POST_PIXEL')
|
||||||
|
|
||||||
self.mouse_path = []
|
self.mouse_path = []
|
||||||
|
|
||||||
@ -1030,12 +1055,18 @@ class NWDeleteUnused(Operator, NWBase):
|
|||||||
bl_label = 'Delete Unused Nodes'
|
bl_label = 'Delete Unused Nodes'
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
delete_muted: BoolProperty(name="Delete Muted", description="Delete (but reconnect, like Ctrl-X) all muted nodes", default=True)
|
delete_muted: BoolProperty(
|
||||||
delete_frames: BoolProperty(name="Delete Empty Frames", description="Delete all frames that have no nodes inside them", default=True)
|
name="Delete Muted",
|
||||||
|
description="Delete (but reconnect, like Ctrl-X) all muted nodes",
|
||||||
|
default=True)
|
||||||
|
delete_frames: BoolProperty(
|
||||||
|
name="Delete Empty Frames",
|
||||||
|
description="Delete all frames that have no nodes inside them",
|
||||||
|
default=True)
|
||||||
|
|
||||||
def is_unused_node(self, node):
|
def is_unused_node(self, node):
|
||||||
end_types = ['OUTPUT_MATERIAL', 'OUTPUT', 'VIEWER', 'COMPOSITE', \
|
end_types = ['OUTPUT_MATERIAL', 'OUTPUT', 'VIEWER', 'COMPOSITE',
|
||||||
'SPLITVIEWER', 'OUTPUT_FILE', 'LEVELS', 'OUTPUT_LIGHT', \
|
'SPLITVIEWER', 'OUTPUT_FILE', 'LEVELS', 'OUTPUT_LIGHT',
|
||||||
'OUTPUT_WORLD', 'GROUP_INPUT', 'GROUP_OUTPUT', 'FRAME']
|
'OUTPUT_WORLD', 'GROUP_INPUT', 'GROUP_OUTPUT', 'FRAME']
|
||||||
if node.type in end_types:
|
if node.type in end_types:
|
||||||
return False
|
return False
|
||||||
@ -1059,7 +1090,7 @@ class NWDeleteUnused(Operator, NWBase):
|
|||||||
# Store selection
|
# Store selection
|
||||||
selection = []
|
selection = []
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
if node.select == True:
|
if node.select:
|
||||||
selection.append(node.name)
|
selection.append(node.name)
|
||||||
|
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
@ -1176,12 +1207,14 @@ class NWSwapLinks(Operator, NWBase):
|
|||||||
try:
|
try:
|
||||||
links.new(n2.outputs[connection[0]], connection[1])
|
links.new(n2.outputs[connection[0]], connection[1])
|
||||||
except:
|
except:
|
||||||
self.report({'WARNING'}, "Some connections have been lost due to differing numbers of output sockets")
|
self.report({'WARNING'},
|
||||||
|
"Some connections have been lost due to differing numbers of output sockets")
|
||||||
for connection in n2_outputs:
|
for connection in n2_outputs:
|
||||||
try:
|
try:
|
||||||
links.new(n1.outputs[connection[0]], connection[1])
|
links.new(n1.outputs[connection[0]], connection[1])
|
||||||
except:
|
except:
|
||||||
self.report({'WARNING'}, "Some connections have been lost due to differing numbers of output sockets")
|
self.report({'WARNING'},
|
||||||
|
"Some connections have been lost due to differing numbers of output sockets")
|
||||||
else:
|
else:
|
||||||
if n1.outputs or n2.outputs:
|
if n1.outputs or n2.outputs:
|
||||||
self.report({'WARNING'}, "One of the nodes has no outputs!")
|
self.report({'WARNING'}, "One of the nodes has no outputs!")
|
||||||
@ -1281,6 +1314,7 @@ class NWAddAttrNode(Operator, NWBase):
|
|||||||
nodes.active.attribute_name = self.attr_name
|
nodes.active.attribute_name = self.attr_name
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class NWPreviewNode(Operator, NWBase):
|
class NWPreviewNode(Operator, NWBase):
|
||||||
bl_idname = "node.nw_preview_node"
|
bl_idname = "node.nw_preview_node"
|
||||||
bl_label = "Preview Node"
|
bl_label = "Preview Node"
|
||||||
@ -1318,7 +1352,7 @@ class NWPreviewNode(Operator, NWBase):
|
|||||||
# if viewer output is already used but leads to the same socket we can still use it
|
# if viewer output is already used but leads to the same socket we can still use it
|
||||||
is_used = self.is_socket_used_other_mats(socket)
|
is_used = self.is_socket_used_other_mats(socket)
|
||||||
if is_used:
|
if is_used:
|
||||||
if connect_socket == None:
|
if connect_socket is None:
|
||||||
continue
|
continue
|
||||||
groupout = get_group_output_node(node.node_tree)
|
groupout = get_group_output_node(node.node_tree)
|
||||||
groupout_input = groupout.inputs[i]
|
groupout_input = groupout.inputs[i]
|
||||||
@ -1354,7 +1388,7 @@ class NWPreviewNode(Operator, NWBase):
|
|||||||
|
|
||||||
def get_shader_output_node(self, tree):
|
def get_shader_output_node(self, tree):
|
||||||
for node in tree.nodes:
|
for node in tree.nodes:
|
||||||
if node.type == self.shader_output_type and node.is_active_output == True:
|
if node.type == self.shader_output_type and node.is_active_output:
|
||||||
return node
|
return node
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1510,7 +1544,8 @@ class NWPreviewNode(Operator, NWBase):
|
|||||||
link_end = output_socket
|
link_end = output_socket
|
||||||
while tree.nodes.active != active:
|
while tree.nodes.active != active:
|
||||||
node = tree.nodes.active
|
node = tree.nodes.active
|
||||||
index = self.ensure_viewer_socket(node,'NodeSocketGeometry', connect_socket=active.outputs[out_i] if node.node_tree.nodes.active == active else None)
|
index = self.ensure_viewer_socket(
|
||||||
|
node, 'NodeSocketGeometry', connect_socket=active.outputs[out_i] if node.node_tree.nodes.active == active else None)
|
||||||
link_start = node.outputs[index]
|
link_start = node.outputs[index]
|
||||||
node_socket = node.node_tree.outputs[index]
|
node_socket = node.node_tree.outputs[index]
|
||||||
if node_socket in delete_sockets:
|
if node_socket in delete_sockets:
|
||||||
@ -1531,7 +1566,6 @@ class NWPreviewNode(Operator, NWBase):
|
|||||||
force_update(context)
|
force_update(context)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
# What follows is code for the shader editor
|
# What follows is code for the shader editor
|
||||||
output_types = [x.nodetype for x in
|
output_types = [x.nodetype for x in
|
||||||
get_nodes_from_category('Output', context)]
|
get_nodes_from_category('Output', context)]
|
||||||
@ -1586,7 +1620,8 @@ class NWPreviewNode(Operator, NWBase):
|
|||||||
link_end = output_socket
|
link_end = output_socket
|
||||||
while tree.nodes.active != active:
|
while tree.nodes.active != active:
|
||||||
node = tree.nodes.active
|
node = tree.nodes.active
|
||||||
index = self.ensure_viewer_socket(node, socket_type, connect_socket=active.outputs[out_i] if node.node_tree.nodes.active == active else None)
|
index = self.ensure_viewer_socket(
|
||||||
|
node, socket_type, connect_socket=active.outputs[out_i] if node.node_tree.nodes.active == active else None)
|
||||||
link_start = node.outputs[index]
|
link_start = node.outputs[index]
|
||||||
node_socket = node.node_tree.outputs[index]
|
node_socket = node.node_tree.outputs[index]
|
||||||
if node_socket in delete_sockets:
|
if node_socket in delete_sockets:
|
||||||
@ -1649,7 +1684,7 @@ class NWFrameSelected(Operator, NWBase):
|
|||||||
nodes, links = get_nodes_links(context)
|
nodes, links = get_nodes_links(context)
|
||||||
selected = []
|
selected = []
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
if node.select == True:
|
if node.select:
|
||||||
selected.append(node)
|
selected.append(node)
|
||||||
|
|
||||||
bpy.ops.node.add_node(type='NodeFrame')
|
bpy.ops.node.add_node(type='NodeFrame')
|
||||||
@ -1783,8 +1818,10 @@ class NWSwitchNodeType(Operator, NWBase):
|
|||||||
for the_type in types_order_one:
|
for the_type in types_order_one:
|
||||||
if socket.type == the_type:
|
if socket.type == the_type:
|
||||||
# create values for sockets['INPUTS'][the_type] and sockets['OUTPUTS'][the_type]
|
# create values for sockets['INPUTS'][the_type] and sockets['OUTPUTS'][the_type]
|
||||||
# entry structure: (index_in_type, socket_index, socket_name, socket_default_value, socket_links)
|
# entry structure: (index_in_type, socket_index, socket_name,
|
||||||
sockets[in_out_name][the_type].append((len(sockets[in_out_name][the_type]), i, the_name, dval, socket_links))
|
# socket_default_value, socket_links)
|
||||||
|
sockets[in_out_name][the_type].append(
|
||||||
|
(len(sockets[in_out_name][the_type]), i, the_name, dval, socket_links))
|
||||||
# Check which of the types in inputs/outputs is considered to be "main".
|
# Check which of the types in inputs/outputs is considered to be "main".
|
||||||
# Set values of sockets['INPUTS']['MAIN'] and sockets['OUTPUTS']['MAIN']
|
# Set values of sockets['INPUTS']['MAIN'] and sockets['OUTPUTS']['MAIN']
|
||||||
for type_check in types_order_one:
|
for type_check in types_order_one:
|
||||||
@ -1969,7 +2006,9 @@ class NWMergeNodes(Operator, NWBase):
|
|||||||
# Search for the first node which had output links that do not create
|
# Search for the first node which had output links that do not create
|
||||||
# a cycle, which we can then reconnect afterwards.
|
# a cycle, which we can then reconnect afterwards.
|
||||||
if prev_links == [] and node.outputs[0].is_linked:
|
if prev_links == [] and node.outputs[0].is_linked:
|
||||||
prev_links = [link for link in node.outputs[0].links if not NWMergeNodes.link_creates_cycle(link, selected_nodes)]
|
prev_links = [
|
||||||
|
link for link in node.outputs[0].links if not NWMergeNodes.link_creates_cycle(
|
||||||
|
link, selected_nodes)]
|
||||||
# Get the index of the socket, the last one is a multi input, and is thus used repeatedly
|
# Get the index of the socket, the last one is a multi input, and is thus used repeatedly
|
||||||
# To get the placement to look right we need to reverse the order in which we connect the
|
# To get the placement to look right we need to reverse the order in which we connect the
|
||||||
# outputs to the multi input socket.
|
# outputs to the multi input socket.
|
||||||
@ -2081,7 +2120,14 @@ class NWMergeNodes(Operator, NWBase):
|
|||||||
if selected_mix and selected_math and merge_type == 'AUTO':
|
if selected_mix and selected_math and merge_type == 'AUTO':
|
||||||
selected_mix += selected_math
|
selected_mix += selected_math
|
||||||
selected_math = []
|
selected_math = []
|
||||||
for nodes_list in [selected_mix, selected_shader, selected_geometry, selected_math, selected_vector, selected_z, selected_alphaover]:
|
for nodes_list in [
|
||||||
|
selected_mix,
|
||||||
|
selected_shader,
|
||||||
|
selected_geometry,
|
||||||
|
selected_math,
|
||||||
|
selected_vector,
|
||||||
|
selected_z,
|
||||||
|
selected_alphaover]:
|
||||||
if not nodes_list:
|
if not nodes_list:
|
||||||
continue
|
continue
|
||||||
count_before = len(nodes)
|
count_before = len(nodes)
|
||||||
@ -2100,8 +2146,9 @@ class NWMergeNodes(Operator, NWBase):
|
|||||||
else:
|
else:
|
||||||
node_type = 'GeometryNode'
|
node_type = 'GeometryNode'
|
||||||
if merge_position == 'CENTER':
|
if merge_position == 'CENTER':
|
||||||
loc_y = ((nodes_list[len(nodes_list) - 1][2]) + (nodes_list[len(nodes_list) - 2][2])) / 2 # average yloc of last two nodes (lowest two)
|
# average yloc of last two nodes (lowest two)
|
||||||
if nodes_list[len(nodes_list) - 1][-1] == True: # if last node is hidden, mix should be shifted up a bit
|
loc_y = ((nodes_list[len(nodes_list) - 1][2]) + (nodes_list[len(nodes_list) - 2][2])) / 2
|
||||||
|
if nodes_list[len(nodes_list) - 1][-1]: # if last node is hidden, mix should be shifted up a bit
|
||||||
if do_hide:
|
if do_hide:
|
||||||
loc_y += 40
|
loc_y += 40
|
||||||
else:
|
else:
|
||||||
@ -2171,11 +2218,13 @@ class NWMergeNodes(Operator, NWBase):
|
|||||||
elif nodes_list == selected_geometry:
|
elif nodes_list == selected_geometry:
|
||||||
if mode in ('JOIN', 'MIX'):
|
if mode in ('JOIN', 'MIX'):
|
||||||
add_type = node_type + 'JoinGeometry'
|
add_type = node_type + 'JoinGeometry'
|
||||||
add = self.merge_with_multi_input(nodes_list, merge_position, do_hide, loc_x, links, nodes, add_type,[0])
|
add = self.merge_with_multi_input(
|
||||||
|
nodes_list, merge_position, do_hide, loc_x, links, nodes, add_type, [0])
|
||||||
else:
|
else:
|
||||||
add_type = node_type + 'MeshBoolean'
|
add_type = node_type + 'MeshBoolean'
|
||||||
indices = [0, 1] if mode == 'DIFFERENCE' else [1]
|
indices = [0, 1] if mode == 'DIFFERENCE' else [1]
|
||||||
add = self.merge_with_multi_input(nodes_list, merge_position, do_hide, loc_x, links, nodes, add_type,indices)
|
add = self.merge_with_multi_input(
|
||||||
|
nodes_list, merge_position, do_hide, loc_x, links, nodes, add_type, indices)
|
||||||
add.operation = mode
|
add.operation = mode
|
||||||
was_multi = True
|
was_multi = True
|
||||||
break
|
break
|
||||||
@ -2221,7 +2270,8 @@ class NWMergeNodes(Operator, NWBase):
|
|||||||
# "last" node has been added as first, so its index is count_before.
|
# "last" node has been added as first, so its index is count_before.
|
||||||
last_add = nodes[count_before]
|
last_add = nodes[count_before]
|
||||||
# Create list of invalid indexes.
|
# Create list of invalid indexes.
|
||||||
invalid_nodes = [nodes[n[0]] for n in (selected_mix + selected_math + selected_shader + selected_z + selected_geometry)]
|
invalid_nodes = [nodes[n[0]]
|
||||||
|
for n in (selected_mix + selected_math + selected_shader + selected_z + selected_geometry)]
|
||||||
|
|
||||||
# Special case:
|
# Special case:
|
||||||
# Two nodes were selected and first selected has no output links, second selected has output links.
|
# Two nodes were selected and first selected has no output links, second selected has output links.
|
||||||
@ -2299,7 +2349,7 @@ class NWBatchChangeNodes(Operator, NWBase):
|
|||||||
operation = self.operation
|
operation = self.operation
|
||||||
for node in context.selected_nodes:
|
for node in context.selected_nodes:
|
||||||
if node.type == 'MIX_RGB' or (node.bl_idname == 'ShaderNodeMix' and node.data_type == 'RGBA'):
|
if node.type == 'MIX_RGB' or (node.bl_idname == 'ShaderNodeMix' and node.data_type == 'RGBA'):
|
||||||
if not blend_type in [nav[0] for nav in navs]:
|
if blend_type not in [nav[0] for nav in navs]:
|
||||||
node.blend_type = blend_type
|
node.blend_type = blend_type
|
||||||
else:
|
else:
|
||||||
if blend_type == 'NEXT':
|
if blend_type == 'NEXT':
|
||||||
@ -2318,7 +2368,7 @@ class NWBatchChangeNodes(Operator, NWBase):
|
|||||||
node.blend_type = blend_types[index - 1][0]
|
node.blend_type = blend_types[index - 1][0]
|
||||||
|
|
||||||
if node.type == 'MATH' or node.bl_idname == 'ShaderNodeMath':
|
if node.type == 'MATH' or node.bl_idname == 'ShaderNodeMath':
|
||||||
if not operation in [nav[0] for nav in navs]:
|
if operation not in [nav[0] for nav in navs]:
|
||||||
node.operation = operation
|
node.operation = operation
|
||||||
else:
|
else:
|
||||||
if operation == 'NEXT':
|
if operation == 'NEXT':
|
||||||
@ -2414,7 +2464,11 @@ class NWCopySettings(Operator, NWBase):
|
|||||||
# Report nodes that are not valid
|
# Report nodes that are not valid
|
||||||
valid_node_names = [n.name for n in valid_nodes]
|
valid_node_names = [n.name for n in valid_nodes]
|
||||||
not_valid_names = list(set(selected_node_names) - set(valid_node_names))
|
not_valid_names = list(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))
|
self.report(
|
||||||
|
{'INFO'},
|
||||||
|
"Ignored {} (not of the same type as {})".format(
|
||||||
|
", ".join(not_valid_names),
|
||||||
|
node_active.name))
|
||||||
|
|
||||||
# Reference original
|
# Reference original
|
||||||
orig = node_active
|
orig = node_active
|
||||||
@ -2479,7 +2533,11 @@ class NWCopySettings(Operator, NWBase):
|
|||||||
|
|
||||||
orig.select = True
|
orig.select = True
|
||||||
node_tree.nodes.active = orig
|
node_tree.nodes.active = orig
|
||||||
self.report({'INFO'}, "Successfully copied attributes from {} to: {}".format(orig.name, ", ".join(success_names)))
|
self.report(
|
||||||
|
{'INFO'},
|
||||||
|
"Successfully copied attributes from {} to: {}".format(
|
||||||
|
orig.name,
|
||||||
|
", ".join(success_names)))
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
@ -2587,7 +2645,10 @@ class NWAddTextureSetup(Operator, NWBase):
|
|||||||
bl_description = "Add Texture Node Setup to Selected Shaders"
|
bl_description = "Add Texture Node Setup to Selected Shaders"
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
add_mapping: BoolProperty(name="Add Mapping Nodes", description="Create coordinate and mapping nodes for the texture (ignored for selected texture nodes)", default=True)
|
add_mapping: BoolProperty(
|
||||||
|
name="Add Mapping Nodes",
|
||||||
|
description="Create coordinate and mapping nodes for the texture (ignored for selected texture nodes)",
|
||||||
|
default=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@ -2891,7 +2952,8 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
|
|||||||
# If more than one texture add reroute node in between
|
# If more than one texture add reroute node in between
|
||||||
reroute = nodes.new(type='NodeReroute')
|
reroute = nodes.new(type='NodeReroute')
|
||||||
texture_nodes.append(reroute)
|
texture_nodes.append(reroute)
|
||||||
tex_coords = Vector((texture_nodes[0].location.x, sum(n.location.y for n in texture_nodes)/len(texture_nodes)))
|
tex_coords = Vector((texture_nodes[0].location.x,
|
||||||
|
sum(n.location.y for n in texture_nodes) / len(texture_nodes)))
|
||||||
reroute.location = tex_coords + Vector((-50, -120))
|
reroute.location = tex_coords + Vector((-50, -120))
|
||||||
for texture_node in texture_nodes:
|
for texture_node in texture_nodes:
|
||||||
link = links.new(texture_node.inputs[0], reroute.outputs[0])
|
link = links.new(texture_node.inputs[0], reroute.outputs[0])
|
||||||
@ -3131,7 +3193,8 @@ class NWAlignNodes(Operator, NWBase):
|
|||||||
active_loc = copy(nodes.active.location) # make a copy, not a reference
|
active_loc = copy(nodes.active.location) # make a copy, not a reference
|
||||||
|
|
||||||
# Check if nodes should be laid out horizontally or vertically
|
# Check if nodes should be laid out horizontally or vertically
|
||||||
x_locs = [n.location.x + (n.dimensions.x / 2) for n in selection] # use dimension to get center of node, not corner
|
# use dimension to get center of node, not corner
|
||||||
|
x_locs = [n.location.x + (n.dimensions.x / 2) for n in selection]
|
||||||
y_locs = [n.location.y - (n.dimensions.y / 2) for n in selection]
|
y_locs = [n.location.y - (n.dimensions.y / 2) for n in selection]
|
||||||
x_range = max(x_locs) - min(x_locs)
|
x_range = max(x_locs) - min(x_locs)
|
||||||
y_range = max(y_locs) - min(y_locs)
|
y_range = max(y_locs) - min(y_locs)
|
||||||
@ -3166,7 +3229,8 @@ class NWAlignNodes(Operator, NWBase):
|
|||||||
for node in selection:
|
for node in selection:
|
||||||
node.location += active_loc_diff
|
node.location += active_loc_diff
|
||||||
else: # Position nodes centered around where they used to be
|
else: # Position nodes centered around where they used to be
|
||||||
locs = ([n.location.x + (n.dimensions.x / 2) for n in selection]) if horizontal else ([n.location.y - (n.dimensions.y / 2) for n in selection])
|
locs = ([n.location.x + (n.dimensions.x / 2) for n in selection]
|
||||||
|
) if horizontal else ([n.location.y - (n.dimensions.y / 2) for n in selection])
|
||||||
new_mid = (max(locs) + min(locs)) / 2
|
new_mid = (max(locs) + min(locs)) / 2
|
||||||
for node in selection:
|
for node in selection:
|
||||||
if horizontal:
|
if horizontal:
|
||||||
@ -3409,7 +3473,6 @@ class NWAddSequence(Operator, NWBase, ImportHelper):
|
|||||||
self.report({'ERROR'}, filename + " does not seem to be part of a sequence")
|
self.report({'ERROR'}, filename + " does not seem to be part of a sequence")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
|
|
||||||
extension = filename.split('.')[-1]
|
extension = filename.split('.')[-1]
|
||||||
reverse = without_ext[::-1] # reverse string
|
reverse = without_ext[::-1] # reverse string
|
||||||
|
|
||||||
@ -3458,7 +3521,8 @@ class NWAddSequence(Operator, NWBase, ImportHelper):
|
|||||||
img.name = name_with_hashes
|
img.name = name_with_hashes
|
||||||
node.image = img
|
node.image = img
|
||||||
image_user = node.image_user if tree.type == 'SHADER' else node
|
image_user = node.image_user if tree.type == 'SHADER' else node
|
||||||
image_user.frame_offset = int(files[0][len(without_num)+len(directory):-1*(len(extension)+1)]) - 1 # separate the number from the file name of the first file
|
# separate the number from the file name of the first file
|
||||||
|
image_user.frame_offset = int(files[0][len(without_num) + len(directory):-1 * (len(extension) + 1)]) - 1
|
||||||
image_user.frame_duration = num_frames
|
image_user.frame_duration = num_frames
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
@ -3545,7 +3609,7 @@ class NWViewerFocus(bpy.types.Operator):
|
|||||||
mlocy = event.mouse_region_y
|
mlocy = event.mouse_region_y
|
||||||
select_node = bpy.ops.node.select(location=(mlocx, mlocy), extend=False)
|
select_node = bpy.ops.node.select(location=(mlocx, mlocy), extend=False)
|
||||||
|
|
||||||
if not 'FINISHED' in select_node: # only run if we're not clicking on a node
|
if 'FINISHED' not in select_node: # only run if we're not clicking on a node
|
||||||
region_x = context.region.width
|
region_x = context.region.width
|
||||||
region_y = context.region.height
|
region_y = context.region.height
|
||||||
|
|
||||||
@ -3859,9 +3923,11 @@ class NWMergeNodesMenu(Menu, NWBase):
|
|||||||
props.mode = 'MIX'
|
props.mode = 'MIX'
|
||||||
props.merge_type = 'ALPHAOVER'
|
props.merge_type = 'ALPHAOVER'
|
||||||
|
|
||||||
|
|
||||||
class NWMergeGeometryMenu(Menu, NWBase):
|
class NWMergeGeometryMenu(Menu, NWBase):
|
||||||
bl_idname = "NODE_MT_nw_merge_geometry_menu"
|
bl_idname = "NODE_MT_nw_merge_geometry_menu"
|
||||||
bl_label = "Merge Selected Nodes using Geometry Nodes"
|
bl_label = "Merge Selected Nodes using Geometry Nodes"
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
# The boolean node + Join Geometry node
|
# The boolean node + Join Geometry node
|
||||||
@ -3870,6 +3936,7 @@ class NWMergeGeometryMenu(Menu, NWBase):
|
|||||||
props.mode = type
|
props.mode = type
|
||||||
props.merge_type = 'GEOMETRY'
|
props.merge_type = 'GEOMETRY'
|
||||||
|
|
||||||
|
|
||||||
class NWMergeShadersMenu(Menu, NWBase):
|
class NWMergeShadersMenu(Menu, NWBase):
|
||||||
bl_idname = "NODE_MT_nw_merge_shaders_menu"
|
bl_idname = "NODE_MT_nw_merge_shaders_menu"
|
||||||
bl_label = "Merge Selected Nodes using Shaders"
|
bl_label = "Merge Selected Nodes using Shaders"
|
||||||
@ -4318,10 +4385,14 @@ kmi_defs = (
|
|||||||
(NWLinkActiveToSelected.bl_idname, 'SEMI_COLON', 'PRESS', False, True, False,
|
(NWLinkActiveToSelected.bl_idname, 'SEMI_COLON', 'PRESS', False, True, False,
|
||||||
(('replace', True), ('use_node_name', False), ('use_outputs_names', True),), "Link active to selected (Replace links, output names)"),
|
(('replace', True), ('use_node_name', False), ('use_outputs_names', True),), "Link active to selected (Replace links, output names)"),
|
||||||
# CHANGE MIX FACTOR
|
# CHANGE MIX FACTOR
|
||||||
(NWChangeMixFactor.bl_idname, 'LEFT_ARROW', 'PRESS', False, False, True, (('option', -0.1),), "Reduce Mix Factor by 0.1"),
|
(NWChangeMixFactor.bl_idname, 'LEFT_ARROW', 'PRESS', False,
|
||||||
(NWChangeMixFactor.bl_idname, 'RIGHT_ARROW', 'PRESS', False, False, True, (('option', 0.1),), "Increase Mix Factor by 0.1"),
|
False, True, (('option', -0.1),), "Reduce Mix Factor by 0.1"),
|
||||||
(NWChangeMixFactor.bl_idname, 'LEFT_ARROW', 'PRESS', False, True, True, (('option', -0.01),), "Reduce Mix Factor by 0.01"),
|
(NWChangeMixFactor.bl_idname, 'RIGHT_ARROW', 'PRESS', False,
|
||||||
(NWChangeMixFactor.bl_idname, 'RIGHT_ARROW', 'PRESS', False, True, True, (('option', 0.01),), "Increase Mix Factor by 0.01"),
|
False, True, (('option', 0.1),), "Increase Mix Factor by 0.1"),
|
||||||
|
(NWChangeMixFactor.bl_idname, 'LEFT_ARROW', 'PRESS', False,
|
||||||
|
True, True, (('option', -0.01),), "Reduce Mix Factor by 0.01"),
|
||||||
|
(NWChangeMixFactor.bl_idname, 'RIGHT_ARROW', 'PRESS', False,
|
||||||
|
True, True, (('option', 0.01),), "Increase Mix Factor by 0.01"),
|
||||||
(NWChangeMixFactor.bl_idname, 'LEFT_ARROW', 'PRESS', True, True, True, (('option', 0.0),), "Set Mix Factor to 0.0"),
|
(NWChangeMixFactor.bl_idname, 'LEFT_ARROW', 'PRESS', True, True, True, (('option', 0.0),), "Set Mix Factor to 0.0"),
|
||||||
(NWChangeMixFactor.bl_idname, 'RIGHT_ARROW', 'PRESS', True, True, True, (('option', 1.0),), "Set Mix Factor to 1.0"),
|
(NWChangeMixFactor.bl_idname, 'RIGHT_ARROW', 'PRESS', True, True, True, (('option', 1.0),), "Set Mix Factor to 1.0"),
|
||||||
(NWChangeMixFactor.bl_idname, 'NUMPAD_0', 'PRESS', True, True, True, (('option', 0.0),), "Set Mix Factor to 0.0"),
|
(NWChangeMixFactor.bl_idname, 'NUMPAD_0', 'PRESS', True, True, True, (('option', 0.0),), "Set Mix Factor to 0.0"),
|
||||||
@ -4333,16 +4404,19 @@ kmi_defs = (
|
|||||||
# MODIFY LABEL (Alt Shift L)
|
# MODIFY LABEL (Alt Shift L)
|
||||||
(NWModifyLabels.bl_idname, 'L', 'PRESS', False, True, True, None, "Modify node labels"),
|
(NWModifyLabels.bl_idname, 'L', 'PRESS', False, True, True, None, "Modify node labels"),
|
||||||
# Copy Label from active to selected
|
# Copy Label from active to selected
|
||||||
(NWCopyLabel.bl_idname, 'V', 'PRESS', False, True, False, (('option', 'FROM_ACTIVE'),), "Copy label from active to selected"),
|
(NWCopyLabel.bl_idname, 'V', 'PRESS', False, True, False,
|
||||||
|
(('option', 'FROM_ACTIVE'),), "Copy label from active to selected"),
|
||||||
# DETACH OUTPUTS (Alt Shift D)
|
# DETACH OUTPUTS (Alt Shift D)
|
||||||
(NWDetachOutputs.bl_idname, 'D', 'PRESS', False, True, True, None, "Detach outputs"),
|
(NWDetachOutputs.bl_idname, 'D', 'PRESS', False, True, True, None, "Detach outputs"),
|
||||||
# LINK TO OUTPUT NODE (O)
|
# LINK TO OUTPUT NODE (O)
|
||||||
(NWLinkToOutputNode.bl_idname, 'O', 'PRESS', False, False, False, None, "Link to output node"),
|
(NWLinkToOutputNode.bl_idname, 'O', 'PRESS', False, False, False, None, "Link to output node"),
|
||||||
# SELECT PARENT/CHILDREN
|
# SELECT PARENT/CHILDREN
|
||||||
# Select Children
|
# Select Children
|
||||||
(NWSelectParentChildren.bl_idname, 'RIGHT_BRACKET', 'PRESS', False, False, False, (('option', 'CHILD'),), "Select children"),
|
(NWSelectParentChildren.bl_idname, 'RIGHT_BRACKET', 'PRESS',
|
||||||
|
False, False, False, (('option', 'CHILD'),), "Select children"),
|
||||||
# Select Parent
|
# Select Parent
|
||||||
(NWSelectParentChildren.bl_idname, 'LEFT_BRACKET', 'PRESS', False, False, False, (('option', 'PARENT'),), "Select Parent"),
|
(NWSelectParentChildren.bl_idname, 'LEFT_BRACKET', 'PRESS',
|
||||||
|
False, False, False, (('option', 'PARENT'),), "Select Parent"),
|
||||||
# Add Texture Setup
|
# Add Texture Setup
|
||||||
(NWAddTextureSetup.bl_idname, 'T', 'PRESS', True, False, False, None, "Add texture setup"),
|
(NWAddTextureSetup.bl_idname, 'T', 'PRESS', True, False, False, None, "Add texture setup"),
|
||||||
# Add Principled BSDF Texture Setup
|
# Add Principled BSDF Texture Setup
|
||||||
@ -4356,8 +4430,10 @@ kmi_defs = (
|
|||||||
# Swap Links
|
# Swap Links
|
||||||
(NWSwapLinks.bl_idname, 'S', 'PRESS', False, False, True, None, "Swap Links"),
|
(NWSwapLinks.bl_idname, 'S', 'PRESS', False, False, True, None, "Swap Links"),
|
||||||
# Preview Node
|
# Preview Node
|
||||||
(NWPreviewNode.bl_idname, 'LEFTMOUSE', 'PRESS', True, True, False, (('run_in_geometry_nodes', False),), "Preview node output"),
|
(NWPreviewNode.bl_idname, 'LEFTMOUSE', 'PRESS', True, True, False,
|
||||||
(NWPreviewNode.bl_idname, 'LEFTMOUSE', 'PRESS', False, True, True, (('run_in_geometry_nodes', True),), "Preview node output"),
|
(('run_in_geometry_nodes', False),), "Preview node output"),
|
||||||
|
(NWPreviewNode.bl_idname, 'LEFTMOUSE', 'PRESS', False, True,
|
||||||
|
True, (('run_in_geometry_nodes', True),), "Preview node output"),
|
||||||
# Reload Images
|
# Reload Images
|
||||||
(NWReloadImages.bl_idname, 'R', 'PRESS', False, False, True, None, "Reload images"),
|
(NWReloadImages.bl_idname, 'R', 'PRESS', False, False, True, None, "Reload images"),
|
||||||
# Lazy Mix
|
# Lazy Mix
|
||||||
@ -4365,18 +4441,22 @@ kmi_defs = (
|
|||||||
# Lazy Connect
|
# Lazy Connect
|
||||||
(NWLazyConnect.bl_idname, 'RIGHTMOUSE', 'PRESS', False, False, True, (('with_menu', False),), "Lazy Connect"),
|
(NWLazyConnect.bl_idname, 'RIGHTMOUSE', 'PRESS', False, False, True, (('with_menu', False),), "Lazy Connect"),
|
||||||
# Lazy Connect with Menu
|
# Lazy Connect with Menu
|
||||||
(NWLazyConnect.bl_idname, 'RIGHTMOUSE', 'PRESS', False, True, True, (('with_menu', True),), "Lazy Connect with Socket Menu"),
|
(NWLazyConnect.bl_idname, 'RIGHTMOUSE', 'PRESS', False, True,
|
||||||
|
True, (('with_menu', True),), "Lazy Connect with Socket Menu"),
|
||||||
# Viewer Tile Center
|
# Viewer Tile Center
|
||||||
(NWViewerFocus.bl_idname, 'LEFTMOUSE', 'DOUBLE_CLICK', False, False, False, None, "Set Viewers Tile Center"),
|
(NWViewerFocus.bl_idname, 'LEFTMOUSE', 'DOUBLE_CLICK', False, False, False, None, "Set Viewers Tile Center"),
|
||||||
# Align Nodes
|
# Align Nodes
|
||||||
(NWAlignNodes.bl_idname, 'EQUAL', 'PRESS', False, True, False, None, "Align selected nodes neatly in a row/column"),
|
(NWAlignNodes.bl_idname, 'EQUAL', 'PRESS', False, True, False, None, "Align selected nodes neatly in a row/column"),
|
||||||
# Reset Nodes (Back Space)
|
# Reset Nodes (Back Space)
|
||||||
(NWResetNodes.bl_idname, 'BACK_SPACE', 'PRESS', False, False, False, None, "Revert node back to default state, but keep connections"),
|
(NWResetNodes.bl_idname, 'BACK_SPACE', 'PRESS', False, False, False,
|
||||||
|
None, "Revert node back to default state, but keep connections"),
|
||||||
# MENUS
|
# MENUS
|
||||||
('wm.call_menu', 'W', 'PRESS', False, True, False, (('name', NodeWranglerMenu.bl_idname),), "Node Wrangler menu"),
|
('wm.call_menu', 'W', 'PRESS', False, True, False, (('name', NodeWranglerMenu.bl_idname),), "Node Wrangler menu"),
|
||||||
('wm.call_menu', 'SLASH', 'PRESS', False, False, False, (('name', NWAddReroutesMenu.bl_idname),), "Add Reroutes menu"),
|
('wm.call_menu', 'SLASH', 'PRESS', False, False, False, (('name', NWAddReroutesMenu.bl_idname),), "Add Reroutes menu"),
|
||||||
('wm.call_menu', 'NUMPAD_SLASH', 'PRESS', False, False, False, (('name', NWAddReroutesMenu.bl_idname),), "Add Reroutes menu"),
|
('wm.call_menu', 'NUMPAD_SLASH', 'PRESS', False, False, False,
|
||||||
('wm.call_menu', 'BACK_SLASH', 'PRESS', False, False, False, (('name', NWLinkActiveToSelectedMenu.bl_idname),), "Link active to selected (menu)"),
|
(('name', NWAddReroutesMenu.bl_idname),), "Add Reroutes menu"),
|
||||||
|
('wm.call_menu', 'BACK_SLASH', 'PRESS', False, False, False,
|
||||||
|
(('name', NWLinkActiveToSelectedMenu.bl_idname),), "Link active to selected (menu)"),
|
||||||
('wm.call_menu', 'C', 'PRESS', False, True, False, (('name', NWCopyToSelectedMenu.bl_idname),), "Copy to selected (menu)"),
|
('wm.call_menu', 'C', 'PRESS', False, True, False, (('name', NWCopyToSelectedMenu.bl_idname),), "Copy to selected (menu)"),
|
||||||
('wm.call_menu', 'S', 'PRESS', False, True, False, (('name', NWSwitchNodeTypeMenu.bl_idname),), "Switch node type menu"),
|
('wm.call_menu', 'S', 'PRESS', False, True, False, (('name', NWSwitchNodeTypeMenu.bl_idname),), "Switch node type menu"),
|
||||||
)
|
)
|
||||||
@ -4440,6 +4520,7 @@ classes = (
|
|||||||
NWSwitchNodeTypeMenu,
|
NWSwitchNodeTypeMenu,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
from bpy.utils import register_class
|
from bpy.utils import register_class
|
||||||
|
|
||||||
@ -4541,5 +4622,6 @@ def unregister():
|
|||||||
for cls in classes:
|
for cls in classes:
|
||||||
unregister_class(cls)
|
unregister_class(cls)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
register()
|
register()
|
||||||
|
Loading…
Reference in New Issue
Block a user