Пример #1
0
 def mimeData(self, indexes):
     result = QtCore.QMimeData()
     itemDataList = [
         index.internalPointer().buildItem.serialize() for index in indexes
     ]
     datastr = meta.encodeMetaData(itemDataList)
     result.setData('text/plain', datastr)
     return result
Пример #2
0
    def mimeData(self, indexes):
        result = QtCore.QMimeData()

        def getSingleItemData(index):
            step = self.stepForIndex(index)
            data = step.serialize()
            if 'children' in data:
                del data['children']
            return data

        stepDataList = [getSingleItemData(index) for index in indexes]
        datastr = meta.encodeMetaData(stepDataList)
        result.setData('text/plain', datastr)
        print(datastr)
        return result
Пример #3
0
    def mimeData(self, indexes):
        result = QtCore.QMimeData()

        # TODO: this block of getting topmost steps is redundantly
        #       used in deleting steps, need to consolidate
        steps = []
        for index in indexes:
            step = self.stepForIndex(index)
            if step:
                steps.append(step)
        steps = BuildStep.getTopmostSteps(steps)

        stepDataList = [step.serialize() for step in steps]
        data_str = meta.encodeMetaData(stepDataList)
        result.setData('text/plain', data_str.encode())
        return result
Пример #4
0
def saveSkinWeightsToFile(filePath, *skins):
    """
    Save skin weights to a .weights file for one or more skin clusters.

    Args:
        filePath (str): A full path to the .weights file to write
        *skins (PyNode): One or more skin cluster nodes
    """
    pm.progressWindow(t='Saving Weights...', min=0, max=100, status=None)

    pm.progressWindow(e=True, progress=0)
    skinWeights = getSkinWeightsMap(*skins)

    pm.progressWindow(e=True, progress=80)
    skinWeightsStr = meta.encodeMetaData(skinWeights)

    pm.progressWindow(e=True, progress=90)
    with open(filePath, 'w') as fp:
        fp.write(skinWeightsStr)

    pm.progressWindow(endProgress=True)
    LOG.info(filePath)
Пример #5
0
def _copyData(data, refNode=None):
    """
    Performs a deep copy of the given data using pymetanode to
    encode and decode the values.
    """
    return meta.decodeMetaData(meta.encodeMetaData(data), refNode)
Пример #6
0
 def _setFormValue(self, attrValue):
     if isinstance(attrValue, basestring):
         self.textEdit.setText(repr(attrValue))
     else:
         self.textEdit.setText(meta.encodeMetaData(attrValue))
Пример #7
0
def serializeAttrValue(value):
    return meta.encodeMetaData(value)