forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PyGenContext.cpp
34 lines (28 loc) · 1.59 KB
/
PyGenContext.cpp
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
//
// TM & (c) 2019 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#include <PyMaterialX/PyMaterialX.h>
#include <MaterialXGenShader/GenContext.h>
#include <MaterialXGenShader/HwShaderGenerator.h>
namespace py = pybind11;
namespace mx = MaterialX;
void bindPyGenContext(py::module& mod)
{
py::class_<mx::ApplicationVariableHandler>(mod, "ApplicationVariableHandler");
py::class_<mx::GenContext, mx::GenContextPtr>(mod, "GenContext")
.def(py::init<mx::ShaderGeneratorPtr>())
.def("getShaderGenerator", &mx::GenContext::getShaderGenerator)
.def("getOptions", static_cast<mx::GenOptions & (mx::GenContext::*)()>(&mx::GenContext::getOptions), py::return_value_policy::reference)
.def("registerSourceCodeSearchPath", static_cast<void (mx::GenContext::*)(const mx::FilePath&)>(&mx::GenContext::registerSourceCodeSearchPath))
.def("registerSourceCodeSearchPath", static_cast<void (mx::GenContext::*)(const mx::FileSearchPath&)>(&mx::GenContext::registerSourceCodeSearchPath))
.def("resolveSourceFile", &mx::GenContext::resolveSourceFile)
.def("pushUserData", &mx::GenContext::pushUserData)
.def("setApplicationVariableHandler", &mx::GenContext::setApplicationVariableHandler)
.def("getApplicationVariableHandler", &mx::GenContext::getApplicationVariableHandler);
}
void bindPyGenUserData(py::module& mod)
{
py::class_<mx::GenUserData, mx::GenUserDataPtr>(mod, "GenUserData")
.def("getSelf", static_cast<mx::GenUserDataPtr(mx::GenUserData::*)()>(&mx::GenUserData::getSelf));
}