From 3dd69997712388ea4b324e2c217e8a7509731637 Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Wed, 9 Oct 2024 11:44:27 -0700 Subject: [PATCH] Update Document methods Ensure datalibrary is copied and cleared. Temporarily disable JS binding --- source/JsMaterialX/JsMaterialXCore/JsElement.cpp | 4 ---- source/MaterialXCore/Document.cpp | 1 + source/MaterialXCore/Document.h | 2 ++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/JsMaterialX/JsMaterialXCore/JsElement.cpp b/source/JsMaterialX/JsMaterialXCore/JsElement.cpp index c912d036c1..4c0596b891 100644 --- a/source/JsMaterialX/JsMaterialXCore/JsElement.cpp +++ b/source/JsMaterialX/JsMaterialXCore/JsElement.cpp @@ -22,10 +22,6 @@ namespace mx = MaterialX; BIND_MEMBER_FUNC("setValue" #NAME, mx::ValueElement, setValue, 1, 2, const T&, stRef) #define BIND_ELEMENT_CHILD_FUNC_INSTANCE(NAME, T) \ - BIND_MEMBER_FUNC("addChild" #NAME, mx::Element, addChild, 0, 1, stRef) \ - .function("getChildOfType" #NAME, &mx::Element::getChildOfType) \ - BIND_MEMBER_FUNC("getChildrenOfType" #NAME, mx::Element, getChildrenOfType, 0, 1, stRef) \ - .function("removeChildOfType" #NAME, &mx::Element::removeChildOfType) \ BIND_MEMBER_FUNC("isA" #NAME, mx::Element, isA, 0, 1, stRef) \ .function("asA" #NAME, ems::select_overload()>(&mx::Element::asA)) diff --git a/source/MaterialXCore/Document.cpp b/source/MaterialXCore/Document.cpp index d2047615c9..0b50583072 100644 --- a/source/MaterialXCore/Document.cpp +++ b/source/MaterialXCore/Document.cpp @@ -404,6 +404,7 @@ bool Document::validate(string* message) const void Document::invalidateCache() { _cache->valid = false; + _dataLibrary = nullptr; } // diff --git a/source/MaterialXCore/Document.h b/source/MaterialXCore/Document.h index eaaf6a5971..6fc9523cca 100644 --- a/source/MaterialXCore/Document.h +++ b/source/MaterialXCore/Document.h @@ -50,6 +50,8 @@ class MX_CORE_API Document : public GraphElement { DocumentPtr doc = createDocument(); doc->copyContentFrom(getSelf()); + if (hasDataLibrary()) + doc->registerDataLibrary(getRegisteredDataLibrary()); return doc; }