From 9c252de657615fb96ec1970f12f259ae694db780 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sun, 12 Sep 2021 15:44:28 +0200 Subject: [PATCH] Minor code formatting. --- source/import/importergltf.js | 40 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/source/import/importergltf.js b/source/import/importergltf.js index a4db3d0..89f96e7 100644 --- a/source/import/importergltf.js +++ b/source/import/importergltf.js @@ -638,31 +638,27 @@ OV.ImporterGltf = class extends OV.ImporterBase ImportModelProperties (gltf) { - let propertyGroup = this.ImportModelPropertiesHelper('Asset properties', gltf.asset); - if (propertyGroup.PropertyCount() > 0) { - this.model.AddPropertyGroup (propertyGroup); - } - - if (gltf.asset['extras']) { - let extraPropertyGroup = this.ImportModelPropertiesHelper('Extras', gltf.asset['extras']); - if (extraPropertyGroup.PropertyCount() > 0) { - this.model.AddPropertyGroup (extraPropertyGroup); - } - } - } - - ImportModelPropertiesHelper (propertyGroupName, propertyObject) - { - let propertyGroup = new OV.PropertyGroup (propertyGroupName); - for (let propertyName in propertyObject) { - if (Object.prototype.hasOwnProperty.call (propertyObject, propertyName)) { - if (typeof propertyObject[propertyName] === 'string') { - const property = new OV.Property (OV.PropertyType.Text, propertyName, propertyObject[propertyName]); - propertyGroup.AddProperty (property); + function ImportProperties (model, propertyGroupName, propertyObject) + { + let propertyGroup = new OV.PropertyGroup (propertyGroupName); + for (let propertyName in propertyObject) { + if (Object.prototype.hasOwnProperty.call (propertyObject, propertyName)) { + if (typeof propertyObject[propertyName] === 'string') { + const property = new OV.Property (OV.PropertyType.Text, propertyName, propertyObject[propertyName]); + propertyGroup.AddProperty (property); + } } } + if (propertyGroup.PropertyCount () > 0) { + model.AddPropertyGroup (propertyGroup); + } + return propertyGroup; + } + + ImportProperties (this.model, 'Asset properties', gltf.asset); + if (gltf.asset['extras']) { + ImportProperties (this.model, 'Extras', gltf.asset['extras']); } - return propertyGroup; } GetDefaultScene (gltf)