Skip to content

Commit

Permalink
Sphinx Python Documentation (#1567) - Added docstrings to PyMaterialX…
Browse files Browse the repository at this point in the history
…RenderOsl.
  • Loading branch information
StefanHabel committed Oct 18, 2023
1 parent 4c11bde commit 9d73ddc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
15 changes: 14 additions & 1 deletion source/PyMaterialX/PyMaterialXRenderOsl/PyModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,20 @@ void bindPyOslRenderer(py::module& mod);

PYBIND11_MODULE(PyMaterialXRenderOsl, mod)
{
mod.doc() = "Rendering materials using Open Shading Language";
mod.doc() = R"docstring(
Rendering materials using Open Shading Language.
:see: https://openshadinglanguage.org/
:see: https://open-shading-language.readthedocs.io/
OSL Rendering Classes
---------------------
.. autosummary::
:toctree: osl-rendering
OslRenderer
)docstring";

// PyMaterialXRenderOsl depends on types defined in PyMaterialXRender
pybind11::module::import("PyMaterialXRender");
Expand Down
20 changes: 19 additions & 1 deletion source/PyMaterialX/PyMaterialXRenderOsl/PyOslRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,23 @@ void bindPyOslRenderer(py::module& mod)
.def("setOslShaderName", &mx::OslRenderer::setOslShaderName)
.def("setOslUtilityOSOPath", &mx::OslRenderer::setOslUtilityOSOPath)
.def("useTestRender", &mx::OslRenderer::useTestRender)
.def("compileOSL", &mx::OslRenderer::compileOSL);
.def("compileOSL", &mx::OslRenderer::compileOSL)
.doc() = R"docstring(
Helper class for rendering generated OSL code to produce images.
The main services provided are:
- Source code validation: Use of the `oslc` executable to compile and
test output results.
- Introspection check: None at this time.
- Binding: None at this time.
- Render validation: Use of `testrender` to output rendered images.
Assumes source compliation was successful, as it depends on the
existence of corresponding `.oso` files.
The path to the OSL compiler binary (e.g. `oslc.exe`) can be set via the
`MATERIALX_OSL_BINARY_OSLC` build option.
The path to the OSL test render binary (e.g. `testrender.exe`) can be set
via the `MATERIALX_OSL_BINARY_TESTRENDER` build option.
)docstring";
}

0 comments on commit 9d73ddc

Please sign in to comment.