コード例 #1
0
 def objectNodeCurrentChanged(self, index, prevIndex):
     """
     Look up the Maya node from the data at index, then add it to the
     selection.
     """
     # TODO: Based on the Maya selection key modifiers, we should
     # add to the current selection, or toggle, as needed.
     # TODO: When an object node tree item is selected, the attr nodes tree
     # view must all be deselected.
     ui_node = lib_uiquery.get_ui_node_from_index(index,
                                                  self.object_filterModel)
     if ui_node is None:
         return
     # Type info will be 'marker', 'bundle' or 'camera' based on
     # the selected node type.
     typeInfo = ui_node.typeInfo
     nodes = lib_uiquery.convert_ui_nodes_to_nodes([ui_node], typeInfo)
     maya_nodes = []
     if typeInfo == 'camera':
         maya_nodes = [x.get_shape_node() for x in nodes]
     else:
         # For bundles and markers
         maya_nodes = [x.get_node() for x in nodes]
     lib_maya_utils.set_scene_selection(maya_nodes)
     return
コード例 #2
0
 def attrNodeCurrentChanged(self, index, prevIndex):
     ui_node = lib_uiquery.get_ui_node_from_index(
         index, self.attribute_filterModel)
     if ui_node is None:
         return
     nodes = lib_uiquery.convert_ui_nodes_to_nodes([ui_node], 'data')
     maya_nodes = [x.get_node() for x in nodes]
     lib_maya_utils.set_scene_selection(maya_nodes)
     return
コード例 #3
0
    def __lookupAttrNodes(indexes, model):
        maya_nodes = []
        for idx in indexes:
            ui_node = lib_uiquery.get_ui_node_from_index(idx, model)
            if ui_node is None:
                continue

            nodes = lib_uiquery.convert_ui_nodes_to_nodes([ui_node], 'data')
            maya_nodes += [x.get_node() for x in nodes]
        return maya_nodes
コード例 #4
0
    def __lookupObjectNodes(indexes, model):
        maya_nodes = []
        for idx in indexes:
            ui_node = lib_uiquery.get_ui_node_from_index(idx, model)
            if ui_node is None:
                continue

            # Type info will be 'marker', 'bundle' or 'camera' based on
            # the selected node type.
            typeInfo = ui_node.typeInfo
            nodes = lib_uiquery.convert_ui_nodes_to_nodes([ui_node], typeInfo)
            if typeInfo == 'camera':
                maya_nodes += [x.get_shape_node() for x in nodes]
            else:
                # For bundles and markers
                maya_nodes += [x.get_node() for x in nodes]
        return maya_nodes
コード例 #5
0
def _lookupUINodesFromIndexes(indexes, model):
    """
    Find the UI nodes, from the list of Qt indexes.
    """
    maya_nodes = []
    for idx in indexes:
        ui_node = lib_uiquery.get_ui_node_from_index(idx, model)
        if ui_node is None:
            continue

        # Type info will be 'marker', 'bundle' or 'camera' based on
        # the selected node type.
        typeInfo = ui_node.typeInfo
        nodes = lib_uiquery.convert_ui_nodes_to_nodes([ui_node], typeInfo)
        if typeInfo == 'camera':
            maya_nodes += [x.get_transform_node() for x in nodes]
        else:
            # For bundles and markers
            maya_nodes += [x.get_node() for x in nodes]
    return maya_nodes
コード例 #6
0
def _lookupMayaNodesFromAttrUINodes(indexes, model):
    maya_nodes = []
    for idx in indexes:
        ui_node = lib_uiquery.get_ui_node_from_index(idx, model)
        if ui_node is None:
            continue
        # For both AttrNode and MayaNodes we ensure we only add a new
        # Maya node if the existing node name is not in the
        # accumulated list. We do not remove the order of the nodes
        # only ensure that no duplicates are added.
        if isinstance(ui_node, attr_nodes.AttrNode):
            nodes = lib_uiquery.convert_ui_nodes_to_nodes([ui_node], 'data')
            node_names = [x.get_node() for x in nodes]
            maya_nodes += [x for x in node_names if x not in maya_nodes]
        elif isinstance(ui_node, attr_nodes.MayaNode):
            node_uuid = ui_node.data().get('uuid')
            node_names = lib_maya_utils.get_node_names_from_uuids([node_uuid])
            maya_nodes += [x for x in node_names if x not in maya_nodes]
        else:
            LOG.error("Invalid node type: %r", ui_node)
    return maya_nodes