forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyXmlIo.cpp
More file actions
46 lines (37 loc) · 2.11 KB
/
PyXmlIo.cpp
File metadata and controls
46 lines (37 loc) · 2.11 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
//
// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#include <PyMaterialX/PyMaterialX.h>
#include <MaterialXFormat/XmlIo.h>
#include <MaterialXCore/Document.h>
namespace py = pybind11;
namespace mx = MaterialX;
void bindPyXmlIo(py::module& mod)
{
py::class_<mx::XmlReadOptions>(mod, "XmlReadOptions")
.def(py::init())
.def_readwrite("readXIncludeFunction", &mx::XmlReadOptions::readXIncludeFunction)
.def_readwrite("readComments", &mx::XmlReadOptions::readComments)
.def_readwrite("upgradeVersion", &mx::XmlReadOptions::upgradeVersion)
.def_readwrite("parentXIncludes", &mx::XmlReadOptions::parentXIncludes);
py::class_<mx::XmlWriteOptions>(mod, "XmlWriteOptions")
.def(py::init())
.def_readwrite("writeXIncludeEnable", &mx::XmlWriteOptions::writeXIncludeEnable)
.def_readwrite("elementPredicate", &mx::XmlWriteOptions::elementPredicate);
mod.def("readFromXmlFileBase", &mx::readFromXmlFile,
py::arg("doc"), py::arg("filename"), py::arg("searchPath") = mx::FileSearchPath(), py::arg("readOptions") = (mx::XmlReadOptions*) nullptr);
mod.def("readFromXmlString", &mx::readFromXmlString,
py::arg("doc"), py::arg("str"), py::arg("searchPath") = mx::FileSearchPath(), py::arg("readOptions") = (mx::XmlReadOptions*) nullptr);
mod.def("writeToXmlFile", mx::writeToXmlFile,
py::arg("doc"), py::arg("filename"), py::arg("writeOptions") = (mx::XmlWriteOptions*) nullptr);
mod.def("writeToXmlString", mx::writeToXmlString,
py::arg("doc"), py::arg("writeOptions") = nullptr);
mod.def("prependXInclude", mx::prependXInclude);
mod.def("getEnvironmentPath", &mx::getEnvironmentPath,
py::arg("sep") = mx::PATH_LIST_SEPARATOR);
mod.attr("PATH_LIST_SEPARATOR") = mx::PATH_LIST_SEPARATOR;
mod.attr("MATERIALX_SEARCH_PATH_ENV_VAR") = mx::MATERIALX_SEARCH_PATH_ENV_VAR;
py::register_exception<mx::ExceptionParseError>(mod, "ExceptionParseError");
py::register_exception<mx::ExceptionFileMissing>(mod, "ExceptionFileMissing");
}