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

Full JS bindings for MaterialX Core #1203

Merged
merged 33 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
deaf7e0
Updated JsNode to JsValue
sdunkel May 12, 2021
5930f7b
Iterator protocol implemented
sdunkel May 12, 2021
cf229af
Added default args and validate bindings
sdunkel May 14, 2021
f69b231
Updated default arg binding funcs to new name
sdunkel May 14, 2021
1505644
Update JsDefinition to JsLook
muenstc May 14, 2021
fbe1884
Default Args for JsDefinition to JsLook
muenstc May 14, 2021
308e34a
chore: Style improvements
kohakukun May 11, 2021
bab0455
Consolidate test with python main.py
kohakukun May 17, 2021
aeea4b5
Fix tests
muenstc May 17, 2021
f1dd085
Add JsMaterial bindings
muenstc May 17, 2021
15a98ca
Add some of the missing bindings + fixes
muenstc May 17, 2021
4dda06e
Add more missing bindings, adapt getVersionIntegers bindings, remove …
muenstc May 17, 2021
994e0ad
addressed pr comments
sdunkel May 18, 2021
77217c7
addressed more review comments
sdunkel May 18, 2021
3fa6eb6
temporary workaround for issues with wrapping code
sdunkel May 18, 2021
c628f38
add bindings for JsElement: equal, notEqual, isA, asA
muenstc May 18, 2021
e7635cd
Automatic conversion of array <-> vector
frericp May 18, 2021
678bde8
removed unnecessary binding
sdunkel May 18, 2021
552c840
Fix vector <-> array conversion for vectors of smart pointers
frericp May 20, 2021
ccdcf3f
Remove JS wrapper code
frericp May 21, 2021
e8bd224
addressed pr comments
sdunkel May 21, 2021
cdf839c
Update array <-> vector test
frericp May 21, 2021
611300a
moved stRef to helper.h
sdunkel May 21, 2021
8d2dee8
added bind.h include again
sdunkel May 21, 2021
cfecad4
Fix getVersionIntegers
muenstc May 21, 2021
01682d1
Fix C++ internal exception handling.
frericp May 21, 2021
9aa97f5
Removed second validate overload
sdunkel May 25, 2021
9c70c32
Removed validate bindings from children
sdunkel May 25, 2021
9d8a770
Remove arrayToVec helper
frericp May 26, 2021
e90e180
Add inheritanceIterator test
kohakukun May 26, 2021
07f2643
addressed review comments
sdunkel May 26, 2021
a1b378a
add while loop test
kohakukun May 26, 2021
8a89e1b
added missing copyright headers
sdunkel May 26, 2021
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
4 changes: 2 additions & 2 deletions documents/DeveloperGuide/CodeExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ Module().then((_module) => {

// Create a simple shader interface.
const simpleSrf = doc.addNodeDef('ND_simpleSrf', 'surfaceshader', 'simpleSrf');
const diffColor = simpleSrf.setInputValuecolor3('diffColor', new mx.Color3(1.0, 1.0, 1.0));
const specColor = simpleSrf.setInputValuecolor3('specColor', new mx.Color3(0.0, 0.0, 0.0));
const diffColor = simpleSrf.setInputValueColor3('diffColor', new mx.Color3(1.0, 1.0, 1.0));
muenstc marked this conversation as resolved.
Show resolved Hide resolved
const specColor = simpleSrf.setInputValueColor3('specColor', new mx.Color3(0.0, 0.0, 0.0));
const roughness = simpleSrf.setParameterValuefloat('roughness', 0.25);

// Create a material that instantiates the shader.
Expand Down
1 change: 1 addition & 0 deletions source/JsMaterialX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(OUTPUT_LIBS ${PROJECT_BINARY_DIR}/source/)
set(SOURCE_FOLDER ${CMAKE_SOURCE_DIR}/source)

set(CORE_DEPS ${OUTPUT_CORE}JsTypes.cpp
${OUTPUT_CORE}JsMaterial.cpp
${OUTPUT_CORE}JsUnit.cpp
${OUTPUT_CORE}JsExceptions.cpp
${OUTPUT_CORE}JsUtil.cpp
Expand Down
38 changes: 19 additions & 19 deletions source/JsMaterialX/JsMaterialXCore/JsDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace mx = MaterialX;

using stRef = const std::string&;

#define BIND_VALUE_ELEMENT_FUNC_INSTANCE(NAME, T) \
.function("setValue" #NAME, &mx::AttributeDef::setValue<T>)
#define BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(NAME, T) \
BIND_MEMBER_FUNC("setValue" #NAME, mx::AttributeDef, setValue<T>, 1, 2, const T&, stRef)

extern "C"
{
Expand All @@ -23,6 +23,7 @@ extern "C"
.function("setNodeString", &mx::NodeDef::setNodeString)
.function("hasNodeString", &mx::NodeDef::hasNodeString)
.function("getNodeString", &mx::NodeDef::getNodeString)
.function("getType", &mx::NodeDef::getType)
.function("setNodeGroup", &mx::NodeDef::setNodeGroup)
muenstc marked this conversation as resolved.
Show resolved Hide resolved
.function("hasNodeGroup", &mx::NodeDef::hasNodeGroup)
.function("getNodeGroup", &mx::NodeDef::getNodeGroup)
Expand Down Expand Up @@ -100,7 +101,7 @@ extern "C"
.function("addUnit", &mx::UnitDef::addUnit)
.function("getUnit", &mx::UnitDef::getUnit)
.function("getUnits", &mx::UnitDef::getUnits)
.function("reomveUnit", &mx::UnitDef::removeUnit)
.function("removeUnit", &mx::UnitDef::removeUnit)
.class_property("CATEGORY", &mx::UnitDef::CATEGORY)
.class_property("UNITTYPE_ATTRIBUTE", &mx::UnitDef::UNITTYPE_ATTRIBUTE);

Expand All @@ -119,22 +120,21 @@ extern "C"
.function("setValueString", &mx::AttributeDef::setValueString)
.function("hasValueString", &mx::AttributeDef::hasValueString)
.function("getValueString", &mx::AttributeDef::getValueString)
// .function("setValue", &mx::AttributeDef::setValue)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Integer, int)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Boolean, bool)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Float, float)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Color3, mx::Color3)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Color4, mx::Color4)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Vector2, mx::Vector2)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Vector3, mx::Vector3)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Vector4, mx::Vector4)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Matrix33, mx::Matrix33)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Matrix44, mx::Matrix44)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(String, std::string)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(IntegerArray, mx::IntVec)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(BooleanArray, mx::BoolVec)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(FloatArray, mx::FloatVec)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(StringArray, mx::StringVec)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Integer, int)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Boolean, bool)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Float, float)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Color3, mx::Color3)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Color4, mx::Color4)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Vector2, mx::Vector2)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Vector3, mx::Vector3)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Vector4, mx::Vector4)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Matrix33, mx::Matrix33)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(Matrix44, mx::Matrix44)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(String, std::string)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(IntegerArray, mx::IntVec)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(BooleanArray, mx::BoolVec)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(FloatArray, mx::FloatVec)
BIND_ATTRIBUTE_DEF_FUNC_INSTANCE(StringArray, mx::StringVec)
.function("hasValue", &mx::AttributeDef::hasValue)
.function("getValue", &mx::AttributeDef::getValue)
.function("setElements", &mx::AttributeDef::setElements)
Expand Down
9 changes: 8 additions & 1 deletion source/JsMaterialX/JsMaterialXCore/JsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ extern "C"
ems::class_<mx::Document, ems::base<mx::GraphElement>>("Document")
.smart_ptr_constructor("Document", &std::make_shared<mx::Document, mx::ElementPtr, const std::string &>)
.smart_ptr<std::shared_ptr<const mx::Document>>("Document")
// At the moment only the Document type is used. Once more types are added this binding needs to be adapted accordingly.
frericp marked this conversation as resolved.
Show resolved Hide resolved
.class_function("createDocument", &mx::Document::createDocument<mx::Document>)
.function("initialize", &mx::Document::initialize)
.function("copy", &mx::Document::copy)
.function("importLibrary", &mx::Document::importLibrary)
Expand Down Expand Up @@ -92,7 +94,12 @@ extern "C"
.function("getUnitTypeDef", &mx::Document::getUnitTypeDef)
.function("getUnitTypeDefs", &mx::Document::getUnitTypeDefs)
.function("removeUnitTypeDef", &mx::Document::removeUnitTypeDef)
.function("getVersionIntegers", &mx::Document::getVersionIntegers)
.function("getVersionIntegers", ems::optional_override([](mx::Document &self) {
// std::pair throws a unbound type error when invoking the function in javascript
// As a result, the std:pair will be converted into an array.
std::pair<int, int> versionInts = self.getVersionIntegers();
return arrayToVec((int *)&versionInts, 2);
}))
.function("upgradeVersion", &mx::Document::upgradeVersion)
.function("setColorManagementSystem", &mx::Document::setColorManagementSystem)
.function("hasColorManagementSystem", &mx::Document::hasColorManagementSystem)
Expand Down
94 changes: 64 additions & 30 deletions source/JsMaterialX/JsMaterialXCore/JsElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ namespace mx = MaterialX;
#define BIND_VALUE_ELEMENT_FUNC_INSTANCE(NAME, T) \
BIND_MEMBER_FUNC("setValue" #NAME, mx::ValueElement, setValue<T>, 1, 2, const T&, stRef)

#define BIND_ELEMENT_FUNC_INSTANCE(T) \
BIND_MEMBER_FUNC("addChild" #T, mx::Element, addChild<T>, 0, 1, stRef) \
.function("getChildOfType" #T, &mx::Element::getChildOfType<T>) \
BIND_MEMBER_FUNC("getChildrenOfType" #T, mx::Element, getChildrenOfType<T>, 0, 1, stRef) \
.function("removeChildOfType" #T, &mx::Element::removeChildOfType<T>)
#define BIND_ELEMENT_CHILD_FUNC_INSTANCE(NAME, T) \
BIND_MEMBER_FUNC("addChild" #NAME, mx::Element, addChild<T>, 0, 1, stRef) \
.function("getChildOfType" #NAME, &mx::Element::getChildOfType<T>) \
BIND_MEMBER_FUNC("getChildrenOfType" #NAME, mx::Element, getChildrenOfType<T>, 0, 1, stRef) \
.function("removeChildOfType" #NAME, &mx::Element::removeChildOfType<T>) \
.function("getAncestorOfType" #NAME, &mx::Element::getAncestorOfType<T>) \
.function("resolveRootNameReference" #NAME, &mx::Element::resolveRootNameReference<T>)

#define BIND_ELEMENT_FUNC_INSTANCE(NAME, T) \
.function("setTypedAttribute" #NAME, &mx::Element::setTypedAttribute<T>) \
.function("getTypedAttribute" #NAME, &mx::Element::getTypedAttribute<T>)

extern "C"
{
Expand Down Expand Up @@ -69,22 +75,22 @@ extern "C"
.function("setChildIndex", &mx::Element::setChildIndex)
.function("getChildIndex", &mx::Element::getChildIndex)
.function("removeChild", &mx::Element::removeChild)
BIND_ELEMENT_FUNC_INSTANCE(mx::Collection)
BIND_ELEMENT_FUNC_INSTANCE(mx::Document)
BIND_ELEMENT_FUNC_INSTANCE(mx::GeomInfo)
BIND_ELEMENT_FUNC_INSTANCE(mx::GeomProp)
BIND_ELEMENT_FUNC_INSTANCE(mx::Implementation)
BIND_ELEMENT_FUNC_INSTANCE(mx::Look)
BIND_ELEMENT_FUNC_INSTANCE(mx::MaterialAssign)
BIND_ELEMENT_FUNC_INSTANCE(mx::Node)
BIND_ELEMENT_FUNC_INSTANCE(mx::NodeDef)
BIND_ELEMENT_FUNC_INSTANCE(mx::NodeGraph)
BIND_ELEMENT_FUNC_INSTANCE(mx::Property)
BIND_ELEMENT_FUNC_INSTANCE(mx::PropertySet)
BIND_ELEMENT_FUNC_INSTANCE(mx::PropertySetAssign)
BIND_ELEMENT_FUNC_INSTANCE(mx::Token)
BIND_ELEMENT_FUNC_INSTANCE(mx::TypeDef)
BIND_ELEMENT_FUNC_INSTANCE(mx::Visibility)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Collection, mx::Collection)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Document, mx::Document)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(GeomInfo, mx::GeomInfo)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(GeomProp, mx::GeomProp)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Implementation, mx::Implementation)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Look, mx::Look)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(MaterialAssign, mx::MaterialAssign)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Node, mx::Node)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(NodeDef, mx::NodeDef)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(NodeGraph, mx::NodeGraph)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Property, mx::Property)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(PropertySet, mx::PropertySet)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(PropertySetAssign, mx::PropertySetAssign)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Token, mx::Token)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(TypeDef, mx::TypeDef)
BIND_ELEMENT_CHILD_FUNC_INSTANCE(Visibility, mx::Visibility)

.function("setAttribute", &mx::Element::setAttribute)
.function("hasAttribute", &mx::Element::hasAttribute)
Expand All @@ -95,6 +101,21 @@ extern "C"
.function("getParent", ems::select_overload<mx::ConstElementPtr()const>(&mx::Element::getParent))
.function("getRoot", ems::select_overload<mx::ConstElementPtr()const>(&mx::Element::getRoot))
.function("getDocument", ems::select_overload<mx::ConstDocumentPtr()const>(&mx::Element::getDocument))
BIND_ELEMENT_FUNC_INSTANCE(Integer, int)
BIND_ELEMENT_FUNC_INSTANCE(Boolean, bool)
BIND_ELEMENT_FUNC_INSTANCE(Float, float)
BIND_ELEMENT_FUNC_INSTANCE(Color3, mx::Color3)
BIND_ELEMENT_FUNC_INSTANCE(Color4, mx::Color4)
BIND_ELEMENT_FUNC_INSTANCE(Vector2, mx::Vector2)
BIND_ELEMENT_FUNC_INSTANCE(Vector3, mx::Vector3)
BIND_ELEMENT_FUNC_INSTANCE(Vector4, mx::Vector4)
BIND_ELEMENT_FUNC_INSTANCE(Matrix33, mx::Matrix33)
BIND_ELEMENT_FUNC_INSTANCE(Matrix44, mx::Matrix44)
BIND_ELEMENT_FUNC_INSTANCE(String, std::string)
BIND_ELEMENT_FUNC_INSTANCE(IntegerArray, mx::IntVec)
BIND_ELEMENT_FUNC_INSTANCE(BooleanArray, mx::BoolVec)
BIND_ELEMENT_FUNC_INSTANCE(FloatArray, mx::FloatVec)
BIND_ELEMENT_FUNC_INSTANCE(StringArray, mx::StringVec)
.function("traverseTree", &mx::Element::traverseTree)
muenstc marked this conversation as resolved.
Show resolved Hide resolved

.function("traverseGraph", &mx::Element::traverseGraph)
Expand All @@ -108,13 +129,11 @@ extern "C"
.function("getSourceUri", &mx::Element::getSourceUri)
.function("getActiveSourceUri", &mx::Element::getActiveSourceUri)
BIND_VALIDATE(mx::Element)
.function("copyContentFrom", ems::optional_override([](mx::Element &self, mx::ConstElementPtr source) {
const mx::ConstElementPtr &source1 = source;
return self.mx::Element::copyContentFrom(source1);
}))
.function("copyContentFrom", &mx::Element::copyContentFrom)
.function("clearContent", &mx::Element::clearContent)
.function("createValidChildName", &mx::Element::createValidChildName)
BIND_MEMBER_FUNC("createStringResolver", mx::Element, createStringResolver, 0, 1, stRef)
muenstc marked this conversation as resolved.
Show resolved Hide resolved
.function("addTokens", &mx::Element::addTokens)
.function("asString", &mx::Element::asString)
.function("__str__", &mx::Element::asString)
muenstc marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -149,7 +168,6 @@ extern "C"
.function("setImplementationName", &mx::ValueElement::setImplementationName)
.function("hasImplementationName", &mx::ValueElement::hasImplementationName)
.function("getImplementationName", &mx::ValueElement::getImplementationName)
// .function("setValue", &mx::ValueElement::setValue)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Integer, int)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Boolean, bool)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(Float, float)
Expand All @@ -165,9 +183,10 @@ extern "C"
BIND_VALUE_ELEMENT_FUNC_INSTANCE(BooleanArray, mx::BoolVec)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(FloatArray, mx::FloatVec)
BIND_VALUE_ELEMENT_FUNC_INSTANCE(StringArray, mx::StringVec)
.function("hasValue", &mx::ValueElement::hasValue)
.function("getValue", &mx::ValueElement::getValue)
sdunkel marked this conversation as resolved.
Show resolved Hide resolved
.function("getDefaultValue", &mx::ValueElement::getDefaultValue)
BIND_MEMBER_FUNC_RAW_PTR("getResolvedValue", mx::ValueElement, getResolvedValue, 0, 1, mx::StringResolverPtr)
sdunkel marked this conversation as resolved.
Show resolved Hide resolved
.function("getDefaultValue", &mx::ValueElement::getDefaultValue)
.function("setUnit", &mx::ValueElement::setUnit)
.function("hasUnit", &mx::ValueElement::hasUnit)
.function("getUnit", &mx::ValueElement::getUnit)
Expand All @@ -184,20 +203,31 @@ extern "C"
.class_property("IMPLEMENTATION_TYPE_ATTRIBUTE", &mx::ValueElement::IMPLEMENTATION_TYPE_ATTRIBUTE)
.class_property("ENUM_ATTRIBUTE", &mx::ValueElement::ENUM_ATTRIBUTE)
.class_property("ENUM_VALUES_ATTRIBUTE", &mx::ValueElement::ENUM_VALUES_ATTRIBUTE)
.class_property("UNIT_ATTRIBUTE", &mx::ValueElement::UNIT_ATTRIBUTE)
.class_property("UI_NAME_ATTRIBUTE", &mx::ValueElement::UI_NAME_ATTRIBUTE)
.class_property("UI_FOLDER_ATTRIBUTE", &mx::ValueElement::UI_FOLDER_ATTRIBUTE)
.class_property("UI_MIN_ATTRIBUTE", &mx::ValueElement::UI_MIN_ATTRIBUTE)
.class_property("UI_MAX_ATTRIBUTE", &mx::ValueElement::UI_MAX_ATTRIBUTE)
.class_property("UI_SOFT_MIN_ATTRIBUTE", &mx::ValueElement::UI_SOFT_MIN_ATTRIBUTE)
.class_property("UI_SOFT_MAX_ATTRIBUTE", &mx::ValueElement::UI_SOFT_MAX_ATTRIBUTE)
.class_property("UI_STEP_ATTRIBUTE", &mx::ValueElement::UI_STEP_ATTRIBUTE)
.class_property("UI_ADVANCED_ATTRIBUTE", &mx::ValueElement::UI_ADVANCED_ATTRIBUTE);
.class_property("UI_ADVANCED_ATTRIBUTE", &mx::ValueElement::UI_ADVANCED_ATTRIBUTE)
.class_property("UNIT_ATTRIBUTE", &mx::ValueElement::UNIT_ATTRIBUTE)
.class_property("UNITTYPE_ATTRIBUTE", &mx::ValueElement::UNITTYPE_ATTRIBUTE)
.class_property("UNIFORM_ATTRIBUTE", &mx::ValueElement::UNIFORM_ATTRIBUTE);


ems::class_<mx::Token, ems::base<mx::ValueElement>>("Token")
muenstc marked this conversation as resolved.
Show resolved Hide resolved
.smart_ptr_constructor("Token", &std::make_shared<mx::Token, mx::ElementPtr, const std::string &>)
sdunkel marked this conversation as resolved.
Show resolved Hide resolved
.class_property("CATEGORY", &mx::Token::CATEGORY);

ems::class_<mx::CommentElement, ems::base<mx::Element>>("CommentElement")
.smart_ptr_constructor("CommentElement", &std::make_shared<mx::CommentElement, mx::ElementPtr, const std::string &>)
.class_property("CATEGORY", &mx::CommentElement::CATEGORY);

ems::class_<mx::GenericElement, ems::base<mx::Element>>("GenericElement")
.smart_ptr_constructor("GenericElement", &std::make_shared<mx::GenericElement, mx::ElementPtr, const std::string &>)
.class_property("CATEGORY", &mx::GenericElement::CATEGORY);

ems::class_<mx::StringResolver>("StringResolver")
.smart_ptr<std::shared_ptr<mx::StringResolver>>("StringResolver")
.class_function("create", &mx::StringResolver::create) // Static function for creating a mx::StringResolver instance
Expand Down Expand Up @@ -229,8 +259,12 @@ extern "C"

return obj;
}))
.function("resolve", &mx::StringResolver::resolve);
.function("resolve", &mx::StringResolver::resolve)
.class_function("isResolvedType", &mx::StringResolver::isResolvedType);

ems::class_<mx::ElementPredicate>("ElementPredicate");

ems::function("targetStringsMatch", &mx::targetStringsMatch);
ems::function("prettyPrint", &mx::prettyPrint);
}
}
4 changes: 2 additions & 2 deletions source/JsMaterialX/JsMaterialXCore/JsGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C"
.function("getCollectionString", &mx::GeomElement::getCollectionString)
.function("setCollection", &mx::GeomElement::setCollection)
.function("getCollection", &mx::GeomElement::getCollection)
BIND_VALIDATE(mx::GeomElement)
// BIND_VALIDATE(mx::GeomElement)
sdunkel marked this conversation as resolved.
Show resolved Hide resolved
.class_property("GEOM_ATTRIBUTE", &mx::GeomElement::GEOM_ATTRIBUTE)
.class_property("COLLECTION_ATTRIBUTE", &mx::GeomElement::COLLECTION_ATTRIBUTE);

Expand Down Expand Up @@ -101,7 +101,7 @@ extern "C"
.function("getIncludeCollections", &mx::Collection::getIncludeCollections)
.function("hasIncludeCycle", &mx::Collection::hasIncludeCycle)
.function("matchesGeomString", &mx::Collection::matchesGeomString)
BIND_VALIDATE(mx::Collection)
// BIND_VALIDATE(mx::Collection)
sdunkel marked this conversation as resolved.
Show resolved Hide resolved
.class_property("CATEGORY", &mx::Collection::CATEGORY)
.class_property("INCLUDE_GEOM_ATTRIBUTE", &mx::Collection::INCLUDE_GEOM_ATTRIBUTE)
.class_property("EXCLUDE_GEOM_ATTRIBUTE", &mx::Collection::EXCLUDE_GEOM_ATTRIBUTE)
Expand Down
Loading