Skip to content

Commit

Permalink
Update Document methods
Browse files Browse the repository at this point in the history
Ensure datalibrary is copied and cleared.

Temporarily disable JS binding
  • Loading branch information
ashwinbhat committed Oct 9, 2024
1 parent 604499a commit 3dd6999
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions source/JsMaterialX/JsMaterialXCore/JsElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ namespace mx = MaterialX;
BIND_MEMBER_FUNC("setValue" #NAME, mx::ValueElement, setValue<T>, 1, 2, const T&, stRef)

#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>) \
BIND_MEMBER_FUNC("isA" #NAME, mx::Element, isA<T>, 0, 1, stRef) \
.function("asA" #NAME, ems::select_overload<std::shared_ptr<T>()>(&mx::Element::asA<T>))

Expand Down
1 change: 1 addition & 0 deletions source/MaterialXCore/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ bool Document::validate(string* message) const
void Document::invalidateCache()
{
_cache->valid = false;
_dataLibrary = nullptr;
}

//
Expand Down
2 changes: 2 additions & 0 deletions source/MaterialXCore/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class MX_CORE_API Document : public GraphElement
{
DocumentPtr doc = createDocument<Document>();
doc->copyContentFrom(getSelf());
if (hasDataLibrary())
doc->registerDataLibrary(getRegisteredDataLibrary());
return doc;
}

Expand Down

0 comments on commit 3dd6999

Please sign in to comment.