Ejemplo n.º 1
0
def selectPath(path, replace=False):
    """ 
        Select a path in the UFE Global selection
        Args:
            path (ufe.Path): The UFE path to select
            replace (bool=False): Replace the selection with
                                    given UFE path
    """
    sceneItem = ufe.Hierarchy.createItem(path)
    if replace:
        selection = ufe.Selection()
        selection.append(sceneItem)
        ufeSelectCmd.replaceWith(selection)
    else:
        ufeSelectCmd.append(sceneItem)
Ejemplo n.º 2
0
def selectPath(path, replace=False):
    """ 
        Select a path in the UFE Global selection
        Args:
            path (ufe.Path): The UFE path to select
            replace (bool=False): Replace the selection with
                                    given UFE path
    """
    # Do this import inside this function rather than at the top of the file
    # so that the module can be imported and ufeFeatureSetVersion() can be
    # called prior to maya.standalone.initialize().
    try:
        from maya.internal.ufeSupport import ufeSelectCmd
    except ImportError:
        # Maya 2019 and 2020 don't have ufeSupport plugin, so use fallback.
        from ufeScripts import ufeSelectCmd

    sceneItem = ufe.Hierarchy.createItem(path)
    if replace:
        selection = ufe.Selection()
        selection.append(sceneItem)
        ufeSelectCmd.replaceWith(selection)
    else:
        ufeSelectCmd.append(sceneItem)