ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccMaterialSet.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "../casters.h"
9 #include "ecvMaterialSet.h"
10 #include <pybind11/pybind11.h>
11 #include <pybind11/stl.h>
12 #include <pybind11/stl_bind.h>
13 
14 namespace py = pybind11;
15 using namespace pybind11::literals;
16 
18 {
19  py::class_<ccMaterialSet, std::vector<ccMaterial::CShared>, ccHObject, CCShareable>(
20  m, "ccMaterialSet")
21  .def(py::init<const QString &>(), py::arg("name") = QString("default"))
22  .def("getClassID", &ccMaterialSet::getClassID)
23  .def("isShareable", &ccMaterialSet::isShareable)
24  .def("findMaterialByName", &ccMaterialSet::findMaterialByName, py::arg("mtlName"))
25  .def("findMaterialByUniqueID", &ccMaterialSet::findMaterialByUniqueID, py::arg("uniqueID"))
26  .def("addMaterial",
28  py::arg("mat"),
29  py::arg("allowDuplicateNames") = false)
30  .def_static("ParseMTL",
32  py::arg("path"),
33  py::arg("filename"),
34  py::arg("materials"),
35  py::arg("errors"))
36  .def("saveAsMTL",
38  py::arg("path"),
39  py::arg("baseFilename"),
40  py::arg("errors"))
41  .def("clone", &ccMaterialSet::clone)
42  .def("append", &ccMaterialSet::append, py::arg("source"))
43  .def("isSerializable", &ccMaterialSet::isSerializable);
44 }
void define_ccMaterialSet(py::module &m)
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
int findMaterialByName(QString mtlName) const
Finds material by name.
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
int addMaterial(ccMaterial::CShared mat, bool allowDuplicateNames=false)
Adds a material.
bool saveAsMTL(QString path, const QString &baseFilename, QStringList &errors) const
Saves to an MTL file (+ associated texture images)
static bool ParseMTL(QString path, const QString &filename, ccMaterialSet &materials, QStringList &errors)
MTL (material) file parser.
virtual bool isShareable() const override
Returns whether object is shareable or not.
ccMaterialSet * clone() const
Clones materials set.
virtual bool isSerializable() const override
Returns whether object is serializable of not.
int findMaterialByUniqueID(QString uniqueID) const
Finds material by unique identifier.
bool append(const ccMaterialSet &source)
Appends materials from another set.
static double module(T *vector)
Definition: utils.h:105