MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / bindPyBaker

Function bindPyBaker

src/bindings/python/PyBaker.cpp:25–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23} // namespace
24
25void bindPyBaker(py::module & m)
26{
27 BakerRcPtr DEFAULT = Baker::Create();
28
29 auto clsBaker =
30 py::class_<Baker, BakerRcPtr>(
31 m.attr("Baker"));
32
33 auto clsFormatIterator =
34 py::class_<FormatIterator>(
35 clsBaker, "FormatIterator",
36 R"doc(
37Iterator on LUT baker Formats.
38
39Each item is a tuple containing format name and format extension.
40)doc");
41
42 clsBaker
43 .def(py::init(&Baker::Create),
44 DOC(Baker, Create))
45 .def(py::init([](const ConfigRcPtr & config,
46 const std::string & format,
47 const std::string & inputSpace,
48 const std::string & targetSpace,
49 const std::string & looks,
50 int cubeSize,
51 const std::string & shaperSpace,
52 int shaperSize)
53 {
54 BakerRcPtr p = Baker::Create();
55 p->setConfig(config);
56 p->setFormat(format.c_str());
57 p->setInputSpace(inputSpace.c_str());
58 p->setTargetSpace(targetSpace.c_str());
59 p->setCubeSize(cubeSize);
60 p->setShaperSize(shaperSize);
61 if (!looks.empty()) { p->setLooks(looks.c_str()); }
62 if (!shaperSpace.empty()) { p->setShaperSpace(shaperSpace.c_str()); }
63 return p;
64 }),
65 "config"_a,
66 "format"_a,
67 "inputSpace"_a,
68 "targetSpace"_a,
69 "looks"_a = DEFAULT->getLooks(),
70 "cubeSize"_a = DEFAULT->getCubeSize(),
71 "shaperSpace"_a = DEFAULT->getShaperSpace(),
72 "shaperSize"_a = DEFAULT->getShaperSize(),
73 DOC(Baker, Create))
74
75 .def("__deepcopy__", [](const ConstBakerRcPtr & self, py::dict)
76 {
77 return self->createEditableCopy();
78 },
79 "memo"_a)
80
81 .def_static("getFormats", []()
82 {

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 15

checkIndexMethod · 0.80
nextIndexMethod · 0.80
setConfigMethod · 0.45
setFormatMethod · 0.45
setInputSpaceMethod · 0.45
setTargetSpaceMethod · 0.45
setCubeSizeMethod · 0.45
setShaperSizeMethod · 0.45
emptyMethod · 0.45
setLooksMethod · 0.45
setShaperSpaceMethod · 0.45
getLooksMethod · 0.45

Tested by

no test coverage detected