Blender V5.3
texture_cache.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2026 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "DNA_image_types.h"
6
7#include "blender/CCL_api.h"
8
9#include "util/image_maketx.h"
10#include "util/image_metadata.h"
11#include "util/types_image.h"
12
13namespace blender {
14
16 const char *filepath,
17 const char *texture_cache_directory,
18 std::string &r_tx_filepath)
19{
20 ccl::ImageMetaData tx_metadata;
21 return ccl::resolve_tx(filepath,
22 texture_cache_directory,
23 ccl::ustring(image->colorspace_settings.name),
24 ccl::ImageAlphaType(image->alpha_mode),
25 ccl::IMAGE_FORMAT_PLAIN,
26 r_tx_filepath,
27 tx_metadata);
28}
29
31 const char *filepath,
32 const char *texture_cache_directory)
33{
34 std::string tx_filepath;
35 ccl::ImageMetaData tx_metadata;
36 const bool is_valid = ccl::resolve_tx(filepath,
37 texture_cache_directory,
38 ccl::ustring(image->colorspace_settings.name),
39 ccl::ImageAlphaType(image->alpha_mode),
40 ccl::IMAGE_FORMAT_PLAIN,
41 tx_filepath,
42 tx_metadata);
43
44 if (is_valid) {
45 return true;
46 }
47
48 if (tx_filepath.empty()) {
49 return false;
50 }
51
52 return make_tx(filepath,
53 tx_filepath,
54 ccl::ustring(image->colorspace_settings.name),
55 ccl::ImageAlphaType(image->alpha_mode),
56 ccl::IMAGE_FORMAT_PLAIN);
57}
58
59} // namespace blender
bool make_tx(const string &filepath, const string &out_filepath, ustring colorspace, const ImageAlphaType alpha_type, const ImageFormatType format_type)
BMesh Iterators.
bool CCL_resolve_texture_cache(const Image *image, const char *filepath, const char *texture_cache_directory, std::string &r_tx_filepath)
bool CCL_generate_texture_cache(const Image *image, const char *filepath, const char *texture_cache_directory="")