Blender V4.5
usd_asset_utils.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 NVIDIA Corporation. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "usd_asset_utils.hh"
6#include "usd.hh"
7
8#include <pxr/usd/ar/asset.h>
9#include <pxr/usd/ar/packageUtils.h>
10#include <pxr/usd/ar/resolver.h>
11#include <pxr/usd/ar/writableAsset.h>
12#include <pxr/usd/usd/common.h>
13#include <pxr/usd/usd/stage.h>
14
15#include "BKE_appdir.hh"
16#include "BKE_idprop.hh"
17#include "BKE_main.hh"
18#include "BKE_report.hh"
19
20#include "BLI_fileops.hh"
21#include "BLI_path_utils.hh"
22#include "BLI_string.h"
23#include "BLI_string_utils.hh"
24
25#include "WM_api.hh"
26
27#include <string_view>
28
29namespace blender::io::usd {
30
31constexpr char UDIM_PATTERN[] = "<UDIM>";
32constexpr char UDIM_PATTERN2[] = "%3CUDIM%3E";
33
34/* Maximum range of UDIM tiles, per the
35 * UsdPreviewSurface specifications. See
36 * https://graphics.pixar.com/usd/release/spec_usdpreviewsurface.html#texture-reader
37 */
38constexpr int UDIM_START_TILE = 1001;
39constexpr int UDIM_END_TILE = 1100;
40
47static std::pair<std::string, std::string> split_udim_pattern(const std::string &path)
48{
49 std::string_view patterns[]{UDIM_PATTERN, UDIM_PATTERN2};
50 for (const std::string_view pattern : patterns) {
51 const std::string::size_type pos = path.find(pattern);
52 if (pos != std::string::npos) {
53 return {path.substr(0, pos), path.substr(pos + pattern.size())};
54 }
55 }
56
57 return {};
58}
59
60/* Return the asset file base name, with special handling of
61 * package relative paths. */
62static std::string get_asset_base_name(const char *src_path, ReportList *reports)
63{
64 char base_name[FILE_MAXFILE];
65
66 if (pxr::ArIsPackageRelativePath(src_path)) {
67 std::pair<std::string, std::string> split = pxr::ArSplitPackageRelativePathInner(src_path);
68 if (split.second.empty()) {
71 "%s: Couldn't determine package-relative file name from path %s",
72 __func__,
73 src_path);
74 return src_path;
75 }
76 BLI_path_split_file_part(split.second.c_str(), base_name, sizeof(base_name));
77 }
78 else {
79 BLI_path_split_file_part(src_path, base_name, sizeof(base_name));
80 }
81
82 return base_name;
83}
84
85/* Copy an asset to a destination directory. */
86static std::string copy_asset_to_directory(const char *src_path,
87 const char *dest_dir_path,
88 eUSDTexNameCollisionMode name_collision_mode,
90{
91 std::string base_name = get_asset_base_name(src_path, reports);
92
93 char dest_file_path[FILE_MAX];
94 BLI_path_join(dest_file_path, sizeof(dest_file_path), dest_dir_path, base_name.c_str());
95 BLI_path_normalize(dest_file_path);
96
97 if (name_collision_mode == USD_TEX_NAME_COLLISION_USE_EXISTING && BLI_is_file(dest_file_path)) {
98 return dest_file_path;
99 }
100
101 if (!copy_asset(src_path, dest_file_path, name_collision_mode, reports)) {
104 "%s: Couldn't copy file %s to %s",
105 __func__,
106 src_path,
107 dest_file_path);
108 return src_path;
109 }
110
111 return dest_file_path;
112}
113
114static std::string copy_udim_asset_to_directory(const char *src_path,
115 const char *dest_dir_path,
116 eUSDTexNameCollisionMode name_collision_mode,
118{
119 /* Get prefix and suffix from udim pattern. */
120 std::pair<std::string, std::string> splitPath = split_udim_pattern(src_path);
121 if (splitPath.first.empty() || splitPath.second.empty()) {
122 BKE_reportf(reports, RPT_ERROR, "%s: Couldn't split UDIM pattern %s", __func__, src_path);
123 return src_path;
124 }
125
126 /* Copy the individual UDIM tiles. Since there is currently no way to query the contents
127 * of a directory using the USD resolver, we must take a brute force approach. We iterate
128 * over the allowed range of tile indices and copy any tiles that exist. The USDPreviewSurface
129 * specification stipulates "a maximum of ten tiles in the U direction" and that
130 * "the tiles must be within the range [1001, 1100] (as of specification version 2.5)". See
131 * https://graphics.pixar.com/usd/release/spec_usdpreviewsurface.html#texture-reader
132 */
133 for (int i = UDIM_START_TILE; i <= UDIM_END_TILE; ++i) {
134 const std::string src_udim = splitPath.first + std::to_string(i) + splitPath.second;
135 if (asset_exists(src_udim.c_str())) {
136 copy_asset_to_directory(src_udim.c_str(), dest_dir_path, name_collision_mode, reports);
137 }
138 }
139
140 const std::string src_file_name = get_asset_base_name(src_path, reports);
141 char ret_udim_path[FILE_MAX];
142 BLI_path_join(ret_udim_path, sizeof(ret_udim_path), dest_dir_path, src_file_name.c_str());
143
144 /* Blender only recognizes the <UDIM> pattern, not the
145 * alternative UDIM_PATTERN2, so we make sure the returned
146 * path has the former. */
147 splitPath = split_udim_pattern(ret_udim_path);
148 if (splitPath.first.empty() || splitPath.second.empty()) {
149 BKE_reportf(reports, RPT_ERROR, "%s: Couldn't split UDIM pattern %s", __func__, ret_udim_path);
150 return ret_udim_path;
151 }
152
153 return splitPath.first + UDIM_PATTERN + splitPath.second;
154}
155
156bool copy_asset(const char *src,
157 const char *dst,
158 eUSDTexNameCollisionMode name_collision_mode,
160{
161 if (!(src && dst)) {
162 return false;
163 }
164
165 const pxr::ArResolver &ar = pxr::ArGetResolver();
166
167 if (name_collision_mode != USD_TEX_NAME_COLLISION_OVERWRITE) {
168 if (!ar.Resolve(dst).IsEmpty()) {
169 /* The asset exists, so this is a no-op. */
170 BKE_reportf(reports, RPT_INFO, "%s: Will not overwrite existing asset %s", __func__, dst);
171 return true;
172 }
173 }
174
175 pxr::ArResolvedPath src_path = ar.Resolve(src);
176
177 if (src_path.IsEmpty()) {
178 BKE_reportf(reports, RPT_ERROR, "%s: Can't resolve path %s", __func__, src);
179 return false;
180 }
181
182 pxr::ArResolvedPath dst_path = ar.ResolveForNewAsset(dst);
183
184 if (dst_path.IsEmpty()) {
185 BKE_reportf(reports, RPT_ERROR, "%s: Can't resolve path %s for writing", __func__, dst);
186 return false;
187 }
188
189 if (src_path == dst_path) {
191 RPT_ERROR,
192 "%s: Can't copy %s. The source and destination paths are the same",
193 __func__,
194 src_path.GetPathString().c_str());
195 return false;
196 }
197
198 std::string why_not;
199 if (!ar.CanWriteAssetToPath(dst_path, &why_not)) {
201 RPT_ERROR,
202 "%s: Can't write to asset %s: %s",
203 __func__,
204 dst_path.GetPathString().c_str(),
205 why_not.c_str());
206 return false;
207 }
208
209 std::shared_ptr<pxr::ArAsset> src_asset = ar.OpenAsset(src_path);
210 if (!src_asset) {
212 RPT_ERROR,
213 "%s: Can't open source asset %s",
214 __func__,
215 src_path.GetPathString().c_str());
216 return false;
217 }
218
219 const size_t size = src_asset->GetSize();
220
221 if (size == 0) {
224 "%s: Will not copy zero size source asset %s",
225 __func__,
226 src_path.GetPathString().c_str());
227 return false;
228 }
229
230 std::shared_ptr<const char> buf = src_asset->GetBuffer();
231
232 if (!buf) {
234 RPT_ERROR,
235 "%s: Null buffer for source asset %s",
236 __func__,
237 src_path.GetPathString().c_str());
238 return false;
239 }
240
241 std::shared_ptr<pxr::ArWritableAsset> dst_asset = ar.OpenAssetForWrite(
242 dst_path, pxr::ArResolver::WriteMode::Replace);
243 if (!dst_asset) {
245 RPT_ERROR,
246 "%s: Can't open destination asset %s for writing",
247 __func__,
248 src_path.GetPathString().c_str());
249 return false;
250 }
251
252 size_t bytes_written = dst_asset->Write(src_asset->GetBuffer().get(), src_asset->GetSize(), 0);
253
254 if (bytes_written == 0) {
256 RPT_ERROR,
257 "%s: Error writing to destination asset %s",
258 __func__,
259 dst_path.GetPathString().c_str());
260 }
261
262 if (!dst_asset->Close()) {
264 RPT_ERROR,
265 "%s: Couldn't close destination asset %s",
266 __func__,
267 dst_path.GetPathString().c_str());
268 return false;
269 }
270
271 return bytes_written > 0;
272}
273
274bool asset_exists(const char *path)
275{
276 return path && !pxr::ArGetResolver().Resolve(path).IsEmpty();
277}
278
279std::string import_asset(const char *src,
280 const char *import_dir,
281 eUSDTexNameCollisionMode name_collision_mode,
283{
284 if (import_dir[0] == '\0') {
286 RPT_ERROR,
287 "%s: Texture import directory path empty, couldn't import %s",
288 __func__,
289 src);
290 return src;
291 }
292
293 char dest_dir_path[FILE_MAXDIR];
294 STRNCPY(dest_dir_path, import_dir);
295
296 if (BLI_path_is_rel(import_dir)) {
297 const char *basepath = BKE_main_blendfile_path_from_global();
298 if (basepath[0] == '\0') {
300 RPT_ERROR,
301 "%s: import directory is relative "
302 "but the blend file path is empty. "
303 "Please save the blend file before importing the USD "
304 "or provide an absolute import directory path. "
305 "Can't import %s",
306 __func__,
307 src);
308 return src;
309 }
310 char path_temp[FILE_MAX];
311 STRNCPY(path_temp, dest_dir_path);
312 BLI_path_abs(path_temp, basepath);
313 STRNCPY(dest_dir_path, path_temp);
314 }
315
316 BLI_path_normalize(dest_dir_path);
317
318 if (!BLI_dir_create_recursive(dest_dir_path)) {
320 RPT_ERROR,
321 "%s: Couldn't create texture import directory %s",
322 __func__,
323 dest_dir_path);
324 return src;
325 }
326
327 if (is_udim_path(src)) {
328 return copy_udim_asset_to_directory(src, dest_dir_path, name_collision_mode, reports);
329 }
330
331 return copy_asset_to_directory(src, dest_dir_path, name_collision_mode, reports);
332}
333
341static bool parent_dir_exists_on_file_system(const std::string &path)
342{
343 char dir_path[FILE_MAX];
344 BLI_path_split_dir_part(path.c_str(), dir_path, FILE_MAX);
345 return BLI_is_dir(dir_path);
346}
347
348bool is_udim_path(const std::string &path)
349{
350 return path.find(UDIM_PATTERN) != std::string::npos ||
351 path.find(UDIM_PATTERN2) != std::string::npos;
352}
353
354std::string get_export_textures_dir(const pxr::UsdStageRefPtr stage)
355{
356 pxr::SdfLayerHandle layer = stage->GetRootLayer();
357
358 if (layer->IsAnonymous()) {
360 RPT_WARNING, "%s: Can't generate a textures directory path for anonymous stage", __func__);
361 return "";
362 }
363
364 const pxr::ArResolvedPath &stage_path = layer->GetResolvedPath();
365
366 if (stage_path.empty()) {
367 WM_global_reportf(RPT_WARNING, "%s: Can't get resolved path for stage", __func__);
368 return "";
369 }
370
371 const pxr::ArResolver &ar = pxr::ArGetResolver();
372
373 /* Resolve the `./textures` relative path, with the stage path as an anchor. */
374 std::string textures_dir = ar.CreateIdentifierForNewAsset("./textures", stage_path);
375
376 /* If parent of the stage path exists as a file system directory, try to create the
377 * textures directory. */
378 if (parent_dir_exists_on_file_system(stage_path.GetPathString())) {
379 BLI_dir_create_recursive(textures_dir.c_str());
380 }
381
382 return textures_dir;
383}
384
385bool should_import_asset(const std::string &path)
386{
387 if (path.empty()) {
388 return false;
389 }
390
391 if (BLI_path_is_rel(path.c_str())) {
392 return false;
393 }
394
395 if (pxr::ArIsPackageRelativePath(path)) {
396 return true;
397 }
398
400 return false;
401 }
402
403 return !BLI_is_file(path.c_str()) && asset_exists(path.c_str());
404}
405
406bool paths_equal(const char *p1, const char *p2)
407{
408 BLI_assert_msg(!BLI_path_is_rel(p1) && !BLI_path_is_rel(p2), "Paths arguments must be absolute");
409
410 const pxr::ArResolver &ar = pxr::ArGetResolver();
411
412 std::string resolved_p1 = ar.ResolveForNewAsset(p1).GetPathString();
413 std::string resolved_p2 = ar.ResolveForNewAsset(p2).GetPathString();
414
415 return resolved_p1 == resolved_p2;
416}
417
418const char *temp_textures_dir()
419{
420 static bool inited = false;
421
422 static char temp_dir[FILE_MAXDIR] = {'\0'};
423
424 if (!inited) {
425 BLI_path_join(temp_dir, sizeof(temp_dir), BKE_tempdir_session(), "usd_textures_tmp", SEP_STR);
426 inited = true;
427 }
428
429 return temp_dir;
430}
431
432bool write_to_path(const void *data, size_t size, const char *path, ReportList *reports)
433{
435 BLI_assert(path);
436 if (size == 0) {
437 return false;
438 }
439
440 const pxr::ArResolver &ar = pxr::ArGetResolver();
441 pxr::ArResolvedPath resolved_path = ar.ResolveForNewAsset(path);
442
443 if (resolved_path.IsEmpty()) {
444 BKE_reportf(reports, RPT_ERROR, "Can't resolve path %s for writing", path);
445 return false;
446 }
447
448 std::string why_not;
449 if (!ar.CanWriteAssetToPath(resolved_path, &why_not)) {
451 RPT_ERROR,
452 "Can't write to asset %s: %s",
453 resolved_path.GetPathString().c_str(),
454 why_not.c_str());
455 return false;
456 }
457
458 std::shared_ptr<pxr::ArWritableAsset> dst_asset = ar.OpenAssetForWrite(
459 resolved_path, pxr::ArResolver::WriteMode::Replace);
460 if (!dst_asset) {
462 RPT_ERROR,
463 "Can't open destination asset %s for writing",
464 resolved_path.GetPathString().c_str());
465 return false;
466 }
467
468 size_t bytes_written = dst_asset->Write(data, size, 0);
469
470 if (bytes_written == 0) {
472 RPT_ERROR,
473 "Error writing to destination asset %s",
474 resolved_path.GetPathString().c_str());
475 }
476
477 if (!dst_asset->Close()) {
479 RPT_ERROR,
480 "Couldn't close destination asset %s",
481 resolved_path.GetPathString().c_str());
482 return false;
483 }
484
485 return bytes_written > 0;
486}
487
488void ensure_usd_source_path_prop(const std::string &path, ID *id)
489{
490 if (!id || path.empty()) {
491 return;
492 }
493
494 if (pxr::ArIsPackageRelativePath(path)) {
495 /* Don't record package-relative paths (e.g., images in USDZ
496 * archives). */
497 return;
498 }
499
500 IDProperty *idgroup = IDP_EnsureProperties(id);
501
502 if (!idgroup) {
503 return;
504 }
505
506 const StringRef prop_name = "usd_source_path";
507
508 if (IDP_GetPropertyFromGroup(idgroup, prop_name)) {
509 return;
510 }
511
512 IDPropertyTemplate val = {0};
513 val.string.str = path.c_str();
514 /* Note length includes null terminator. */
515 val.string.len = path.size() + 1;
517
518 IDProperty *prop = IDP_New(IDP_STRING, &val, prop_name);
519
520 IDP_AddToGroup(idgroup, prop);
521}
522
523std::string get_usd_source_path(ID *id)
524{
525 if (!id) {
526 return "";
527 }
528
529 const IDProperty *idgroup = IDP_EnsureProperties(id);
530 if (!idgroup) {
531 return "";
532 }
533
534 const StringRef prop_name = "usd_source_path";
535 const IDProperty *prop = IDP_GetPropertyFromGroup(idgroup, prop_name);
536 if (!prop) {
537 return "";
538 }
539
540 return static_cast<const char *>(prop->data.pointer);
541}
542
543std::string get_relative_path(const std::string &path, const std::string &anchor)
544{
545 if (path.empty() || anchor.empty()) {
546 return path;
547 }
548
549 if (path == anchor) {
550 return path;
551 }
552
553 if (BLI_path_is_rel(path.c_str())) {
554 return path;
555 }
556
557 if (pxr::ArIsPackageRelativePath(path)) {
558 return path;
559 }
560
561 if (BLI_is_file(path.c_str()) && BLI_is_file(anchor.c_str())) {
562 /* Treat the paths as standard files. */
563 char rel_path[FILE_MAX];
564 STRNCPY(rel_path, path.c_str());
565 BLI_path_rel(rel_path, anchor.c_str());
566 if (!BLI_path_is_rel(rel_path)) {
567 return path;
568 }
569 BLI_string_replace_char(rel_path, '\\', '/');
570 return rel_path + 2;
571 }
572
573 /* If we got here, the paths may be URIs or files on the file system. */
574
575 /* We don't have a library to compute relative paths for URIs
576 * so we use the standard file-system calls to do so. This
577 * may not work for all URIs in theory, but is probably sufficient
578 * for the subset of URIs we are likely to encounter in practice
579 * currently.
580 * TODO(makowalski): provide better utilities for this. */
581
582 const pxr::ArResolver &ar = pxr::ArGetResolver();
583
584 std::string resolved_path = ar.Resolve(path);
585 std::string resolved_anchor = ar.Resolve(anchor);
586
587 if (resolved_path.empty() || resolved_anchor.empty()) {
588 return path;
589 }
590
591 std::string prefix = pxr::TfStringGetCommonPrefix(path, anchor);
592 if (prefix.empty()) {
593 return path;
594 }
595
596 std::replace(prefix.begin(), prefix.end(), '\\', '/');
597
598 size_t last_slash_pos = prefix.find_last_of('/');
599 if (last_slash_pos == std::string::npos) {
600 /* Unexpected: The prefix doesn't contain a slash,
601 * so this was not an absolute path. */
602 return path;
603 }
604
605 /* Replace the common prefix up to the last slash with
606 * a fake root directory to allow computing the relative path
607 * excluding the URI. We omit the URI because it might not
608 * be handled correctly by the standard file-system path computations. */
609 resolved_path = "/root" + resolved_path.substr(last_slash_pos);
610 resolved_anchor = "/root" + resolved_anchor.substr(last_slash_pos);
611
612 char anchor_parent_dir[FILE_MAX];
613 BLI_path_split_dir_part(resolved_anchor.c_str(), anchor_parent_dir, FILE_MAX);
614
615 if (anchor_parent_dir[0] == '\0') {
616 return path;
617 }
618
619 char result_path[FILE_MAX];
620 STRNCPY(result_path, resolved_path.c_str());
621 BLI_path_rel(result_path, anchor_parent_dir);
622
623 if (BLI_path_is_rel(result_path)) {
624 /* Strip the Blender relative path marker, and set paths to Unix-style. */
625 BLI_string_replace_char(result_path, '\\', '/');
626 return std::string(result_path + 2);
627 }
628
629 return path;
630}
631
632void USD_path_abs(char *path, const char *basepath, bool for_import)
633{
634 if (!BLI_path_is_rel(path)) {
635 pxr::ArResolvedPath resolved_path = for_import ? pxr::ArGetResolver().Resolve(path) :
636 pxr::ArGetResolver().ResolveForNewAsset(path);
637
638 const std::string &path_str = resolved_path.GetPathString();
639
640 if (!path_str.empty()) {
641 if (path_str.length() < FILE_MAX) {
642 BLI_strncpy(path, path_str.c_str(), FILE_MAX);
643 return;
644 }
646 "In %s: resolved path %s exceeds path buffer length.",
647 __func__,
648 path_str.c_str());
649 }
650 }
651
652 /* If we got here, the path couldn't be resolved by the ArResolver, so we
653 * fall back on the standard Blender absolute path resolution. */
654 BLI_path_abs(path, basepath);
655}
656
657} // namespace blender::io::usd
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, blender::StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:766
IDProperty * IDP_New(char type, const IDPropertyTemplate *val, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:1001
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:725
IDProperty * IDP_EnsureProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition idprop.cc:892
const char * BKE_main_blendfile_path_from_global()
Definition main.cc:882
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
bool BLI_dir_create_recursive(const char *dirname) ATTR_NONNULL()
Definition fileops_c.cc:391
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition storage.cc:461
bool BLI_is_dir(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition storage.cc:456
File and directory operations.
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
#define FILE_MAXFILE
#define FILE_MAX
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
#define BLI_path_join(...)
void void void BLI_path_split_file_part(const char *filepath, char *file, size_t file_maxncpy) ATTR_NONNULL(1
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
#define FILE_MAXDIR
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BLI_string_replace_char(char *str, char src, char dst) ATTR_NONNULL(1)
@ IDP_STRING_SUB_UTF8
@ IDP_STRING
static void split(const char *text, const char *seps, char ***str, int *count)
ReportList * reports
Definition WM_types.hh:1025
BMesh const char void * data
static const SubDPattern * patterns[]
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
uint pos
static std::string copy_asset_to_directory(const char *src_path, const char *dest_dir_path, eUSDTexNameCollisionMode name_collision_mode, ReportList *reports)
bool asset_exists(const char *path)
const char * temp_textures_dir()
bool should_import_asset(const std::string &path)
std::string import_asset(const char *src, const char *import_dir, eUSDTexNameCollisionMode name_collision_mode, ReportList *reports)
static std::string copy_udim_asset_to_directory(const char *src_path, const char *dest_dir_path, eUSDTexNameCollisionMode name_collision_mode, ReportList *reports)
bool write_to_path(const void *data, size_t size, const char *path, ReportList *reports)
bool is_udim_path(const std::string &path)
bool paths_equal(const char *p1, const char *p2)
static std::string get_asset_base_name(const char *src_path, ReportList *reports)
std::string get_relative_path(const std::string &path, const std::string &anchor)
constexpr int UDIM_START_TILE
eUSDTexNameCollisionMode
Definition usd.hh:74
@ USD_TEX_NAME_COLLISION_USE_EXISTING
Definition usd.hh:75
@ USD_TEX_NAME_COLLISION_OVERWRITE
Definition usd.hh:76
constexpr char UDIM_PATTERN[]
void USD_path_abs(char *path, const char *basepath, bool for_import)
std::string get_export_textures_dir(const pxr::UsdStageRefPtr stage)
static std::pair< std::string, std::string > split_udim_pattern(const std::string &path)
constexpr int UDIM_END_TILE
std::string get_usd_source_path(ID *id)
void ensure_usd_source_path_prop(const std::string &path, ID *id)
constexpr char UDIM_PATTERN2[]
bool copy_asset(const char *src, const char *dst, eUSDTexNameCollisionMode name_collision_mode, ReportList *reports)
static bool parent_dir_exists_on_file_system(const std::string &path)
void * pointer
Definition DNA_ID.h:137
IDPropertyData data
Definition DNA_ID.h:159
Definition DNA_ID.h:404
void * BKE_tempdir_session
Definition stubs.c:38
i
Definition text_draw.cc:230
struct IDPropertyTemplate::@347174163205254236177334334344125337263066142041 string
const char * str
Definition BKE_idprop.hh:37
#define SEP_STR
Definition unit.cc:39
void WM_global_reportf(eReportType type, const char *format,...)