def test_translateOnly(self):
        '''Change the PxrUsdIn's file and verify the dumped result.'''

        # test.translateOnly.usda is a UsdGeomPointInstancer with positions
        NodegraphAPI.GetNode('PxrUsdIn').getParameter('fileName').setValue(
            'test.translateOnly.usda', 0)
        CacheManager.flush()

        testfile = 'test.translateOnly.xml'
        AttrDump.AttrDump(testfile)
        self.assertTrue(os.path.exists(testfile))

        self.cleanUpTestFile(testfile)
        self.assertTrue(self.compareAgainstBaseline(testfile))
    def test_translateOnly(self):
        '''Change the PxrUsdIn's file and verify the dumped result.'''

        # test.translateOnly.usda is a UsdGeomPointInstancer with positions
        NodegraphAPI.GetNode('PxrUsdIn').getParameter('fileName').setValue(
            'test.translateOnly.usda', 0)
        CacheManager.flush()

        testfile = 'test.translateOnly.xml'
        AttrDump.AttrDump(testfile)
        self.assertTrue(os.path.exists(testfile))

        self.cleanUpTestFile(testfile)
        self.assertTrue(self.compareAgainstBaseline(testfile))
    def test_motion(self):
        '''Change the PxrUsdIn's file and verify the dumped result.'''

        # test.motion.usda is a UsdGeomPointInstancer with positions,
        # orientations, scales, velocities, and angular velocities
        NodegraphAPI.GetNode('PxrUsdIn').getParameter('fileName').setValue(
            'test.motion.usda', 0)
        CacheManager.flush()

        testfile = 'test.motion.xml'
        AttrDump.AttrDump(testfile)
        self.assertTrue(os.path.exists(testfile))

        self.cleanUpTestFile(testfile)
        self.assertTrue(self.compareAgainstBaseline(testfile))
    def test_motion(self):
        '''Change the PxrUsdIn's file and verify the dumped result.'''

        # test.motion.usda is a UsdGeomPointInstancer with positions,
        # orientations, scales, velocities, and angular velocities
        NodegraphAPI.GetNode('PxrUsdIn').getParameter('fileName').setValue(
            'test.motion.usda', 0)
        CacheManager.flush()

        testfile = 'test.motion.xml'
        AttrDump.AttrDump(testfile)
        self.assertTrue(os.path.exists(testfile))

        self.cleanUpTestFile(testfile)
        self.assertTrue(self.compareAgainstBaseline(testfile))
Ejemplo n.º 5
0
def importRigsSet(node):
    gaffer_three_node = getGafferThreeNode(node)
    root_locations = node.getParameter('rootLocations').getChildren()
    producer = Nodes3DAPI.GetRenderProducer(node, 0, False, 0)
    if not gaffer_three_node:
        message = "GafferThree node have not be connected to GafferThreeRigs!"
        setMessage(message)
        log.warning(message)
        return

    if not root_locations:
        message = "GafferThreeRigs node has no rootLocation!"
        setMessage(message)
        log.warning(message)
        return
    else:
        if root_locations and root_locations[0].getValue(0) is "":
            message = "GafferThreeRigs has no rootLocation"
            log.warning(message)
            return


    if not producer.getProducerByPath(getGafferThreeLocation(node) + "/" + cRigLayers[0]):
        chr_layer_rig_node = createRig(gaffer_three_node, cRigLayers[0])        
        setCharacterRig(gaffer_three_node, node, chr_layer_rig_node)
    else:
        chr_layer_rig_node = getRootRig(gaffer_three_node, cRigLayers[0])
        setCharacterRig(gaffer_three_node, node, chr_layer_rig_node)


    if not producer.getProducerByPath(getGafferThreeLocation(node) + "/" + cRigLayers[1]):
        env_layer_rig_node = createRig(gaffer_three_node, cRigLayers[1])
        setEnvrionmentRig(gaffer_three_node, node, env_layer_rig_node)
    else:
        message = "Light rig env_layer already created!"
        log.warning(message)

    if not producer.getProducerByPath(getGafferThreeLocation(node) + "/" + cRigLayers[2]):
        vol_layer_rig_node = createRig(gaffer_three_node, cRigLayers[2])
    else:
        message = "Light rig vol_layer already created!"
        log.warning(message)

    message = "Light rigs have been created into {%s} node!"%gaffer_three_node.getName()
    setMessage(message)
    CacheManager.flush(True)
Ejemplo n.º 6
0
def recoverScript(katanaFile=None, logsFile=None, jsonFile):
    from Katana import KatanaFile, NodegraphAPI
    if katanaFile is not None:
        KatanaFile.Load(katanaFile)
    katana_file = katanaFile
    logs_file = logsFile
    file_name = NodegraphAPI.GetRootNode().getParameter(
        'katanaSceneName').getValue(0)
    katana_file = os.path.join(getVersoonUpKatanaDir(katana_file), file_name)
    #~ version up
    katana_file = katana_path[:-3] + "{:03}".format(int(katana_path[-3:]) + 1)
    infile = open(jsonFile, 'r')
    json_data = json.load(infile)
    infile.close()

    #~ loops all nodes
    for node_name in json_data:
        node = NodegraphAPI.GetNode(node_name)
        node_data = json_data[node_name]
        mx_shader_name = node_data[0]
        mx_shader_data = node_data[1]
        #~ loops all parameters
        for para_data in mx_shader_data:
            #~ read data from json data
            enable = para_data[0]
            name = para_data[1]
            connected = para_data[2]
            value = para_data[3]

            #~ translate data
            translate_shader = SHADERMAPPING[mx_shader_name][0]
            translate_para_list = SHADERMAPPING[mx_shader_name][1]
            translate_name = translate_para_list[name]

            #~ set new shader type
            node.checkDynamicParameters()
            if translate_shader != mx_shader_name:
                node.getParameter('nodeType').setValue(translate_shader, 0)
                node.checkDynamicParameters()
                if translate_shader != mx_shader_name:
                    from Katana import CacheManager
                    CacheManager.flush(isNodeGraphLoading=False)

            #~ if node connected to other
            if connected:
                if not mx_shader_name in SHADERMAPPING:
                    continue
                connected_node = NodegraphAPI.GetNode(value)
                out_port = connected_node.getOutputPorts()[0]

                in_port = node.getInputPort(translate_name)
                node.getInputPort(translate_name).connect(out_port)
            #~ recover parameter value
            else:
                if not enable:
                    continue
                node.checkDynamicParameters()
                para_enable = node.getParameter('parameters.%s.enable' %
                                                translate_name)
                para_enable.setValue(1, 0)
                para_value = node.getParameter('parameters.%s.value' %
                                               translate_name)
                node.checkDynamicParameters()
                if para_value.getType() == "numberArray":
                    children = para_value.getChildren()
                    for i in range(0, len(value)):
                        children[i].setValue(value[i], 0)
                elif para_value.getType() == "number":
                    para_value.setValue(float(value[0]), 0)
                else:
                    para_value.setValue(str(value[0]), 0)

    KatanaFile.Save(katana_path)
    if logsFile is not None:
        JobRecord(logs_file, katana_file)