예제 #1
0
파일: rc.py 프로젝트: travnick/CryBlend
    def __call__(self):
        filepath = bpy.path.ensure_ext(self.__config.filepath, ".dae")
        utils.generate_xml(filepath, self.__doc, overwrite=True)

        dae_path = utils.get_absolute_path_for_rc(filepath)

        if not self.__config.disable_rc:
            rc_params = ["/verbose", "/threads=processors", "/refresh"]
            if self.__config.do_materials:
                rc_params.append("/createmtl=1")

            rc_process = run_rc(self.__config.rc_path, dae_path, rc_params)

            if rc_process is not None:
                rc_process.wait()
                self.__recompile(dae_path)
                self.__rename_anm_files(dae_path)

            if self.__config.do_materials:
                mtl_fix_thread = threading.Thread(
                    target=self.__fix_normalmap_in_mtls,
                    args=(rc_process, filepath))
                mtl_fix_thread.start()

        if self.__config.make_layer:
            lyr_contents = self.__make_layer()
            lyr_path = os.path.splitext(filepath)[0] + ".lyr"
            utils.generate_file(lyr_path, lyr_contents)

        if not self.__config.save_dae:
            rcdone_path = "{}.rcdone".format(dae_path)
            utils.remove_file(dae_path)
            utils.remove_file(rcdone_path)
예제 #2
0
    def __call__(self, images_to_convert, refresh_rc, save_tiff):

        for image in images_to_convert:
            rc_params = self.__get_rc_params(refresh_rc, image.filepath)
            tiff_image_path = self.__get_temp_tiff_image_path(image)

            tiff_image_for_rc = utils.get_absolute_path_for_rc(tiff_image_path)

            try:
                create_normal_texture()
            except:
                cbPrint("Failed to invert green channel")

            rc_process = utils.run_rc(self.__rc_exe,
                                      tiff_image_for_rc,
                                      rc_params)

            # re-save the original image after running the RC to
            # prevent the original one from getting lost
            try:
                if ("_ddn" in image.name):
                    image.save()
            except:
                cbPrint("Failed to invert green channel")

            rc_process.wait()

        if save_tiff:
            self.__save_tiffs()

        self.__remove_tmp_files()
예제 #3
0
파일: rc.py 프로젝트: ezhangle/CryBlend
    def __call__(self):
        filepath = bpy.path.ensure_ext(self.__config.filepath, ".dae")
        utils.generate_xml(filepath, self.__doc, overwrite=True)

        dae_path = utils.get_absolute_path_for_rc(filepath)

        if not self.__config.disable_rc:
            rc_params = ["/verbose", "/threads=processors", "/refresh"]
            if self.__config.do_materials:
                rc_params.append("/createmtl=1")

            rc_process = run_rc(self.__config.rc_path, dae_path, rc_params)

            if rc_process is not None:
                rc_process.wait()
                self.__recompile(dae_path)
                self.__rename_anm_files(dae_path)

            if self.__config.do_materials:
                mtl_fix_thread = threading.Thread(
                    target=self.__fix_normalmap_in_mtls,
                    args=(rc_process, filepath)
                )
                mtl_fix_thread.start()

        if self.__config.make_layer:
            lyr_contents = self.__make_layer()
            lyr_path = os.path.splitext(filepath)[0] + ".lyr"
            utils.generate_file(lyr_path, lyr_contents)

        if not self.__config.save_dae:
            rcdone_path = "{}.rcdone".format(dae_path)
            utils.remove_file(dae_path)
            utils.remove_file(rcdone_path)
예제 #4
0
    def __get_rc_params(self, destination_path):
        rc_params = ["/verbose", "/threads=cores", "/userdialog=1", "/refresh"]

        image_directory = os.path.dirname(utils.get_absolute_path_for_rc(destination_path))

        rc_params.append("/targetroot={!s}".format(image_directory))

        return rc_params
예제 #5
0
파일: rc.py 프로젝트: travnick/CryBlend
    def __get_rc_params(self, destination_path):
        rc_params = ["/verbose", "/threads=cores", "/userdialog=1", "/refresh"]

        image_directory = os.path.dirname(
            utils.get_absolute_path_for_rc(destination_path))

        rc_params.append("/targetroot={!s}".format(image_directory))

        return rc_params
예제 #6
0
def write_scripts(config):
    filepath = bpy.path.ensure_ext(config.filepath, ".dae")
    if not config.make_chrparams and not config.make_cdf:
        return

    dae_path = utils.get_absolute_path_for_rc(filepath)
    output_path = os.path.dirname(dae_path)

    for chr_name in utils.get_chr_names(self._config.export_selected_nodes):
        if config.make_chrparams:
            filepath = "{}/{}.chrparams".format(output_path, chr_name)
            contents = utils.generate_file_contents("chrparams")
            utils.generate_xml(filepath, contents)
        if config.make_cdf:
            filepath = "{}/{}.cdf".format(output_path, chr_name)
            contents = utils.generate_file_contents("cdf")
            utils.generate_xml(filepath, contents)
예제 #7
0
파일: export.py 프로젝트: ezhangle/CryBlend
def write_scripts(config):
    filepath = bpy.path.ensure_ext(config.filepath, ".dae")
    if not config.make_chrparams and not config.make_cdf:
        return

    dae_path = utils.get_absolute_path_for_rc(filepath)
    output_path = os.path.dirname(dae_path)

    for chr_name in utils.get_chr_names(self._config.export_selected_nodes):
        if config.make_chrparams:
            filepath = "{}/{}.chrparams".format(output_path, chr_name)
            contents = utils.generate_file_contents("chrparams")
            utils.generate_xml(filepath, contents)
        if config.make_cdf:
            filepath = "{}/{}.cdf".format(output_path, chr_name)
            contents = utils.generate_file_contents("cdf")
            utils.generate_xml(filepath, contents)
예제 #8
0
    def __call__(self, images_to_convert, refresh_rc, save_tiff):

        for image in images_to_convert:
            rc_params = self.__get_rc_params(refresh_rc, image.filepath)
            tiff_image_path = self.__get_temp_tiff_image_path(image)

            tiff_image_for_rc = utils.get_absolute_path_for_rc(tiff_image_path)

            rc_process = utils.run_rc(self.__rc_exe,
                                      tiff_image_for_rc,
                                      rc_params)

            rc_process.wait()

        if save_tiff:
            self.__save_tiffs()

        self.__remove_tmp_files()