Exemplo n.º 1
0
 def test_Hafarm1(self):
     self.root.parm("make_proxy").set(True)
     self.root.parm("make_movie").set(True)
     self.root.parm("debug_images").set(True)
     self.grid.parm("vm_tile_render").set(True)
     hou.setPwd(self.root)
     ctx = HaContext.HaContext()
     graph = ctx.get_graph()
     graph.set_render(PrintRender.JsonParmRender)
     json_files = graph.render()
     return True
Exemplo n.º 2
0
    def test_post_render_actions(self):
        hou.setPwd(self.farm)
        ctx = HaContext.HaContext()
        graph = ctx.get_graph()

        self.assertTrue(len(graph.graph_items) == 5)

        # for n in graph.graph_items:
        #     print type(n), n, n.dependencies

        graph.set_render(GraphvizRender.GraphvizRender)
        graph.render()
Exemplo n.º 3
0
    def test_mantra_render_frame_list(self):
        hou.setPwd(self.farm)
        ctx = HaContext.HaContext()
        graph = ctx.get_graph()

        frames = [1,3,5]
        mframes = Houdini.mantra_render_frame_list(self.hbatch_farm, frames)
        self.assertEqual(mframes, self.hbatch_farm.get_direct_outputs())
        self.assertEqual(len(frames), len(mframes))
        self.assertTrue("-l 1,3,5" in self.hbatch_farm.parms['command_arg'])
        for frame in range(len(frames)):
            self.assertEqual(mframes[frame].parms['start_frame'], frames[frame])
            self.assertEqual(mframes[frame].parms['end_frame'], frames[frame])
            self.assertEqual(mframes[frame].get_direct_inputs()[0], self.hbatch_farm)
Exemplo n.º 4
0
 def test_mantra_render_from_ifd_1(self):
     frames = None
     job_name = None
     image = os.path.join(self.tmppath, "image.0001.exr")
     self.farm.parm("render_from_ifd").set(True)
     hou.setPwd(self.farm)
     ctx = HaContext.HaContext()
     graph = ctx.get_graph()
     mantras = filter(lambda x: isinstance(x, Houdini.HoudiniMantraExistingIfdWrapper), graph.graph_items)
     for mantra in mantras:
         self.assertEqual(mantra.parms['start_frame'], self.farm.parm("ifd_range1").eval())
         self.assertEqual(mantra.parms['end_frame'],   self.farm.parm("ifd_range2").eval())
         self.assertEqual(mantra.parms['step_frame'],  self.farm.parm("ifd_range3").eval())
         self.assertTrue(const.TASK_ID  in mantra.parms['scene_file'])
     self.assertEqual(mantra.parms['output_picture'],  image)
     self.farm.parm("render_from_ifd").set(False)
Exemplo n.º 5
0
    def test_Hafarm1(self):
        with tempdir('hafarm_houRS_test_Hafarm1') as tmppath:
            hou.setPwd(self.root)
            ctx = HaContext.HaContext(external_hashes=map(lambda x: str(x).rjust(4,'Y'), xrange(1,90)))
            graph = ctx.get_graph()
            json_files = graph.render(json_output_directory=tmppath, copy_scene_file=True)
            json_files.sort()

            self.assertEqual(len(json_files), 3, 'incorrect count files')

            json_expected_files = [  'testRedshiftRenderPressed.hip_YYY2_teapot_geometry.json'
                                    ,'testRedshiftRenderPressed.hip_YYY4_teapotRS_redshift.json'
                                    ,'testRedshiftRenderPressed.hip_YYY4_teapotRS_rs.json' ]

            json_expected_files.sort()
            self._test_files(json_expected_files, json_files)

        return True
Exemplo n.º 6
0
    def test_mantra_render_frames(self):
        self.farm.parm("use_frame_list").set(True)
        self.farm.parm("frame_list").set('1,3,5')
        image = os.path.join(self.tmppath, "image.0001.exr")

        hou.setPwd(self.farm)
        ctx = HaContext.HaContext()
        graph = ctx.get_graph()

        frames = [1,3,5]
        mantras = filter(lambda x: isinstance(x, Houdini.HoudiniMantraExistingIfdWrapper), graph.graph_items)

        for frame in frames:
            idx = frames.index(frame)
            self.assertEqual(mantras[idx].parms['start_frame'], frame)
            self.assertEqual(mantras[idx].parms['end_frame'], frame)
            self.assertTrue(const.TASK_ID  in mantras[idx].parms['scene_file'])
            self.assertEqual(mantras[idx].parms['output_picture'],  image)
