-
Notifications
You must be signed in to change notification settings - Fork 434
Expand file tree
/
Copy pathPyUtil.cpp
More file actions
47 lines (40 loc) · 1.72 KB
/
Copy pathPyUtil.cpp
File metadata and controls
47 lines (40 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Copyright Contributors to the MaterialX Project
// SPDX-License-Identifier: Apache-2.0
//
#include <PyMaterialX/PyMaterialX.h>
#include <MaterialXGenShader/Util.h>
#include <MaterialXGenShader/Shader.h>
#include <MaterialXGenShader/ShaderGenerator.h>
#include <MaterialXGenShader/ShaderGraphHash.h>
namespace py = pybind11;
namespace mx = MaterialX;
size_t computeStructuralHashFromShader(const mx::Shader& shader)
{
return mx::computeStructuralHash(shader.getGraph());
}
std::vector<mx::TypedElementPtr> findRenderableMaterialNodes(mx::ConstDocumentPtr doc)
{
return mx::findRenderableMaterialNodes(doc);
}
std::vector<mx::TypedElementPtr> findRenderableElements(mx::ConstDocumentPtr doc, bool includeReferencedGraphs)
{
(void) includeReferencedGraphs;
return mx::findRenderableElements(doc);
}
void bindPyUtil(py::module& mod)
{
mod.def("isTransparentSurface", &mx::isTransparentSurface);
mod.def("mapValueToColor", &mx::mapValueToColor);
mod.def("requiresImplementation", &mx::requiresImplementation);
mod.def("elementRequiresShading", &mx::elementRequiresShading);
mod.def("findRenderableMaterialNodes", &findRenderableMaterialNodes);
mod.def("findRenderableElements", &findRenderableElements, py::arg("doc"), py::arg("includeReferencedGraphs") = false);
mod.def("getNodeDefInput", &mx::getNodeDefInput);
mod.def("tokenSubstitution", &mx::tokenSubstitution);
mod.def("getUdimCoordinates", &mx::getUdimCoordinates);
mod.def("getUdimScaleAndOffset", &mx::getUdimScaleAndOffset);
mod.def("connectsToWorldSpaceNode", &mx::connectsToWorldSpaceNode);
mod.def("hasElementAttributes", &mx::hasElementAttributes);
mod.def("computeStructuralHash", &computeStructuralHashFromShader);
}