Commit 963d908b authored by Ben Boeckel's avatar Ben Boeckel

Merge topic 'update-pybind11'

* update-pybind11:
  Disable iterateMeshPy and fix importExportPy for Shiboken builds.
  PybindEntityTypeBits: Fix unused parameter warning.
  Ignore pybind11 shadow warning (will submit patch).
  Update to the latest pybind11.

Merge-request: !359
parents a053a2fe 56cf2427
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindAttribute LINK_PUBLIC smtkCore)
set_target_properties(smtkPybindAttribute
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindAttribute DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindCGMSession LINK_PUBLIC smtkCore smtkCGMSession L
set_target_properties(smtkPybindCGMSession
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindCGMSession DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -21,6 +21,7 @@ target_link_libraries(smtkPybindDiscreteSession LINK_PUBLIC smtkCore smtkDiscret
set_target_properties(smtkPybindDiscreteSession
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindDiscreteSession DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -18,6 +18,7 @@ target_link_libraries(smtkPybindExodusSession LINK_PUBLIC smtkCore smtkExodusSes
set_target_properties(smtkPybindExodusSession
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindExodusSession DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindMeshSession LINK_PUBLIC smtkCore smtkMeshSession
set_target_properties(smtkPybindMeshSession
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindMeshSession DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -21,6 +21,7 @@ target_link_libraries(smtkPybindPolygonSession LINK_PUBLIC smtkCore smtkPolygonS
set_target_properties(smtkPybindPolygonSession
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindPolygonSession DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -13,6 +13,7 @@ target_link_libraries(smtkPybindRemoteSession LINK_PUBLIC
set_target_properties(smtkPybindRemoteSession
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindRemoteSession DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindCommon LINK_PUBLIC smtkCore)
set_target_properties(smtkPybindCommon
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindCommon DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindIOVTK LINK_PUBLIC smtkCore smtkIOVTK)
set_target_properties(smtkPybindIOVTK
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindIOVTK DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindIO LINK_PUBLIC smtkCore)
set_target_properties(smtkPybindIO
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindIO DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindMesh LINK_PUBLIC smtkCore)
set_target_properties(smtkPybindMesh
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindMesh DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -3,10 +3,13 @@
# tests that require SMTK_DATA_DIR
set(smtkMeshPythonDataTests
extractTessellation
iterateMesh
simple
)
if (SMTK_USE_PYBIND11)
list(APPEND smtkMeshPythonDataTests iterateMesh)
endif()
#only run these tests if we have a valid data directory and we have a moab
#built with hdf5
if (SMTK_DATA_DIR
......
......@@ -6,6 +6,7 @@ target_link_libraries(smtkPybindModel LINK_PUBLIC smtkCore)
set_target_properties(smtkPybindModel
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindModel DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::AddAuxiliaryGeometry, smtk::model::Operator > pybind11_init_smtk_model_AddAuxiliaryGeometry(py::module &m)
{
PySharedPtrClass< smtk::model::AddAuxiliaryGeometry, smtk::model::Operator > instance(m, "AddAuxiliaryGeometry");
PySharedPtrClass< smtk::model::AddAuxiliaryGeometry, smtk::model::Operator > instance(m, "AddAuxiliaryGeometry", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::AddAuxiliaryGeometry const &>())
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::CloseModel, smtk::model::Operator > pybind11_init_smtk_model_CloseModel(py::module &m)
{
PySharedPtrClass< smtk::model::CloseModel, smtk::model::Operator > instance(m, "CloseModel");
PySharedPtrClass< smtk::model::CloseModel, smtk::model::Operator > instance(m, "CloseModel", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::CloseModel const &>())
......
......@@ -24,7 +24,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::DefaultSession, smtk::model::Session > pybind11_init_smtk_model_DefaultSession(py::module &m)
{
PySharedPtrClass< smtk::model::DefaultSession, smtk::model::Session > instance(m, "DefaultSession");
PySharedPtrClass< smtk::model::DefaultSession, smtk::model::Session > instance(m, "DefaultSession", py::metaclass());
instance
.def(py::init<::smtk::model::DefaultSession const &>())
.def("deepcopy", (smtk::model::DefaultSession & (smtk::model::DefaultSession::*)(::smtk::model::DefaultSession const &)) &smtk::model::DefaultSession::operator=)
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::DeleteMesh, smtk::model::Operator > pybind11_init_smtk_model_DeleteMesh(py::module &m)
{
PySharedPtrClass< smtk::model::DeleteMesh, smtk::model::Operator > instance(m, "DeleteMesh");
PySharedPtrClass< smtk::model::DeleteMesh, smtk::model::Operator > instance(m, "DeleteMesh", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::DeleteMesh const &>())
......
......@@ -86,7 +86,7 @@ void pybind11_init_smtk_model_EntityTypeBits(py::module &m)
.def("__or__", [](const smtk::model::EntityTypeBits &a, const smtk::model::EntityTypeBits &b) { return smtk::model::EntityTypeBits(a | b); })
.def("__and__", [](const smtk::model::EntityTypeBits &a, const smtk::model::EntityTypeBits &b) { return smtk::model::EntityTypeBits(a & b); })
.def("__xor__", [](const smtk::model::EntityTypeBits &a, const smtk::model::EntityTypeBits &b) { return smtk::model::EntityTypeBits(a ^ b); })
.def("__inv__", [](const smtk::model::EntityTypeBits &a, const smtk::model::EntityTypeBits &b) { return smtk::model::EntityTypeBits(~a); })
.def("__inv__", [](const smtk::model::EntityTypeBits &a) { return smtk::model::EntityTypeBits(~a); })
.def("__rshift__", [](const smtk::model::EntityTypeBits &a, const smtk::model::EntityTypeBits &b) { return smtk::model::EntityTypeBits(a >> b); })
.def("__lshift__", [](const smtk::model::EntityTypeBits &a, const smtk::model::EntityTypeBits &b) { return smtk::model::EntityTypeBits(a << b); })
.def("__int__", [](const smtk::model::EntityTypeBits &a) { return static_cast<int>(a); })
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::ExportMesh, smtk::model::Operator > pybind11_init_smtk_model_ExportMesh(py::module &m)
{
PySharedPtrClass< smtk::model::ExportMesh, smtk::model::Operator > instance(m, "ExportMesh");
PySharedPtrClass< smtk::model::ExportMesh, smtk::model::Operator > instance(m, "ExportMesh", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::ExportMesh const &>())
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::ExportModelJSON, smtk::model::Operator > pybind11_init_smtk_model_ExportModelJSON(py::module &m)
{
PySharedPtrClass< smtk::model::ExportModelJSON, smtk::model::Operator > instance(m, "ExportModelJSON");
PySharedPtrClass< smtk::model::ExportModelJSON, smtk::model::Operator > instance(m, "ExportModelJSON", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::ExportModelJSON const &>())
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::ExportSMTKModel, smtk::model::Operator > pybind11_init_smtk_model_ExportSMTKModel(py::module &m)
{
PySharedPtrClass< smtk::model::ExportSMTKModel, smtk::model::Operator > instance(m, "ExportSMTKModel");
PySharedPtrClass< smtk::model::ExportSMTKModel, smtk::model::Operator > instance(m, "ExportSMTKModel", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::ExportSMTKModel const &>())
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::ImportSMTKModel, smtk::model::Operator > pybind11_init_smtk_model_ImportSMTKModel(py::module &m)
{
PySharedPtrClass< smtk::model::ImportSMTKModel, smtk::model::Operator > instance(m, "ImportSMTKModel");
PySharedPtrClass< smtk::model::ImportSMTKModel, smtk::model::Operator > instance(m, "ImportSMTKModel", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::ImportSMTKModel const &>())
......
......@@ -13,6 +13,8 @@
#include <pybind11/pybind11.h>
#include <type_traits>
#include "smtk/model/Operator.h"
#include "smtk/attribute/Attribute.h"
......@@ -50,6 +52,8 @@ void pybind11_init_smtk_model_OperatorOutcome(py::module &m)
PySharedPtrClass< smtk::model::Operator > pybind11_init_smtk_model_Operator(py::module &m)
{
typedef std::underlying_type<::smtk::attribute::SearchStyle>::type SearchStyleType;
PySharedPtrClass< smtk::model::Operator > instance(m, "Operator");
instance
.def("__lt__", (bool (smtk::model::Operator::*)(::smtk::model::Operator const &) const) &smtk::model::Operator::operator<)
......@@ -63,17 +67,28 @@ PySharedPtrClass< smtk::model::Operator > pybind11_init_smtk_model_Operator(py::
.def("disassociateEntity", &smtk::model::Operator::disassociateEntity, py::arg("entity"))
.def("ensureSpecification", &smtk::model::Operator::ensureSpecification)
.def("eraseResult", &smtk::model::Operator::eraseResult, py::arg("res"))
.def("findDirectory", &smtk::model::Operator::findDirectory, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findDouble", &smtk::model::Operator::findDouble, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findFile", &smtk::model::Operator::findFile, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findGroup", &smtk::model::Operator::findGroup, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findInt", &smtk::model::Operator::findInt, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findMesh", &smtk::model::Operator::findMesh, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findMeshSelection", &smtk::model::Operator::findMeshSelection, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findModelEntity", &smtk::model::Operator::findModelEntity, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findRef", &smtk::model::Operator::findRef, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findString", &smtk::model::Operator::findString, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findVoid", &smtk::model::Operator::findVoid, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::ALL_CHILDREN)
.def("findDirectory", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findDirectory(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findDouble", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findDouble(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findFile", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findFile(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findGroup", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findGroup(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findInt", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findInt(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findMesh", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findMesh(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findMeshSelection", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findMeshSelection(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findModelEntity", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findModelEntity(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findRef", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findRef(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findString", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findString(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("findVoid", [](smtk::model::Operator& o, const std::string& s, SearchStyleType i) { return o.findVoid(s, ::smtk::attribute::SearchStyle(i)); },
py::arg("name"), py::arg("style") = static_cast<SearchStyleType>(::smtk::attribute::SearchStyle::ALL_CHILDREN))
.def("log", &smtk::model::Operator::log)
.def("manager", &smtk::model::Operator::manager)
.def("meshManager", &smtk::model::Operator::meshManager)
......@@ -94,21 +109,21 @@ PySharedPtrClass< smtk::model::Operator > pybind11_init_smtk_model_Operator(py::
.def("unobserve", (void (smtk::model::Operator::*)(::smtk::model::OperatorEventType, ::smtk::model::BareOperatorCallback, void *)) &smtk::model::Operator::unobserve, py::arg("event"), py::arg("functionHandle"), py::arg("callData"))
.def("unobserve", (void (smtk::model::Operator::*)(::smtk::model::OperatorEventType, ::smtk::model::OperatorWithResultCallback, void *)) &smtk::model::Operator::unobserve, py::arg("event"), py::arg("functionHandle"), py::arg("callData"))
.def("findAsInt", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::IntItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::IntItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
.def("findAsDouble", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::DoubleItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::DoubleItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
.def("findAsString", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::StringItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::StringItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
.def("findAsFile", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::FileItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::FileItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
.def("findAsDirectory", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::DirectoryItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::DirectoryItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
.def("findAsGroup", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::GroupItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::GroupItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
.def("findAsRef", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::RefItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::RefItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
.def("findAsModelEntity", [](const smtk::model::Operator& o, const std::string& s) {
return o.specification()->findAs<smtk::attribute::ModelEntityItem>(s, smtk::attribute::ALL_CHILDREN); })
return o.specification()->findAs<smtk::attribute::ModelEntityItem>(s, smtk::attribute::SearchStyle::ALL_CHILDREN); })
;
py::enum_<smtk::model::Operator::ResultEntityOrigin>(instance, "ResultEntityOrigin")
.value("CREATED", smtk::model::Operator::ResultEntityOrigin::CREATED)
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::RemoteOperator, smtk::model::Operator > pybind11_init_smtk_model_RemoteOperator(py::module &m)
{
PySharedPtrClass< smtk::model::RemoteOperator, smtk::model::Operator > instance(m, "RemoteOperator");
PySharedPtrClass< smtk::model::RemoteOperator, smtk::model::Operator > instance(m, "RemoteOperator", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::RemoteOperator const &>())
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::SetProperty, smtk::model::Operator > pybind11_init_smtk_model_SetProperty(py::module &m)
{
PySharedPtrClass< smtk::model::SetProperty, smtk::model::Operator > instance(m, "SetProperty");
PySharedPtrClass< smtk::model::SetProperty, smtk::model::Operator > instance(m, "SetProperty", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::SetProperty const &>())
......
......@@ -21,7 +21,7 @@ namespace py = pybind11;
PySharedPtrClass< smtk::model::WriteMesh, smtk::model::Operator > pybind11_init_smtk_model_WriteMesh(py::module &m)
{
PySharedPtrClass< smtk::model::WriteMesh, smtk::model::Operator > instance(m, "WriteMesh");
PySharedPtrClass< smtk::model::WriteMesh, smtk::model::Operator > instance(m, "WriteMesh", py::metaclass());
instance
.def(py::init<>())
.def(py::init<::smtk::model::WriteMesh const &>())
......
......@@ -54,7 +54,10 @@ class TestExportImport(smtk.testing.TestCase):
ftmp = os.path.join(smtk.testing.TEMP_DIR, str(uuid.uuid4()) + '.json')
# Export to ftmp
exp = sess.op('export smtk model')
SetVectorValue(exp.findFile('filename', smtk.attribute.ACTIVE_CHILDREN), [ftmp,])
if smtk.wrappingProtocol() == 'pybind11':
SetVectorValue(exp.findFile('filename', int(smtk.attribute.SearchStyle.ACTIVE_CHILDREN)), [ftmp,])
else:
SetVectorValue(exp.findFile('filename', smtk.attribute.SearchStyle.ACTIVE_CHILDREN), [ftmp,])
SetVectorValue(exp.specification().associations(), models)
result = exp.operate()
PrintResultLog(result)
......@@ -65,7 +68,10 @@ class TestExportImport(smtk.testing.TestCase):
SetActiveSession(se2)
# Import from ftmp
imp = se2.op('import smtk model')
SetVectorValue(imp.findFile('filename', smtk.attribute.ACTIVE_CHILDREN), [ftmp,])
if smtk.wrappingProtocol() == 'pybind11':
SetVectorValue(imp.findFile('filename', int(smtk.attribute.ACTIVE_CHILDREN)), [ftmp,])
else:
SetVectorValue(imp.findFile('filename', smtk.attribute.ACTIVE_CHILDREN), [ftmp,])
result = imp.operate()
PrintResultLog(result)
self.assertEqual(result.findInt('outcome').value(0), smtk.model.OPERATION_SUCCEEDED, 'Could not import model')
......
......@@ -298,7 +298,7 @@ def Delete(ents, **kwargs):
op = sess.op('delete')
SetVectorValue(op.specification().associations(), ents)
if 'delete_dependents' in kwargs and kwargs['delete_dependents']:
op.findVoid('delete dependents', smtk.attribute.ALL_CHILDREN).setIsEnabled()
op.findVoid('delete dependents', int(smtk.attribute.ALL_CHILDREN)).setIsEnabled()
res = op.operate()
SetLastResult(res)
PrintResultLog(res)
......@@ -310,7 +310,7 @@ def ImportSMTKModel(filename):
"""Import an SMTK model into the active session."""
sess = GetActiveSession()
op = sess.op('import smtk model')
fname = op.findFile('filename', smtk.attribute.ALL_CHILDREN)
fname = op.findFile('filename', int(smtk.attribute.ALL_CHILDREN))
fname.setValue(filename)
res = op.operate()
SetLastResult(res)
......@@ -391,7 +391,7 @@ def Subtract(workpiece, tool, **args):
# Convert tool to a list
if type(tool) != type([]):
tool = [tool,]
SetVectorValue(op.findModelEntity('tools',smtk.attribute.ALL_CHILDREN), tool)
SetVectorValue(op.findModelEntity('tools',int(smtk.attribute.ALL_CHILDREN)), tool)
res = op.operate()
SetLastResult(res)
......
Subproject commit 2b92a49115657712c7dd924248df2286e6143b8d
Subproject commit 05920e363edfd5d8dc6b4608820d749af5217b5f
......@@ -362,6 +362,24 @@ def parse_free_function(func, overloaded, stream):
stream("}")
return init_function_name
def has_static(class_):
for member in class_.public_members:
if member.parent.name != class_.name:
continue
if member.__class__.__name__ != "member_function_t":
continue
if member.has_static:
return True
for variable in class_.variables(allow_empty = True):
if variable.parent.name != class_.name:
continue
if variable.access_type == "public" \
and variable.type_qualifiers.has_static:
return True
return False
def parse_class(class_, stream, top_level = True):
"""
Write bindings for a class
......@@ -371,18 +389,24 @@ def parse_class(class_, stream, top_level = True):
init_function_name = "pybind11_init_" + mangled_name(class_)
metaclass = ""
if has_static(class_):
metaclass = ", py::metaclass()"
if top_level:
stream("%s %s(py::module &m)" % (bind_class_name(class_),
init_function_name))
init_function_name))
stream("{")
stream(" %s instance(m, \"%s\");" % \
stream(" %s instance(m, \"%s\"%s);" % \
(bind_class_name(class_),
class_.name.replace('<','_').replace('>','_').replace('::','_')))
class_.name.replace('<','_').replace('>','_').replace('::','_'),
metaclass))
stream(" instance")
else:
stream(" %s(instance, \"%s\")" % \
stream(" %s(instance, \"%s\"%s)" % \
(bind_class_name(class_),
class_.name.replace('<','_').replace('>','_').replace('::','_')))
class_.name.replace('<','_').replace('>','_').replace('::','_'),
metaclass))
if not class_.is_abstract:
for constructor in class_.constructors():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment