def applyChannelConfig(self): with pm.UndoChunk(): configDict = self._buildConfigDict() #TODO add checker to avoid error if the datas is not found in the scene for rule in configDict["map"]: # proxy if rule[3]: source = pm.PyNode("{}.{}".format(rule[1], rule[0])) target = pm.PyNode(rule[2]) att.addProxyAttribute(source, target, configDict["proxyPolicy"]) #move else: source = pm.PyNode(rule[1]) target = pm.PyNode(rule[2]) att.moveChannel(rule[0], source, target, configDict["movePolicy"])
def _applyChannelConfig(configDic): tableMap = configDic["map"] movePolicy = configDic["movePolicy"] proxyPolicy = configDic["proxyPolicy"] for rule in tableMap: attr = rule[0] sourceNode = rule[1] targetNode = rule[2] option = rule[3] # proxy if option: node = pm.PyNode(sourceNode) sourceAttrs = node.attr(attr) target = pm.PyNode(targetNode) att.addProxyAttribute(sourceAttrs, target, proxyPolicy) # move else: att.moveChannel(attr, sourceNode, targetNode, movePolicy)
def test_moveChannel_fullName(): """move_channel_fullName""" for source in ("source1", "source2"): assert_is_none( att.moveChannel("chanName", source, "source1", "fullName"))
def test_moveChannel_index(): """move_channel_index""" for source in ("source1", "source2"): assert_is_none(att.moveChannel("chanName", source, "source1", "index"))
def test_move_channel(): """chanName.moveChannel works""" for source in ("source1", "source2"): assert_false(att.moveChannel("chanName", source, "target"))
def test_moveChannel_merge(self): """move_channel_merge """ for s in [self.pcs[0], self.pcs2[0]]: self.assertIsNone(att.moveChannel(self.chanName, s, self.pct[0], "merge"))
def test_moveChannel_index(self): """move_channel_index """ for s in [self.pcs[0], self.pcs2[0]]: self.assertIsNone(att.moveChannel(self.chanName, s, self.pct[0], "index"))
def test_moveChannel(self): """move_channel """ for s in [self.pcs[0], self.pcs2[0]]: self.assertFalse(att.moveChannel(self.chanName, s, self.pct[0]))