def validateMirrorNode(node): """ Ensure the node still has a valid mirroring counterpart. If it does not, remove the mirror data from the node. Return: True if the node is a valid mirror node """ if not isMirrorNode(node): return False data = meta.getMetaData(node, MIRROR_METACLASS) otherNode = data['otherNode'] if otherNode is None: LOG.debug("{0} paired node not found, " "removing mirroring data".format(node)) meta.removeMetaData(node, MIRROR_METACLASS) return False else: othersOther = getPairedNode(otherNode, False) if othersOther != node: LOG.debug("{0} pairing is unreciprocated, " "removing mirror data".format(node)) meta.removeMetaData(node, MIRROR_METACLASS) return False return True
def removeMirroringData(node): """ Remove mirroring data from a node. This does NOT remove mirroring data from the other node, if there is one. See `unpairMirrorNode` for removing mirroring data from two nodes at once. Args: node: A PyNode, MObject, or node name """ meta.removeMetaData(node, MIRROR_METACLASS)
def test_removeLockedData(self): meta.setMetaData(self.node, 'myMetaClass', 'myTestData') self.node.attr(meta.core.METADATA_ATTR).setLocked(True) result = meta.removeMetaData(self.node) self.assertFalse(result) data = meta.getMetaData(self.node) self.assertEqual(data, {'myMetaClass': 'myTestData'})
def test_removeClassData(self): meta.setMetaData(self.node, 'myMetaClass', None) meta.setMetaData(self.node, 'mySecondMetaClass', None) result = meta.removeMetaData(self.node, 'myMetaClass') self.assertTrue(result) self.assertTrue(meta.isMetaNode(self.node)) self.assertFalse(meta.hasMetaClass(self.node, 'myMetaClass')) self.assertTrue(meta.hasMetaClass(self.node, 'mySecondMetaClass'))
def test_removeData(self): meta.setMetaData(self.node, 'myMetaClass', None) self.assertTrue(meta.isMetaNode(self.node)) result = meta.removeMetaData(self.node) self.assertTrue(result) self.assertFalse(meta.isMetaNode(self.node))
def unlink(node): """ Remove a link from a node """ meta.removeMetaData(node, className=LINK_METACLASS)
def unlink(node): """ Remove a link from a node """ meta.removeMetaData(node, className=LINK_METACLASS) LOG.info("Unlinked %s", node)