def selectCmd(item): if item.runTimeId() == 1: # Single path segment. Simply pop the |world head of path. p = str(item.path().popHead()) cmds.select(p) else: sn = ufe.Selection() sn.append(item) ufeSelectCmd.replaceWith(sn)
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)
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)
def selectCmd(item): sn = ufe.Selection() sn.append(item) ufeSelectCmd.replaceWith(sn)