HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
localizeAsset.h
Go to the documentation of this file.
1
//
2
// Copyright 2023 Pixar
3
//
4
// Licensed under the terms set forth in the LICENSE.txt file available at
5
// https://openusd.org/license.
6
//
7
8
#include "
pxr/pxr.h
"
9
#include "
pxr/usd/sdf/layer.h
"
10
#include "
pxr/usd/usdUtils/api.h
"
11
#include "
pxr/usd/usdUtils/userProcessingFunc.h
"
12
13
#include <string>
14
15
#ifndef PXR_USD_USD_UTILS_LOCALIZE_ASSET
16
#define PXR_USD_USD_UTILS_LOCALIZE_ASSET
17
18
/// \file usdUtils/localizeAsset.h
19
20
PXR_NAMESPACE_OPEN_SCOPE
21
22
class
SdfAssetPath
;
23
24
/// Creates a localized version of the asset identified by \p assetPath and all
25
/// of its external dependencies in the directory specified by
26
/// \p localizationDirectory. Any anonymous layers that are encountered
27
/// during dependency discovery will be serialized into the resulting package.
28
/// Due to localization, the packaged layers might be modified to have different
29
/// asset paths.
30
///
31
/// The \p editLayersInPlace parameter controls the strategy used for managing
32
/// changes to layers (including the root layer and all transitive layer
33
/// dependencies) that occur during the package creation process. When
34
/// \p editLayersInPlace is false, a temporary, anonymous copy of each
35
/// modified layer is created and written into the package. This has the
36
/// advantage of leaving source layers untouched at the expense of creating a
37
/// copy of each modified layer in memory for the duration of this function.
38
///
39
/// When \p editLayersInPlace is set to true, layers are modified in-place and
40
/// not reverted or persisted once the package has been created. In this case,
41
/// there is no overhead of creating copies of each modified layer. If you have
42
/// UsdStages open during the function call that reference the layers being
43
/// modified, you may receive warnings or composition errors. While these
44
/// errors will not affect the resulting package adversely, it is strongly
45
/// recommended that this function is run in isolation after any source
46
/// UsdStages have been closed.
47
///
48
/// If a function is provided for the \p processingFunc parameter, it will be
49
/// invoked on every asset path that is discovered during localization. This
50
/// allows you to inject your own logic into the process. Refer to
51
/// \ref UsdUtilsDependencyInfo for general information on user processing
52
/// functions. If an asset path is ignored in the processing function, it will
53
/// be removed from the layer and excluded from the localized package. Paths
54
/// that are modified will have their updated value written back into the
55
/// localized layer. Paths that are added to the dependencies array during
56
/// processing will be included in the resulting localized asset.
57
///
58
/// Returns true if the package was created successfully.
59
///
60
/// \note Clients of this function must take care of configuring the asset
61
/// resolver context before invoking the function. To create a default
62
/// resolver context, use \ref CreateDefaultContextForAsset() with the
63
/// asset path.
64
///
65
/// \note If the given asset has a dependency on a directory (i.e. an external
66
/// reference to a directory path), the dependency is ignored and the contents
67
/// of the directory are not included in the created package.
68
USDUTILS_API
69
bool
70
UsdUtilsLocalizeAsset
(
71
const
SdfAssetPath
& assetPath,
72
const
std::string& localizationDirectory,
73
bool
editLayersInPlace =
false
,
74
std::function<UsdUtilsProcessingFunc> processingFunc =
75
std::function<UsdUtilsProcessingFunc>());
76
77
PXR_NAMESPACE_CLOSE_SCOPE
78
79
#endif // PXR_USD_USD_UTILS_LOCALIZE_ASSET
userProcessingFunc.h
layer.h
UsdUtilsLocalizeAsset
USDUTILS_API bool UsdUtilsLocalizeAsset(const SdfAssetPath &assetPath, const std::string &localizationDirectory, bool editLayersInPlace=false, std::function< UsdUtilsProcessingFunc > processingFunc=std::function< UsdUtilsProcessingFunc >())
pxr.h
api.h
SdfAssetPath
Definition:
assetPath.h:72
PXR_NAMESPACE_OPEN_SCOPE
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition:
path.h:1425
PXR_NAMESPACE_CLOSE_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition:
pxr.h:74
USDUTILS_API
#define USDUTILS_API
Definition:
api.h:23
pxr
usd
usdUtils
localizeAsset.h
Generated on Wed Aug 27 2025 03:08:13 for HDK by
1.8.6