CopyPrimCommand

class omni.usd.commands.CopyPrimCommand(path_from: str, path_to: Optional[str] = None, duplicate_layers: bool = False, combine_layers: bool = False, exclusive_select: bool = True, usd_context_name: str = '', flatten_references: bool = False, copy_to_introducing_layer: bool = False)

Bases: Command

Copy a primitive to a new path.

Due to the complexity of the USD composition, this command provide several options to handle different scenarios:

  • A prim is defined and authored in single layer, this command will simply copy it.

  • A prim is defined and authored in multiple layers, this command will copy the prim according to options duplicate_layers and combine_layers. See omni.usd.commands.CopyPrimCommand.__init__() for reference.

Methods

__init__(path_from[, path_to, ...])

Constructor.

do()

modify_callback_info(cb_type, cmd_args)

Returns a dictionary of information to be passed to callbacks of the given type.

undo()

__init__(path_from: str, path_to: Optional[str] = None, duplicate_layers: bool = False, combine_layers: bool = False, exclusive_select: bool = True, usd_context_name: str = '', flatten_references: bool = False, copy_to_introducing_layer: bool = False)

Constructor.

Parameters
  • path_from (str) – Path to copy from.

  • path_to (str, optional) – Path to copy to. If it’s None, a path is auto-generated from stage. Default is None.

  • duplicate_layers (bool, optional) – Duplicate prim in all layers from the local layer stack. Default is False, which means it only copies the prim spec with def specifier to the target path, and ignores all over opinions in the other layers the local layer stack. This option can only be enabled when combine_layers and copy_to_introducing_layer are False. This option is full with assumption and does not work well when prim has multiple defs in different layers, which is mostly ok for now as most of the contents authored with Kit has only one def for the same prim.

  • combine_layers (bool, optional) – Combine layers on copy. When this option is enabled, it will combine all opinions authored to the source prim scattered in all the layers from the local layer stack. Default is False.

  • exclusive_select (bool, optional) – If to exclusively select (clear old selections) the newly create object. Default is True.

  • flatten_references (bool, optional) – Flatten references during copy. It’s only valid when combine_layers is True, and copy_to_introducing_layer is False.

  • copy_to_introducing_layer (bool, optional) – If to copy it to the introducing layer, or the current edit target. Default is False, which means the current edit target.

modify_callback_info(cb_type: str, cmd_args: Dict[str, Any]) Dict[str, Any]

Returns a dictionary of information to be passed to callbacks of the given type.

By default callbacks are passed a copy of the arguments which were passed to execute() when the command was invoked. This method can be overridden to modify that information for specific callback types.

Parameters
  • cb_type – Type of callback the information will be passed to.

  • args – A dictionary containing a copy of the arguments with which the command was invoked. This is a shallow copy so implementations may add, remove or replace dictionary elements but should not modify any of the objects contained within it.

Returns

A dictionary of information to be passed to callbacks of the specified type.