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 Apache License, Version 2.0 (the "Apache License")
5
// with the following modification; you may not use this file except in
6
// compliance with the Apache License and the following modification to it:
7
// Section 6. Trademarks. is deleted and replaced with:
8
//
9
// 6. Trademarks. This License does not grant permission to use the trade
10
// names, trademarks, service marks, or product names of the Licensor
11
// and its affiliates, except as required to comply with Section 4(c) of
12
// the License and to reproduce the content of the NOTICE file.
13
//
14
// You may obtain a copy of the Apache License at
15
//
16
// http://www.apache.org/licenses/LICENSE-2.0
17
//
18
// Unless required by applicable law or agreed to in writing, software
19
// distributed under the Apache License with the above modification is
20
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
// KIND, either express or implied. See the Apache License for the specific
22
// language governing permissions and limitations under the Apache License.
23
//
24
25
#include "
pxr/pxr.h
"
26
#include "
pxr/usd/sdf/layer.h
"
27
#include "
pxr/usd/usdUtils/api.h
"
28
#include "
pxr/usd/usdUtils/userProcessingFunc.h
"
29
30
#include <string>
31
32
#ifndef PXR_USD_USD_UTILS_LOCALIZE_ASSET
33
#define PXR_USD_USD_UTILS_LOCALIZE_ASSET
34
35
/// \file usdUtils/localizeAsset.h
36
37
PXR_NAMESPACE_OPEN_SCOPE
38
39
class
SdfAssetPath
;
40
41
/// Creates a localized version of the asset identified by \p assetPath and all
42
/// of its external dependencies in the directory specified by
43
/// \p localizationDirectory. Any anonymous layers that are encountered
44
/// during dependency discovery will be serialized into the resulting package.
45
/// Due to localization, the packaged layers might be modified to have different
46
/// asset paths.
47
///
48
/// The \p editLayersInPlace parameter controls the strategy used for managing
49
/// changes to layers (including the root layer and all transitive layer
50
/// dependencies) that occur during the package creation process. When
51
/// \p editLayersInPlace is false, a temporary, anonymous copy of each
52
/// modified layer is created and written into the package. This has the
53
/// advantage of leaving source layers untouched at the expense of creating a
54
/// copy of each modified layer in memory for the duration of this function.
55
///
56
/// When \p editLayersInPlace is set to true, layers are modified in-place and
57
/// not reverted or persisted once the package has been created. In this case,
58
/// there is no overhead of creating copies of each modified layer. If you have
59
/// UsdStages open during the function call that reference the layers being
60
/// modified, you may receive warnings or composition errors. While these
61
/// errors will not affect the resulting package adversely, it is strongly
62
/// recommended that this function is run in isolation after any source
63
/// UsdStages have been closed.
64
///
65
/// If a function is provided for the \p processingFunc parameter, it will be
66
/// invoked on every asset path that is discovered during localization. This
67
/// allows you to inject your own logic into the process. Refer to
68
/// \ref UsdUtilsDependencyInfo for general information on user processing
69
/// functions. If an asset path is ignored in the processing function, it will
70
/// be removed from the layer and excluded from the localized package. Paths
71
/// that are modified will have their updated value written back into the
72
/// localized layer. Paths that are added to the dependencies array during
73
/// processing will be included in the resulting localized asset.
74
///
75
/// Returns true if the package was created successfully.
76
///
77
/// \note Clients of this function must take care of configuring the asset
78
/// resolver context before invoking the function. To create a default
79
/// resolver context, use \ref CreateDefaultContextForAsset() with the
80
/// asset path.
81
///
82
/// \note If the given asset has a dependency on a directory (i.e. an external
83
/// reference to a directory path), the dependency is ignored and the contents
84
/// of the directory are not included in the created package.
85
USDUTILS_API
86
bool
87
UsdUtilsLocalizeAsset
(
88
const
SdfAssetPath
& assetPath,
89
const
std::string
& localizationDirectory,
90
bool
editLayersInPlace =
false
,
91
std::function<UsdUtilsProcessingFunc> processingFunc =
92
std::function<UsdUtilsProcessingFunc>());
93
94
PXR_NAMESPACE_CLOSE_SCOPE
95
96
#endif // PXR_USD_USD_UTILS_LOCALIZE_ASSET
userProcessingFunc.h
layer.h
string
GLsizei const GLchar *const * string
Definition:
glcorearb.h:814
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:46
PXR_NAMESPACE_OPEN_SCOPE
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition:
path.h:1432
PXR_NAMESPACE_CLOSE_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition:
pxr.h:91
USDUTILS_API
#define USDUTILS_API
Definition:
api.h:40
pxr
usd
usdUtils
localizeAsset.h
Generated on Sun Nov 17 2024 03:03:16 for HDK by
1.8.6