Changeset View
Changeset View
Standalone View
Standalone View
node_wrangler.py
| Context not available. | |||||
| ("NEVER", "Never", "Never collapse the new merge nodes") | ("NEVER", "Never", "Never collapse the new merge nodes") | ||||
| ), | ), | ||||
| default='NON_SHADER', | default='NON_SHADER', | ||||
| description="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specifiy whether to collapse them or show the full node with options expanded") | description="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specify whether to collapse them or show the full node with options expanded") | ||||
| merge_position: EnumProperty( | merge_position: EnumProperty( | ||||
| name="Mix Node Position", | name="Mix Node Position", | ||||
| items=( | items=( | ||||
| Context not available. | |||||
| ("BOTTOM", "Bottom", "Place the Mix node at the same height as the lowest node") | ("BOTTOM", "Bottom", "Place the Mix node at the same height as the lowest node") | ||||
| ), | ), | ||||
| default='CENTER', | default='CENTER', | ||||
| description="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specifiy the position of the new nodes") | description="When merging nodes with the Ctrl+Numpad0 hotkey (and similar) specify the position of the new nodes") | ||||
| show_hotkey_list: BoolProperty( | show_hotkey_list: BoolProperty( | ||||
| name="Show Hotkey List", | name="Show Hotkey List", | ||||
| Context not available. | |||||
| fname = path.splitext(fname)[0] | fname = path.splitext(fname)[0] | ||||
| # Remove digits | # Remove digits | ||||
| fname = ''.join(i for i in fname if not i.isdigit()) | fname = ''.join(i for i in fname if not i.isdigit()) | ||||
| # Seperate CamelCase by space | # Separate CamelCase by space | ||||
| fname = re.sub("([a-z])([A-Z])","\g<1> \g<2>",fname) | fname = re.sub("([a-z])([A-Z])","\g<1> \g<2>",fname) | ||||
| # Replace common separators with SPACE | # Replace common separators with SPACE | ||||
| seperators = ['_', '.', '-', '__', '--', '#'] | seperators = ['_', '.', '-', '__', '--', '#'] | ||||
| Context not available. | |||||
| # Too complicated for now | # Too complicated for now | ||||
| ''' | ''' | ||||
| # Frame. Does not update immediatly | # Frame. Does not update immediately | ||||
| # Seems to need an editor redraw | # Seems to need an editor redraw | ||||
| frame = nodes.new(type='NodeFrame') | frame = nodes.new(type='NodeFrame') | ||||
| frame.label = 'Displacement' | frame.label = 'Displacement' | ||||
| Context not available. | |||||
| frame.update() | frame.update() | ||||
| ''' | ''' | ||||
| #find ouput node | #find output node | ||||
| output_node = [n for n in nodes if n.bl_idname == 'ShaderNodeOutputMaterial'] | output_node = [n for n in nodes if n.bl_idname == 'ShaderNodeOutputMaterial'] | ||||
| if output_node: | if output_node: | ||||
| if not output_node[0].inputs[2].is_linked: | if not output_node[0].inputs[2].is_linked: | ||||
| Context not available. | |||||
| elif nodes.active in selection: | elif nodes.active in selection: | ||||
| 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 layed 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 | x_locs = [n.location.x + (n.dimensions.x / 2) for n in selection] # use dimension to get center of node, not corner | ||||
| 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) | ||||
| Context not available. | |||||
| (NWResetBG.bl_idname, 'Z', 'PRESS', False, False, False, None, "Reset backdrop image zoom"), | (NWResetBG.bl_idname, 'Z', 'PRESS', False, False, False, None, "Reset backdrop image zoom"), | ||||
| # Delete unused | # Delete unused | ||||
| (NWDeleteUnused.bl_idname, 'X', 'PRESS', False, False, True, None, "Delete unused nodes"), | (NWDeleteUnused.bl_idname, 'X', 'PRESS', False, False, True, None, "Delete unused nodes"), | ||||
| # Frame Seleted | # Frame Selected | ||||
| (NWFrameSelected.bl_idname, 'P', 'PRESS', False, True, False, None, "Frame selected nodes"), | (NWFrameSelected.bl_idname, 'P', 'PRESS', False, True, False, None, "Frame selected nodes"), | ||||
| # Swap Outputs | # Swap Outputs | ||||
| (NWSwapLinks.bl_idname, 'S', 'PRESS', False, False, True, None, "Swap Outputs"), | (NWSwapLinks.bl_idname, 'S', 'PRESS', False, False, True, None, "Swap Outputs"), | ||||
| Context not available. | |||||