Loading...
Searching...
No Matches
utils.h
1//
2// Copyright 2018 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
8#ifndef PXR_USD_USDMTLX_UTILS_H
9#define PXR_USD_USDMTLX_UTILS_H
10
11#include "pxr/pxr.h"
12#include "pxr/usd/usdMtlx/api.h"
13#include "pxr/usd/sdr/declare.h"
14#include "pxr/usd/sdf/valueTypeName.h"
16#include "pxr/base/vt/value.h"
17#include <MaterialXCore/Document.h>
18#include <string>
19#include <vector>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
26USDMTLX_API
27const SdrStringVec&
28UsdMtlxStandardLibraryPaths();
29
32USDMTLX_API
33const SdrStringVec&
34UsdMtlxCustomSearchPaths();
35
41USDMTLX_API
42const SdrStringVec&
43UsdMtlxSearchPaths();
44
46USDMTLX_API
47SdrStringVec
48UsdMtlxStandardFileExtensions();
49
55USDMTLX_API
56MaterialX::DocumentPtr
57UsdMtlxReadDocument(const std::string& resolvedPath);
58
63USDMTLX_API
64MaterialX::ConstDocumentPtr
65UsdMtlxGetDocument(const std::string& resolvedUri);
66
69USDMTLX_API
70MaterialX::ConstDocumentPtr
71UsdMtlxGetDocumentFromString(const std::string &mtlxXml);
72
73// Return the version of the mtlx element. If the version cannot be
74// found then return an invalid default version. If implicitDefault
75// isn't null then we do to two things: we set implicitDefault to
76// false iff the isdefaultversion attribute exists and isn't empty,
77// otherwise we set it to true; and we return the version as a
78// default if isdefaultversion exists and is set to "true".
79USDMTLX_API
81UsdMtlxGetVersion(const MaterialX::ConstInterfaceElementPtr& mtlx,
82 bool* implicitDefault = nullptr);
83
88USDMTLX_API
89const std::string&
90UsdMtlxGetSourceURI(const MaterialX::ConstElementPtr& element);
91
98 int arraySize=0)
103 { }
104
109
113
117
121};
122
124USDMTLX_API
126UsdMtlxGetUsdType(const std::string& mtlxTypeName);
127
133USDMTLX_API
135UsdMtlxGetUsdValue(const MaterialX::ConstElementPtr& mtlx,
136 bool getDefaultValue = false);
137
140USDMTLX_API
141std::vector<VtValue>
142UsdMtlxGetPackedUsdValues(const std::string& values, const std::string& type);
143
153USDMTLX_API
154std::vector<std::string>
155UsdMtlxSplitStringArray(const std::string& s);
156
157PXR_NAMESPACE_CLOSE_SCOPE
158
159#endif // PXR_USD_USDMTLX_UTILS_H
Represents a value type name, i.e.
Definition: valueTypeName.h:72
SdrVersion.
Definition: declare.h:67
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:90
This file defines some macros that are useful for declaring and using static TfTokens.
Result of UsdMtlxGetUsdType().
Definition: utils.h:93
TfToken shaderPropertyType
The exact SdrShaderProperty type name.
Definition: utils.h:112
int arraySize
If the value type is a fixed-size array/tuple, this will be greater then zero.
Definition: utils.h:116
bool valueTypeNameIsExact
true iff the value type name is an exact match to the MaterialX type.
Definition: utils.h:120
SdfValueTypeName valueTypeName
The value type name that most closely matches the MaterialX type.
Definition: utils.h:108