forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PyColorManagement.cpp
61 lines (52 loc) · 2.07 KB
/
PyColorManagement.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#include <PyMaterialX/PyMaterialX.h>
#include <MaterialXGenShader/ColorManagementSystem.h>
#include <MaterialXGenShader/DefaultColorManagementSystem.h>
#include <MaterialXGenShader/GenContext.h>
#include <MaterialXGenShader/ShaderGraph.h>
namespace py = pybind11;
namespace mx = MaterialX;
class PyColorManagementSystem : public mx::ColorManagementSystem
{
public:
PyColorManagementSystem()
{
}
const std::string& getName() const override
{
PYBIND11_OVERLOAD_PURE(
const std::string&,
mx::ColorManagementSystem,
getName
);
}
protected:
mx::ImplementationPtr getImplementation(const mx::ColorSpaceTransform& transform) const override
{
PYBIND11_OVERLOAD_PURE(
mx::ImplementationPtr,
mx::ColorManagementSystem,
getImplementation,
transform
);
}
};
void bindPyColorManagement(py::module& mod)
{
py::class_<mx::ColorSpaceTransform>(mod, "ColorSpaceTransform")
.def(py::init<const std::string&, const std::string&, const mx::TypeDesc*>())
.def_readwrite("sourceSpace", &mx::ColorSpaceTransform::sourceSpace)
.def_readwrite("targetSpace", &mx::ColorSpaceTransform::targetSpace)
.def_readwrite("type", &mx::ColorSpaceTransform::type);
py::class_<mx::ColorManagementSystem, PyColorManagementSystem, mx::ColorManagementSystemPtr>(mod, "ColorManagementSystem")
.def(py::init<>())
.def("getName", &mx::ColorManagementSystem::getName)
.def("loadLibrary", &mx::ColorManagementSystem::loadLibrary)
.def("supportsTransform", &mx::ColorManagementSystem::supportsTransform);
py::class_<mx::DefaultColorManagementSystem, mx::DefaultColorManagementSystemPtr, mx::ColorManagementSystem>(mod, "DefaultColorManagementSystem")
.def_static("create", &mx::DefaultColorManagementSystem::create)
.def("getName", &mx::DefaultColorManagementSystem::getName);
}