示例#1
0
def copy_items(scriptargs=None):
    """Copy selected items from a pane tab to a target file."""
    # Find the current network editor pane.
    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(
            "Cannot copy items",
            help="Could not determine copy context",
            severity=hou.severityType.Warning,
        )

        return

    parent = current_pane.pwd()

    items = parent.selectedItems(True, True)

    # If there are no items elected display a warning and abort.
    if not items:
        hou.ui.displayMessage(
            "Could not copy items",
            help="No selected nodes",
            severity=hou.severityType.Warning,
        )

        return

    # Run the copy dialog.
    dialog = dialogs.CopyItemsDialog(items, parent, parent=hou.qt.mainWindow())
    dialog.show()
示例#2
0
def copy_item(item):
    """Copy a single item to a target file."""
    items = (item, )
    parent = item.parent()

    # Run the copy dialog.
    dialog = dialogs.CopyItemsDialog(items, parent, parent=hou.qt.mainWindow())

    dialog.exec_()
示例#3
0
def copy_items_from_graph(editor):
    """Copy items from a network editor event."""
    parent = editor.pwd()

    items = parent.selectedItems(True, True)

    # If there are no items selected then display an error and abort.
    if not items:
        hou.ui.displayMessage(
            "Could not copy selected items",
            help="Nothing was selected",
            severity=hou.severityType.Error,
        )

        return None, True

    dialog = dialogs.CopyItemsDialog(items, parent, parent=hou.qt.mainWindow())
    dialog.exec_()

    # This is a one off event so we don't care what happens after this.
    return None, True