pull/3280/head
ywang 2020-06-10 13:23:29 -07:00
parent 578a7ac502
commit f57e7221c0
3 changed files with 17 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* /*
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -116,6 +116,19 @@ glTF2Exporter::glTF2Exporter(const char* filename, IOSystem* pIOSystem, const ai
ExportAnimations(); ExportAnimations();
//wangyi 0608
if(mProperties->HasPropertyCallback("extras"))
{
std::function<void*(void*)> 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); AssetWriter writer(*mAsset);
if (isBinary) { if (isBinary) {

View File

@ -587,7 +587,7 @@ ExportProperties::ExportProperties(const ExportProperties &other)
} }
//wangyi 0608 //wangyi 0608
bool ExportProperties::SetPropertyCallback(const char *szName, std::function<void *(void *)> &f) { bool ExportProperties::SetPropertyCallback(const char *szName, const std::function<void *(void *)> &f) {
return SetGenericProperty<std::function<void *(void *)>>(mCallbackProperties, szName, f); return SetGenericProperty<std::function<void *(void *)>>(mCallbackProperties, szName, f);
} }
std::function<void *(void *)> ExportProperties::GetPropertyCallback(const char *szName) const { std::function<void *(void *)> ExportProperties::GetPropertyCallback(const char *szName) const {

View File

@ -394,7 +394,7 @@ public:
bool SetPropertyMatrix(const char *szName, const aiMatrix4x4 &sValue); bool SetPropertyMatrix(const char *szName, const aiMatrix4x4 &sValue);
//wangyi 0608 //wangyi 0608
bool SetPropertyCallback(const char *szName, std::function<void *(void *)> &f); bool SetPropertyCallback(const char *szName, const std::function<void *(void *)> &f);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Get a configuration property. /** Get a configuration property.