Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a docstring for PyMaterialXFormat. #2040

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions python/MaterialX/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,6 @@ def _stringToValue(string, t):
stringToValue = _stringToValue


#
# XmlIo
#

readFromXmlFile = readFromXmlFileBase


#
# Default Data Paths
#
Expand Down
3 changes: 2 additions & 1 deletion source/PyMaterialX/PyMaterialXFormat/PyModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

#include <PyMaterialX/PyMaterialX.h>
#include "__doc__.md.h"

namespace py = pybind11;

Expand All @@ -13,7 +14,7 @@ void bindPyUtil(py::module& mod);

PYBIND11_MODULE(PyMaterialXFormat, mod)
{
mod.doc() = "Module containing Python bindings for the MaterialXFormat library";
mod.doc() = PyMaterialXFormat_DOCSTRING;

// PyMaterialXFormat depends on types defined in PyMaterialXCore
PYMATERIALX_IMPORT_MODULE(PyMaterialXCore);
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXFormat/PyXmlIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void bindPyXmlIo(py::module& mod)
.def_readwrite("writeXIncludeEnable", &mx::XmlWriteOptions::writeXIncludeEnable)
.def_readwrite("elementPredicate", &mx::XmlWriteOptions::elementPredicate);

mod.def("readFromXmlFileBase", &mx::readFromXmlFile,
mod.def("readFromXmlFile", &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);
Expand Down
59 changes: 59 additions & 0 deletions source/PyMaterialX/PyMaterialXFormat/__doc__.md.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// Copyright Contributors to the MaterialX Project
// SPDX-License-Identifier: Apache-2.0
//

// Docstring for the PyMaterialXFormat module

#define PyMaterialXFormat_DOCSTRING PYMATERIALX_DOCSTRING(R"docstring(
Cross-platform support for file and search paths, and XML serialization.

All functions and classes that are defined in this module are available in
the top-level `MaterialX` Python package, and are typically used via an
`import` alias named `mx`:

.. code:: python

import MaterialX as mx

File and Search Paths
---------------------

.. autofunction:: flattenFilenames
.. autofunction:: getEnvironmentPath
.. autofunction:: getSourceSearchPath
.. autofunction:: getSubdirectories
.. autofunction:: loadDocuments
.. autofunction:: loadLibraries
.. autofunction:: loadLibrary
.. autofunction:: prependXInclude

**Classes and Enumerations**

.. autosummary::
:toctree: file-and-search-paths

FilePath
FileSearchPath
Format
Type

XML Serialization
-----------------

.. autofunction:: readFile
.. autofunction:: readFromXmlFile
.. autofunction:: readFromXmlString
.. autofunction:: writeToXmlFile
.. autofunction:: writeToXmlString

**Classes and Exceptions**

.. autosummary::
:toctree: xml-serialization

XmlReadOptions
XmlWriteOptions
ExceptionParseError
ExceptionFileMissing
)docstring");
Loading