def paste_items_to_graph(eventtype, editor, uievent): """Paste items from a network editor event.""" if eventtype == "keyhit": mousepos = uievent.mousepos elif eventtype == "menukeyhit": mousepos = editor.screenBounds().center() else: mousepos = None if mousepos is not None: pos = editor.posFromScreen(mousepos) else: pos = None dialog = dialogs.PasteItemsDialog(editor, pos, mousepos, parent=hou.qt.mainWindow()) dialog.exec_() # This is a one off event so we don't care what happens after this. return None, True
def paste_items(scriptargs=None): """Paste items into the current context.""" # Try to find the current pane/context/level. current_pane = utils.find_current_pane_tab(scriptargs) # Couldn't determine where to paste so we display a warning # and abort. if current_pane is None: hou.ui.displayMessage( "Could not paste items", help="Could not determine paste context", severity=hou.severityType.Warning, ) return pos = current_pane.cursorPosition() # Run the paste dialog. dialog = dialogs.PasteItemsDialog(current_pane, pos, pos, parent=hou.qt.mainWindow()) dialog.exec_()