Separate function for model import.
This commit is contained in:
parent
04da400129
commit
b24dd5cd9b
@ -616,31 +616,9 @@ OV.ImporterGltf = class extends OV.ImporterBase
|
||||
return;
|
||||
}
|
||||
|
||||
let defaultScene = this.GetDefaultScene (gltf);
|
||||
if (defaultScene === null) {
|
||||
this.SetError ();
|
||||
this.SetMessage ('No default scene found.');
|
||||
onFinish ();
|
||||
return;
|
||||
}
|
||||
|
||||
this.gltfExtensions.LoadLibraries (gltf.extensionsRequired, {
|
||||
onSuccess : () => {
|
||||
this.ImportModelProperties (gltf);
|
||||
|
||||
let materials = gltf.materials;
|
||||
if (materials !== undefined) {
|
||||
for (let i = 0; i < materials.length; i++) {
|
||||
this.ImportMaterial (gltf, i);
|
||||
}
|
||||
}
|
||||
|
||||
let nodeTree = this.CollectMeshNodesForScene (gltf, defaultScene);
|
||||
for (let i = 0; i < nodeTree.nodes.length; i++) {
|
||||
let nodeIndex = nodeTree.nodes[i];
|
||||
this.ImportMeshNode (gltf, nodeIndex, nodeTree);
|
||||
}
|
||||
|
||||
this.ImportModel (gltf);
|
||||
onFinish ();
|
||||
},
|
||||
onError : () => {
|
||||
@ -651,6 +629,31 @@ OV.ImporterGltf = class extends OV.ImporterBase
|
||||
});
|
||||
}
|
||||
|
||||
ImportModel (gltf)
|
||||
{
|
||||
let defaultScene = this.GetDefaultScene (gltf);
|
||||
if (defaultScene === null) {
|
||||
this.SetError ();
|
||||
this.SetMessage ('No default scene found.');
|
||||
return;
|
||||
}
|
||||
|
||||
this.ImportModelProperties (gltf);
|
||||
|
||||
let materials = gltf.materials;
|
||||
if (materials !== undefined) {
|
||||
for (let i = 0; i < materials.length; i++) {
|
||||
this.ImportMaterial (gltf, i);
|
||||
}
|
||||
}
|
||||
|
||||
let nodeTree = this.CollectMeshNodesForScene (gltf, defaultScene);
|
||||
for (let i = 0; i < nodeTree.nodes.length; i++) {
|
||||
let nodeIndex = nodeTree.nodes[i];
|
||||
this.ImportMeshNode (gltf, nodeIndex, nodeTree);
|
||||
}
|
||||
}
|
||||
|
||||
ImportModelProperties (gltf)
|
||||
{
|
||||
let propertyGroup = new OV.PropertyGroup ('Asset properties');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user