Skip to content

Commit

Permalink
JS Bindings: Enhance binding macros to support different kinds of fun…
Browse files Browse the repository at this point in the history
…ctions (#1198)
  • Loading branch information
frericp committed May 14, 2021
1 parent 5e01cf4 commit 5fd1b29
Show file tree
Hide file tree
Showing 2 changed files with 257 additions and 175 deletions.
22 changes: 11 additions & 11 deletions source/JsMaterialX/JsMaterialXCore/JsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,53 @@ extern "C"
int size = referenced.size();
return arrayToVec((std::string *)&referenced, size);
}))
BIND_FUNC("addNodeGraph", mx::Document, addNodeGraph, 0, 1, stRef)
BIND_MEMBER_FUNC("addNodeGraph", mx::Document, addNodeGraph, 0, 1, stRef)
.function("getNodeGraph", &mx::Document::getNodeGraph)
.function("getNodeGraphs", &mx::Document::getNodeGraphs)
.function("removeNodeGraph", &mx::Document::removeNodeGraph)
.function("getMatchingPorts", &mx::Document::getMatchingPorts)
BIND_FUNC("addGeomInfo", mx::Document, addGeomInfo, 0, 2, stRef, stRef)
BIND_MEMBER_FUNC("addGeomInfo", mx::Document, addGeomInfo, 0, 2, stRef, stRef)
.function("getGeomInfo", &mx::Document::getGeomInfo)
.function("getGeomInfos", &mx::Document::getGeomInfos)
.function("removeGeomInfo", &mx::Document::removeGeomInfo)
BIND_FUNC("getGeomPropValue", mx::Document, getGeomPropValue, 1, 2, stRef, stRef)
BIND_MEMBER_FUNC("getGeomPropValue", mx::Document, getGeomPropValue, 1, 2, stRef, stRef)
.function("addGeomPropDef", &mx::Document::addGeomPropDef)
.function("getGeomPropDef", &mx::Document::getGeomPropDef)
.function("getGeomPropDefs", &mx::Document::getGeomPropDefs)
.function("removeGeomPropDef", &mx::Document::removeGeomPropDef)
BIND_FUNC("addLook", mx::Document, addLook, 0, 1, stRef)
BIND_MEMBER_FUNC("addLook", mx::Document, addLook, 0, 1, stRef)
.function("getLook", &mx::Document::getLook)
.function("getLooks", &mx::Document::getLooks)
.function("removeLook", &mx::Document::removeLook)
BIND_FUNC("addLookGroup", mx::Document, addLookGroup, 0, 1, stRef)
BIND_MEMBER_FUNC("addLookGroup", mx::Document, addLookGroup, 0, 1, stRef)
.function("getLookGroup", &mx::Document::getLookGroup)
.function("getLookGroups", &mx::Document::getLookGroups)
.function("removeLookGroup", &mx::Document::removeLookGroup)
BIND_FUNC("addCollection", mx::Document, addCollection, 0, 1, stRef)
BIND_MEMBER_FUNC("addCollection", mx::Document, addCollection, 0, 1, stRef)
.function("getCollection", &mx::Document::getCollection)
.function("getCollections", &mx::Document::getCollections)
.function("removeCollection", &mx::Document::removeCollection)
.function("addTypeDef", &mx::Document::addTypeDef)
.function("getTypeDef", &mx::Document::getTypeDef)
.function("getTypeDefs", &mx::Document::getTypeDefs)
.function("removeTypeDef", &mx::Document::removeTypeDef)
BIND_FUNC("addNodeDef", mx::Document, addNodeDef, 0, 3, stRef, stRef, stRef)
BIND_FUNC("addNodeDefFromGraph", mx::Document, addNodeDefFromGraph, 7, 8, const mx::NodeGraphPtr,
BIND_MEMBER_FUNC("addNodeDef", mx::Document, addNodeDef, 0, 3, stRef, stRef, stRef)
BIND_MEMBER_FUNC("addNodeDefFromGraph", mx::Document, addNodeDefFromGraph, 7, 8, const mx::NodeGraphPtr,
stRef, stRef, stRef, bool, stRef, std::string, stRef)
.function("getNodeDef", &mx::Document::getNodeDef)
.function("getNodeDefs", &mx::Document::getNodeDefs)
.function("removeNodeDef", &mx::Document::removeNodeDef)
.function("getMatchingNodeDefs", &mx::Document::getMatchingNodeDefs)
.function("getMatchingImplementations", &mx::Document::getMatchingImplementations)
BIND_FUNC("addPropertySet", mx::Document, addPropertySet, 0, 1, stRef)
BIND_MEMBER_FUNC("addPropertySet", mx::Document, addPropertySet, 0, 1, stRef)
.function("getPropertySet", &mx::Document::getPropertySet)
.function("getPropertySets", &mx::Document::getPropertySets)
.function("removePropertySet", &mx::Document::removePropertySet)
BIND_FUNC("addVariantSet", mx::Document, addVariantSet, 0, 1, stRef)
BIND_MEMBER_FUNC("addVariantSet", mx::Document, addVariantSet, 0, 1, stRef)
.function("getVariantSet", &mx::Document::getVariantSet)
.function("getVariantSets", &mx::Document::getVariantSets)
.function("removeVariantSet", &mx::Document::removeVariantSet)
BIND_FUNC("addImplementation", mx::Document, addImplementation, 0, 1, stRef)
BIND_MEMBER_FUNC("addImplementation", mx::Document, addImplementation, 0, 1, stRef)
.function("getImplementation", &mx::Document::getImplementation)
.function("getImplementations", &mx::Document::getImplementations)
.function("removeImplementation", &mx::Document::removeImplementation)
Expand Down
Loading

0 comments on commit 5fd1b29

Please sign in to comment.