Added mName to aiScene. Primarily to provide access to the "name" member of glTF2 scenes.
parent
b1f3c48551
commit
67abcb10ba
|
@ -863,6 +863,7 @@ struct Sampler : public Object {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Scene : public Object {
|
struct Scene : public Object {
|
||||||
|
std::string name;
|
||||||
std::vector<Ref<Node>> nodes;
|
std::vector<Ref<Node>> nodes;
|
||||||
|
|
||||||
Scene() {}
|
Scene() {}
|
||||||
|
|
|
@ -1400,6 +1400,11 @@ inline void Node::Read(Value &obj, Asset &r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Scene::Read(Value &obj, Asset &r) {
|
inline void Scene::Read(Value &obj, Asset &r) {
|
||||||
|
if (Value *name = FindString(obj, "name")) {
|
||||||
|
if (name->IsString()) {
|
||||||
|
this->name = name->GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Value *array = FindArray(obj, "nodes")) {
|
if (Value *array = FindArray(obj, "nodes")) {
|
||||||
for (unsigned int i = 0; i < array->Size(); ++i) {
|
for (unsigned int i = 0; i < array->Size(); ++i) {
|
||||||
if (!(*array)[i].IsUint()) continue;
|
if (!(*array)[i].IsUint()) continue;
|
||||||
|
|
|
@ -1386,6 +1386,7 @@ void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IO
|
||||||
// read the asset file
|
// read the asset file
|
||||||
glTF2::Asset asset(pIOHandler);
|
glTF2::Asset asset(pIOHandler);
|
||||||
asset.Load(pFile, GetExtension(pFile) == "glb");
|
asset.Load(pFile, GetExtension(pFile) == "glb");
|
||||||
|
pScene->mName = asset.scene->name;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy the data out
|
// Copy the data out
|
||||||
|
|
|
@ -341,6 +341,9 @@ struct aiScene
|
||||||
*/
|
*/
|
||||||
C_STRUCT aiMetadata* mMetaData;
|
C_STRUCT aiMetadata* mMetaData;
|
||||||
|
|
||||||
|
/** The name of the scene itself.
|
||||||
|
*/
|
||||||
|
C_STRUCT aiString mName;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue