Ejemplo n.º 1
0
    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.vcloth_pre_process:
                rc_params.append("/wait=0 /forceVCloth")

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

            if rc_process is not None:
                rc_process.wait()

                if not self.__config.is_animation_process:
                    self.__recompile(dae_path)
                else:
                    self.__rename_anm_files(dae_path)

        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)
Ejemplo n.º 2
0
    def __call__(self):
        for image in self.__images_to_convert:
            rc_params = self.__get_rc_params(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)
            bcPrint(tiff_image_for_rc)

            try:
                self.__create_normal_texture()
            except:
                bcPrint("Failed to invert green channel")

            rc_process = run_rc(self.__config.texture_rc_path,
                                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:
                bcPrint("Failed to invert green channel")

            rc_process.wait()

        if self.__config.texture_rc_path:
            self.__save_tiffs()

        self.__remove_tmp_files()
Ejemplo n.º 3
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
Ejemplo n.º 4
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)