Merge pull request #3510 from Evangel63/scene_name

Added mName to aiScene.
pull/3504/head^2
Kim Kulling 2020-11-23 10:07:58 +01:00 committed by GitHub
commit afd69bea8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View File

@ -863,6 +863,7 @@ struct Sampler : public Object {
};
struct Scene : public Object {
std::string name;
std::vector<Ref<Node>> nodes;
Scene() {}

View File

@ -1400,6 +1400,11 @@ inline void Node::Read(Value &obj, Asset &r) {
}
inline void Scene::Read(Value &obj, Asset &r) {
if (Value *scene_name = FindString(obj, "name")) {
if (scene_name->IsString()) {
this->name = scene_name->GetString();
}
}
if (Value *array = FindArray(obj, "nodes")) {
for (unsigned int i = 0; i < array->Size(); ++i) {
if (!(*array)[i].IsUint()) continue;

View File

@ -1386,6 +1386,9 @@ void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IO
// read the asset file
glTF2::Asset asset(pIOHandler);
asset.Load(pFile, GetExtension(pFile) == "glb");
if (asset.scene) {
pScene->mName = asset.scene->name;
}
//
// Copy the data out

View File

@ -335,12 +335,15 @@ struct aiScene
/**
* @brief The global metadata assigned to the scene itself.
*
* This data contains global metadata which belongs to the scene like
* unit-conversions, versions, vendors or other model-specific data. This
* This data contains global metadata which belongs to the scene like
* unit-conversions, versions, vendors or other model-specific data. This
* can be used to store format-specific metadata as well.
*/
C_STRUCT aiMetadata* mMetaData;
/** The name of the scene itself.
*/
C_STRUCT aiString mName;
#ifdef __cplusplus