示例#1
0
 def changeNodeProperty(self, number, property, value):
     print "change node %s %s to %s" % (number, property, value)
     tree = RS.read_xml(xml_file)
     root = tree.getroot()
     allNodes = RS.find_nodes(root)
     currentNode = RS.get_node_by_keyvalue(allNodes,
                                           {"number": "%s" % number})
     RS.change_node_properties(currentNode, {"%s" % property: "%s" % value})
     RS.write_xml(tree, xml_file)
示例#2
0
def getFilePath(n):
    tree = RS.read_xml(xml_file)
    root = tree.getroot()
    allNodes = RS.find_nodes(root)
    currentNode = None
    for node in allNodes:
        if node.get("number") == str(n):
            currentNode = node
    if currentNode != None:
        fileName = currentNode.get("fileName")
        filePath = os.path.split(fileName)[0]
        return filePath
示例#3
0
 def clearAllNodes(self):
     #print "clear all"
     if self.renderingList == [] and self.waitingList == []:
         row = self.renderTable.rowCount()
         for i in range(row):
             self.renderTable.removeRow(0)
             tree = RS.read_xml(xml_file)
             root = tree.getroot()
             RS.del_node(root, 1)
             RS.write_xml(tree, xml_file)
         self.newList = []
         self.killedList = []
         self.finishList = []
         self.nodeList = []
         self.updateRenderInfo()
示例#4
0
def getAllFrames(n):
    tree = RS.read_xml(xml_file)
    root = tree.getroot()
    allNodes = RS.find_nodes(root)
    currentNode = None
    for node in allNodes:
        if node.get("number") == str(n):
            currentNode = node
    if currentNode != None:
        inout = [
            str(i) for i in range(int(currentNode.get("frameIn")),
                                  int(currentNode.get("frameOut")) +
                                  1, int(currentNode.get("frameInterval")))
        ]
        #print inout
        return inout
示例#5
0
 def createFolder(self):
     if not os.path.exists(USER_HOME_Path):
         os.makedirs(USER_HOME_Path)
         os.chmod(USER_HOME_Path, 0777)
     if not os.path.exists(xml_file):
         default_xml_tree = RS.read_xml("%s/default.xml" % GLOBAL_Folder)
         #RS.write_xml(default_xml_tree, xml_file)
         #tree = RS.read_xml(xml_file)
         tree = default_xml_tree
         root = tree.getroot()
         setting = RS.find_setting(root)
         RS.change_setting(
             setting, {
                 "threads": "%s" % (max_threads_number / 2),
                 "executePath": "%s" % nuke_execute_path
             })
         RS.write_xml(tree, xml_file)
示例#6
0
def createCMDFromXml(n):
    tree = RS.read_xml(xml_file)
    root = tree.getroot()
    allNodes = RS.find_nodes(root)
    setting = RS.find_setting(root)
    currentNode = None
    for node in allNodes:
        if node.get("number") == str(n):
            currentNode = node
    if currentNode != None:
        cmdList = createCMDList(setting.get("executePath"),
                                setting.get("threads"),
                                currentNode.get("name"),
                                currentNode.get("nkPath"),
                                currentNode.get("frameIn"),
                                currentNode.get("frameOut"),
                                currentNode.get("frameInterval"),
                                currentNode.get("fileName"),
                                setting.get("multiRenderNum"))
        return cmdList
示例#7
0
 def loadNodesFromXml(self):
     tree = RS.read_xml(xml_file)
     root = tree.getroot()
     allNodes = RS.find_nodes(root)
     #print allNodes
     self.newList = []
     self.nodeList = []
     for node in allNodes:
         renderNode = RenderNode()
         renderNode.changeRenderProperty("number", node.get("number"))
         renderNode.changeRenderProperty("name", node.get("name"))
         renderNode.changeRenderProperty("nkPath", node.get("nkPath"))
         renderNode.changeRenderProperty("fileName", node.get("fileName"))
         renderNode.changeRenderProperty("frameIn", node.get("frameIn"))
         renderNode.changeRenderProperty("frameOut", node.get("frameOut"))
         renderNode.changeRenderProperty("frameInterval",
                                         node.get("frameInterval"))
         self.newList.append(renderNode.number)
         self.nodeList.append(renderNode)
     #print self.nodeList
     self.updateRenderInfo()
示例#8
0
 def apply_setting_change(self):
     tree = RS.read_xml(xml_file)
     root = tree.getroot()
     setting = RS.find_setting(root)
     RS.change_setting(
         setting, {"threads": "%s" % str(self.renderThreadsSlider.value())})
     if self.nukeExecutePathCustomCheckbox.isChecked():
         RS.change_setting(setting, {"customPath": "1"})
     else:
         RS.change_setting(setting, {
             "customPath": "0",
             "executePath": "%s" % nuke_execute_path
         })
     RS.change_setting(
         setting,
         {"executePath": "%s" % self.nukeExecutePathLineEdit.text()})
     RS.change_setting(
         setting,
         {"multiRenderNum": "%s" % str(self.multiRenderSlider.value())})
     RS.write_xml(tree, xml_file)
     self.applyButton.setEnabled(False)