Exemplo n.º 7
0
    def test_Hafarm2_and_Hafarm1(self):
        with tempdir('hafarm_hou_test_Hafarm3') as tmppath:

            self.root.parm("group").set("renders_root")
            self.root.parm("queue").set("cuda_root")
            self.root.parm("priority").set(-100)
            self.root.parm("job_on_hold").set(True)
            self.root.parm("make_proxy").set(True)
            self.root.parm("make_movie").set(True)
            self.root.parm("debug_images").set(True)

            self.hafarm1.parm("group").set("3d_hafarm1")
            self.hafarm1.parm("queue").set("opencl_hafarm1")
            self.hafarm1.parm("priority").set(-333)
            self.hafarm1.parm("job_on_hold").set(True)
            self.hafarm1.parm("make_proxy").set(False)
            self.hafarm1.parm("make_movie").set(False)
            self.hafarm1.parm("debug_images").set(False)

            hou.setPwd(self.root)
            ctx = HaContext.HaContext(external_hashes=map(lambda x: str(x).rjust(4,'W'), xrange(1,90)))
            graph = ctx.get_graph()
            json_files = graph.render(json_output_directory=tmppath, copy_scene_file=True)
            json_files.sort()

            self.assertEqual(len(json_files), 14, 'incorrect count files')

            json_expected_files = [ 'testRenderPressed.hip_WW13_alembic_alembic.json'
                                    ,'testRenderPressed.hip_WW15_grid_ifd.json'
                                    ,'testRenderPressed.hip_WW15_grid_mantra.json'
                                    ,'testRenderPressed.hip_WW18_comp_comp.json'
                                    ,'testRenderPressed.hip_WW18_comp_debug.json'
                                    ,'testRenderPressed.hip_WW18_comp_mp4.json'
                                    ,'testRenderPressed.hip_WW18_comp_reports.json'
                                    ,'testRenderPressed.hip_WWW2_teapot_geometry.json'
                                    ,'testRenderPressed.hip_WWW4_box_geometry.json'
                                    ,'testRenderPressed.hip_WWW6_box_teapot_debug.json'
                                    ,'testRenderPressed.hip_WWW6_box_teapot_ifd.json'
                                    ,'testRenderPressed.hip_WWW6_box_teapot_mantra.json'
                                    ,'testRenderPressed.hip_WWW6_box_teapot_mp4.json'
                                    ,'testRenderPressed.hip_WWW6_box_teapot_reports.json' ]
            
            json_expected_files.sort()
            self._test_files(json_expected_files, json_files)
Exemplo n.º 8
0
    def test_Hafarm2(self):
        with tempdir('hafarm_hou_test_Hafarm2') as tmppath:
            self.root.parm("make_proxy").set(True)
            self.root.parm("make_movie").set(True)
            self.root.parm("debug_images").set(True)

            self.hafarm1.parm("make_proxy").set(True)
            self.hafarm1.parm("make_movie").set(True)
            self.hafarm1.parm("debug_images").set(True)

            hou.setPwd(self.root)
            ctx = HaContext.HaContext(external_hashes=map(lambda x: str(x).rjust(4,'X'), xrange(1,90)))
            graph = ctx.get_graph()
            json_files = graph.render(json_output_directory=tmppath, copy_scene_file=True)
            json_files.sort()

            self.assertEqual(len(json_files), 17, 'incorrect count files')

            json_expected_files = [ 'testRenderPressed.hip_XX13_alembic_alembic.json'
                                    ,'testRenderPressed.hip_XX15_grid_debug.json'
                                    ,'testRenderPressed.hip_XX15_grid_ifd.json'
                                    ,'testRenderPressed.hip_XX15_grid_mantra.json'
                                    ,'testRenderPressed.hip_XX15_grid_mp4.json'
                                    ,'testRenderPressed.hip_XX15_grid_reports.json'
                                    ,'testRenderPressed.hip_XX21_comp_comp.json'
                                    ,'testRenderPressed.hip_XX21_comp_debug.json'
                                    ,'testRenderPressed.hip_XX21_comp_mp4.json'
                                    ,'testRenderPressed.hip_XX21_comp_reports.json'
                                    ,'testRenderPressed.hip_XXX2_teapot_geometry.json'
                                    ,'testRenderPressed.hip_XXX4_box_geometry.json'
                                    ,'testRenderPressed.hip_XXX6_box_teapot_debug.json'
                                    ,'testRenderPressed.hip_XXX6_box_teapot_ifd.json'
                                    ,'testRenderPressed.hip_XXX6_box_teapot_mantra.json'
                                    ,'testRenderPressed.hip_XXX6_box_teapot_mp4.json'
                                    ,'testRenderPressed.hip_XXX6_box_teapot_reports.json' ]
        
            json_expected_files.sort()
            self._test_files(json_expected_files, json_files)
        
        return True
