Example #1
0
    def RB_RENDER(self):  #5

        self.format_log('渲染', 'start')
        if int(self.G_CG_TILE_COUNT) != int(self.G_CG_TILE):
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.start.....]')
            # if self.PRE_DICT == None:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # elif self.PRE_DICT['RENDER_CMD']:
            # render_cmd = self.PRE_DICT['RENDER_CMD']
            # print ("The custom render cmd: ")
            # print (render_cmd)

            # else:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # 是否一机多帧
            if self.g_one_machine_multiframe is True:
                if int(self.G_RECOMMIT_FLAG) > 0:
                    cmd = r'c:\fcopy\FastCopy.exe /cmd=force_copy /speed=full /force_close /no_confirm_stop /force_start "{}" /to="{}"'.format(
                        os.path.join(self.G_REMOTE_TASK_CFG,
                                     self.render_record_json),
                        self.G_WORK_RENDER_TASK_MULTIFRAME,
                    )
                    CLASS_COMMON_UTIL.cmd(cmd, my_log=self.G_DEBUG_LOG)
                # 监控线程
                frames = self.remain_frames()
                render_list = CLASS_COMMON_UTIL.need_render_from_frame(frames)
                t = threading.Thread(target=self.loop_handle_complete,
                                     args=(render_list, ))
                t.start()
                self.monitor_complete_thread = t

            # ------------get render cmd----------
            render_cmd = self.MAYA_FINAL_RENDER_CMD
            sys.stdout.flush()
            self.G_DEBUG_LOG.info(render_cmd)
            start_time = int(time.time())
            if self.g_one_machine_multiframe is True:
                self.render_record.update(
                    {frames[0]: {
                         'start_time': start_time,
                         'end_time': 0
                     }})
                pass
            self.G_FEE_PARSER.set('render', 'start_time', str(start_time))

            self.G_DEBUG_LOG.info(
                "\n\n-------------------------------------------Start maya program-------------------------------------\n\n"
            )
            result_code, _ = CLASS_COMMON_UTIL.cmd(
                render_cmd,
                my_log=self.G_DEBUG_LOG,
                continue_on_error=True,
                my_shell=True,
                callback_func=self.maya_cmd_callback)

            self.cg_return_code = result_code
            end_time = int(time.time())
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))

            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.end.....]')

        else:
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.start.....]')
            self.G_FEE_PARSER.set('render', 'start_time',
                                  str(int(time.time())))
            options = {}
            options["func_path"] = self.G_NODE_MAYAFUNCTION
            options["tiles"] = int(self.G_CG_TILE_COUNT)
            options["tile_index"] = int(self.G_CG_TILE)
            options["width"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['width'])
            options["height"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['height'])
            options["output"] = self.G_WORK_RENDER_TASK_OUTPUT
            options["g_tiles_path"] = self.G_TILES_PATH
            options["g_task_id"] = self.G_TASK_ID
            options["g_cg_start_frame"] = self.G_CG_START_FRAME
            print(options)
            nuke_merge = NukeMerge(options)
            nuke_merge.render(self.G_DEBUG_LOG)
            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(int(time.time())))
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.end.....]')

        self.format_log('done', 'end')
Example #2
0
    def RB_RENDER(self):  #5

        self.format_log('渲染', 'start')
        if int(self.G_CG_TILE_COUNT) != int(self.G_CG_TILE):
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.start.....]')
            # if self.PRE_DICT == None:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # elif self.PRE_DICT['RENDER_CMD']:
            # render_cmd = self.PRE_DICT['RENDER_CMD']
            # print ("The custom render cmd: ")
            # print (render_cmd)

            # else:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # ------------get render cmd----------
            render_cmd = self.MAYA_FINAL_RENDER_CMD
            sys.stdout.flush()
            self.G_DEBUG_LOG.info(render_cmd)

            start_time = int(time.time())
            if self.g_one_machine_multiframe is True:
                render_list = CLASS_COMMON_UTIL.need_render_from_frame(
                    self.G_CG_FRAMES)
                self.render_record.update({
                    render_list[0]: {
                        'start_time': start_time,
                        'end_time': 0
                    }
                })
                pass
            self.G_FEE_PARSER.set('render', 'start_time', str(start_time))

            self.G_DEBUG_LOG.info(
                "\n\n-------------------------------------------Start maya program-------------------------------------\n\n"
            )
            result_code, _ = CLASS_COMMON_UTIL.cmd(
                render_cmd,
                my_log=self.G_RENDER_LOG,
                continue_on_error=True,
                my_shell=True,
                callback_func=self.maya_cmd_callback)

            self.cg_return_code = result_code
            end_time = int(time.time())
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))

            # if self.g_one_machine_multiframe is True:
            #     CLASS_MAYA_UTIL.clean_dir(self.G_WORK_RENDER_TASK_OUTPUT, my_log=self.G_DEBUG_LOG)

            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.end.....]')

        else:
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.start.....]')
            self.G_FEE_PARSER.set('render', 'start_time',
                                  str(int(time.time())))
            options = {}
            options["func_path"] = self.G_NODE_MAYAFUNCTION
            options["tiles"] = int(self.G_CG_TILE_COUNT)
            options["tile_index"] = int(self.G_CG_TILE)
            options["width"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['width'])
            options["height"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['height'])
            options["output"] = self.G_WORK_RENDER_TASK_OUTPUT
            options["g_tiles_path"] = self.G_TILES_PATH
            options["g_task_id"] = self.G_TASK_ID
            options["g_cg_start_frame"] = self.G_CG_START_FRAME
            print(options)
            nuke_merge = NukeMerge(options)
            nuke_merge.render(self.G_DEBUG_LOG)
            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(int(time.time())))
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.end.....]')

        self.format_log('done', 'end')