示例#9
0
 def updateSetting(self):
     tree = RS.read_xml(xml_file)
     root = tree.getroot()
     setting = RS.find_setting(root)
     renderThreads = setting.get("threads")
     self.renderThreadsSlider.setValue(int(renderThreads))
     self.renderThreadsNumberLabel.setText(
         str(self.renderThreadsSlider.value()))
     if setting.get("customPath") == "1":
         self.nukeExecutePathCustomCheckbox.setChecked(True)
         self.nukeExecutePathLineEdit.setEnabled(True)
         executePath = setting.get("executePath")
         self.nukeExecutePathLineEdit.setText(executePath)
     else:
         self.nukeExecutePathCustomCheckbox.setChecked(False)
         self.nukeExecutePathLineEdit.setEnabled(False)
         executePath = nuke_execute_path
         self.nukeExecutePathLineEdit.setText(executePath)
     multiRenderNum = setting.get("multiRenderNum")
     self.multiRenderSlider.setValue(int(multiRenderNum))
     self.multiRenderNumberLabel.setText(multiRenderNum)
     self.multiRenderNum = str(self.multiRenderSlider.value())
示例#10
0
 def removeNode(self):
     #print "remove node"
     if self.renderingList == [] and self.waitingList == []:
         currentRow = self.renderTable.currentRow()
         if currentRow >= 0:
             currentStatus = self.renderTable.cellWidget(currentRow,
                                                         4).status
             self.renderTable.removeRow(currentRow)
             tree = RS.read_xml(xml_file)
             root = tree.getroot()
             RS.del_node(root, currentRow + 1)
             RS.write_xml(tree, xml_file)
             for i in range(self.renderTable.rowCount()):
                 if i >= currentRow:
                     self.renderTable.cellWidget(i, 4).n = str(
                         int(self.renderTable.cellWidget(i, 4).n) - 1)
             if currentStatus == "new":
                 for i in self.newList:
                     if int(i) == currentRow + 1:
                         self.newList.remove(i)
             if currentStatus == "killed":
                 for i in self.killedList:
                     if int(i) == currentRow + 1:
                         self.killedList.remove(i)
             if currentStatus == "finish":
                 for i in self.finishList:
                     if int(i) == currentRow + 1:
                         self.finishList.remove(i)
             for i in range(len(self.newList)):
                 if int(self.newList[i]) > currentRow + 1:
                     self.newList[i] = str(int(self.newList[i]) - 1)
             for i in range(len(self.killedList)):
                 if int(self.killedList[i]) > currentRow + 1:
                     self.killedList[i] = str(int(self.killedList[i]) - 1)
             for i in range(len(self.finishList)):
                 if int(self.finishList[i]) > currentRow + 1:
                     self.finishList[i] = str(int(self.finishList[i]) - 1)
             self.updateRenderInfo()
示例#11
0
 def addNodes(self):
     #print "add nodes"
     if inNuke:
         RN.autoSave()
         newNodes = RN.getNodes()
     else:
         newNodes = testWriteNodes
     for node in newNodes:
         self.renderTable.insertRow(self.renderTable.rowCount())
         tree = RS.read_xml(xml_file)
         root = tree.getroot()
         newNode = RS.add_node(
             root, {
                 "name": "%s" % node[1],
                 "nkPath": "%s" % node[0],
                 "frameIn": "%s" % node[3],
                 "frameOut": "%s" % node[4],
                 "fileName": "%s" % node[2]
             })
         RS.write_xml(tree, xml_file)
         newRenderNode = RenderNode()
         newRenderNode.changeRenderProperty("number", newNode.get("number"))
         newRenderNode.changeRenderProperty("name", newNode.get("name"))
         newRenderNode.changeRenderProperty("nkPath", newNode.get("nkPath"))
         newRenderNode.changeRenderProperty("fileName",
                                            newNode.get("fileName"))
         newRenderNode.changeRenderProperty("frameIn",
                                            newNode.get("frameIn"))
         newRenderNode.changeRenderProperty("frameOut",
                                            newNode.get("frameOut"))
         newRenderNode.changeRenderProperty("frameInterval",
                                            newNode.get("frameInterval"))
         self.newList.append(newRenderNode.number)
         self.nodeList.append(newRenderNode)
         self.populateTable(newRenderNode)
     self.updateRenderInfo()