Exemplo n.º 9
0
def removeFiles(path_to_node=""):
	# print "argument: ", path_to_node
	if len(path_to_node)>0:
		node = hou.node(path_to_node)
		nodes = [node]
	else:
		nodes = hou.selectedNodes()
	for node in nodes:
		tname = node.type().name()
		if(tname in ["file", "filecache", "dopnet", "rop_geometry", "alembic", "Redshift_ROP"]):
			if(tname=="dopnet"):
				sf = re.compile("((?<=[._])\$SF(?=[1-9]?[._]))")
				path = node.parm("explicitcachename").unexpandedString()
				path = sf.sub("$F", path)
			elif tname == "rop_geometry":
				path = node.parm("sopoutput").unexpandedString()
			elif tname == 'alembic':
				path = node.parm("fileName").unexpandedString()
			elif tname == "Redshift_ROP":
				path = node.parm("RS_outputFileNamePrefix").unexpandedString()
			else:
				path = node.parm("file").unexpandedString()
			test_path = os.sep.join([hou.expandString(os.path.dirname(path)), os.path.basename(path)])
			if os.path.isfile(test_path):
				os.remove(test_path)
			else:
			# test for expressions
				p = re.compile("`(.*?)`")
			# test if expression is inside of the path
				p2 = re.compile("(?<=.)?`.*?`(?=.?)")
			# list of expressions in the path
				ex_list = p.findall(path)
			# list of parts inbetween expressions
				parts = p2.split(path)
				# print "parts: ", parts
			# insure ex_list have at least one element
				ex_list.append('')
			# some parameter expressions like '$OS' depends on the node it evaluates on. For that reason we set current node
				hou.setPwd(node)
			# list with raw expressons
				eval_list = []
			# list with expanded expressions
				eval_list2 = []
				# print "ex_list: ", ex_list
				for i in ex_list:
					try: eval_list.append(hou.hscriptExpression(i))
					except: eval_list.append(i)
				# print "eval_list: ", eval_list
				path = ''.join(["{0}{1}".format(a_,b_) for a_, b_ in zip(parts, ex_list)])
				# print "path: "+path
				spl = os.path.split(path)
				# print "spl: ", spl
			# override 'path' with expanded expression from 'eval_list'
				path = ''.join(["{0}{1}".format(a_,b_) for a_, b_ in zip(parts, eval_list)])
				spl2 = os.path.split(path)
				# print "spl2: ", spl2
			# test for $F in path
				pattern = re.compile("((?<=[a-z0-9A-Z{}])[._](?=\$F))")
			# test for expanded frame number in path
				pattern2 = re.compile("((?<=[a-z0-9A-Z])[._](?=[0-9])[0-9]{0,6}[.])")
			# test for "padzero" expression in a sequence name
				pattern3 = re.compile("(?<=[a-z0-9A-Z])[._](?=padzero\()")
				padzero = pattern3.findall(spl[1])
			# extract base name of sequence
				# print "spl[1]: ",spl[1]
				if len(padzero)>0:
					name = pattern3.split(spl[1])[0]
				else:
					name = pattern.split(spl[1])[0]
				name = hou.expandString(name)
				# print "base name: "+name
			# expand directory and expanded name of sequence
				spl_0 = hou.expandString(spl[0])
				# print "folder: "+spl_0
				spl_1 = hou.expandString(spl[1])
				# print "file name: "+spl_1
				fileList = []
				for f in os.listdir(spl_0):
					v0 = pattern2.split(f)[0]
					v1 = pattern3.split(spl[1])[0]
					v2 = hou.expandString(pattern.split(spl[1])[0])
					# print "file", f, "\n\t", v0, " == ", name, " : ", v0==name
					# print "\t", v1, " == ", v0, " : ", v1 == v0
					# print "\t", v2, " == ", v0, " : ", v2 == v0
					if os.path.isfile(os.path.join(spl_0, f)) and v0==name and (v1==v0 or v2==v0):
						fileList.append(os.path.join(spl_0, f))
				for file in fileList:
					os.remove(file)