From f57e7221c07f385cebcc457d294e90c446995d41 Mon Sep 17 00:00:00 2001 From: ywang Date: Wed, 10 Jun 2020 13:23:29 -0700 Subject: [PATCH] temp --- code/AssetLib/glTF2/glTF2Exporter.cpp | 17 +++++++++++++++-- code/Common/Exporter.cpp | 2 +- include/assimp/Exporter.hpp | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 566f95e80..98eb79e57 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -1,4 +1,4 @@ -/* +/* Open Asset Import Library (assimp) ---------------------------------------------------------------------- @@ -115,7 +115,20 @@ glTF2Exporter::glTF2Exporter(const char* filename, IOSystem* pIOSystem, const ai ExportScene(); ExportAnimations(); - + + //wangyi 0608 + if(mProperties->HasPropertyCallback("extras")) + { + std::function ExportExtras = mProperties->GetPropertyCallback("extras"); + char* ret = (char*)ExportExtras((void*)mAsset.get()); + + Document extrasD; + extrasD.Parse(ret); + std::string strHello = extrasD["hello"].GetString(); + + printf("wangyi 0608 ret: %s\r\n", ret); + } + AssetWriter writer(*mAsset); if (isBinary) { diff --git a/code/Common/Exporter.cpp b/code/Common/Exporter.cpp index e8ee188e6..5fef455bb 100644 --- a/code/Common/Exporter.cpp +++ b/code/Common/Exporter.cpp @@ -587,7 +587,7 @@ ExportProperties::ExportProperties(const ExportProperties &other) } //wangyi 0608 -bool ExportProperties::SetPropertyCallback(const char *szName, std::function &f) { +bool ExportProperties::SetPropertyCallback(const char *szName, const std::function &f) { return SetGenericProperty>(mCallbackProperties, szName, f); } std::function ExportProperties::GetPropertyCallback(const char *szName) const { diff --git a/include/assimp/Exporter.hpp b/include/assimp/Exporter.hpp index 4abea6ad0..87c12f374 100644 --- a/include/assimp/Exporter.hpp +++ b/include/assimp/Exporter.hpp @@ -394,7 +394,7 @@ public: bool SetPropertyMatrix(const char *szName, const aiMatrix4x4 &sValue); //wangyi 0608 - bool SetPropertyCallback(const char *szName, std::function &f); + bool SetPropertyCallback(const char *szName, const std::function &f); // ------------------------------------------------------------------- /** Get a configuration property.