Example #3
0
    def RB_RENDER(self):  # 5

        self.format_log('渲染', 'start')
        if int(self.G_CG_TILE_COUNT) != int(self.G_CG_TILE):
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.start.....]')

            # ------------get render cmd----------

            # #------------get render cmd----------
            self.MAYA_FINAL_RENDER_CMD = self.get_render_cmd()

            render_cmd = self.MAYA_FINAL_RENDER_CMD
            sys.stdout.flush()
            self.G_DEBUG_LOG.info('render cmd info:')
            self.G_DEBUG_LOG.info(render_cmd)

            self.start_monitor()  # 开启监控线程

            start_time = int(time.time())
            if self.g_one_machine_multiframe is True:
                render_list = CLASS_COMMON_UTIL.need_render_from_frame(
                    self.G_CG_FRAMES)
                self.render_record.update({
                    render_list[0]: {
                        'start_time': start_time,
                        'end_time': 0
                    }
                })
                pass
            self.G_FEE_PARSER.set('render', 'start_time', str(start_time))

            self.G_DEBUG_LOG.info(
                "\n\n-------------------------------------------Start maya program-------------------------------------\n\n"
            )
            result_code, _ = CLASS_MAYA_UTIL.maya_cmd(
                render_cmd,
                my_log=self.G_RENDER_LOG,
                continue_on_error=False,
                my_shell=True,
                callback_func=self.maya_cmd_callback)

            self.cg_return_code = result_code
            end_time = int(time.time())
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))

            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.end.....]')

        else:
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.start.....]')
            self.G_FEE_PARSER.set('render', 'start_time',
                                  str(int(time.time())))
            options = {}
            options["func_path"] = self.G_NODE_MAYAFUNCTION
            options["tiles"] = int(self.G_CG_TILE_COUNT)
            options["tile_index"] = int(self.G_CG_TILE)
            options["width"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['width'])
            options["height"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['height'])
            options["output"] = self.G_WORK_RENDER_TASK_OUTPUT
            options["g_tiles_path"] = self.G_TILES_PATH
            options["g_task_id"] = self.G_TASK_ID
            options["g_cg_start_frame"] = self.G_CG_START_FRAME
            self.G_DEBUG_LOG.info(options)
            nuke_merge = NukeMerge(options)
            nuke_merge.render(self.G_DEBUG_LOG)
            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(int(time.time())))
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.end.....]')

        # 日志过滤调用errorbase类
        monitor_ini_dict = {}
        monitor_ini_dict["G_INPUT_CG_FILE"] = self.G_INPUT_CG_FILE
        monitor_ini_dict["CG_NAME"] = self.CG_NAME
        monitor_ini_dict["CG_VERSION"] = self.CG_VERSION
        monitor_ini_dict["CG_PLUGINS_DICT"] = self.CG_PLUGINS_DICT
        monitor_ini_dict["G_INPUT_USER_PATH"] = self.G_INPUT_USER_PATH
        monitor_ini_dict["G_OUTPUT_USER_PATH"] = self.G_OUTPUT_USER_PATH
        monitor_ini_dict["G_NODE_NAME"] = self.G_NODE_NAME
        monitor_ini_dict["G_NODE_ID"] = self.G_NODE_ID
        monitor_ini_dict[
            "G_WORK_RENDER_TASK_OUTPUT"] = self.G_WORK_RENDER_TASK_OUTPUT
        monitor_ini_dict["G_DEBUG_LOG"] = self.G_DEBUG_LOG

        monitor_log = ErrorBase(monitor_ini_dict)
        monitor_log.run()

        self.stop_monitor()  # stop monitor  结束监控线程
        self.format_log('done', 'end')