diff --git a/core/3d/Mesh.h b/core/3d/Mesh.h index 678afdf195a2..f855737cd79e 100644 --- a/core/3d/Mesh.h +++ b/core/3d/Mesh.h @@ -322,6 +322,10 @@ class AX_DLL Mesh : public Object std::vector _spotLightUniformRangeInverseValues; std::string _texFile; + + // add by binxiaojiao +public: + std::function& GetVisibleChanged() { return _visibleChanged; } }; // end of 3d group diff --git a/core/base/Properties.cpp b/core/base/Properties.cpp index 91dbd7f3bf55..c1b48552ade7 100644 --- a/core/base/Properties.cpp +++ b/core/base/Properties.cpp @@ -141,6 +141,38 @@ Properties* Properties::createNonRefCounted(std::string_view url) return p; } +Properties* Properties::createNonRefCounted(Data* data, ssize_t* dataIdx) +{ + std::vector namespacePath; + + // data will be released automatically when 'data' goes out of scope + // so we pass data as weak pointer + Properties* properties = new Properties(data, dataIdx); + properties->resolveInheritance(); + + // Get the specified properties object. + Properties* p = getPropertiesFromNamespacePath(properties, namespacePath); + if (!p) + { + AXLOGWARN("Failed to load properties from mem."); + AX_SAFE_DELETE(properties); + return nullptr; + } + + // If the loaded properties object is not the root namespace, + // then we have to clone it and delete the root namespace + // so that we don't leak memory. + if (p != properties) + { + p = p->clone(); + AX_SAFE_DELETE(properties); + } + // XXX + // p->setDirectoryPath(FileSystem::getDirectoryName(fileString)); + p->setDirectoryPath(""); + return p; +} + static bool isVariable(const char* str, char* outName, size_t outSize) { size_t len = strlen(str); diff --git a/core/base/Properties.h b/core/base/Properties.h index 67a3d1f49b58..7f6a4e4653a1 100644 --- a/core/base/Properties.h +++ b/core/base/Properties.h @@ -184,6 +184,8 @@ class AX_DLL Properties * @script{create} */ static Properties* createNonRefCounted(std::string_view url); + // add by binxiaojiao + static Properties* createNonRefCounted(Data* data, ssize_t* dataIdx); /** * Destructor.