From c886b6514acbf78da255b369fbe4e80fa4f4503f Mon Sep 17 00:00:00 2001 From: Lucie Macron Date: Mon, 9 May 2022 15:56:01 +0200 Subject: [PATCH] refactor(mtlreader): add a boolean to not automatically request and load materials files --- Sources/IO/Misc/MTLReader/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/IO/Misc/MTLReader/index.js b/Sources/IO/Misc/MTLReader/index.js index b3515c98709..ba0651fc4df 100644 --- a/Sources/IO/Misc/MTLReader/index.js +++ b/Sources/IO/Misc/MTLReader/index.js @@ -43,7 +43,7 @@ function vtkMTLReader(publicAPI, model) { model.materials[model.currentMaterial] = {}; } model.materials[model.currentMaterial][tokens[0]] = tokens.slice(1); - if (tokens[0] === 'map_Kd') { + if (model.autoLoadMaterials && tokens[0] === 'map_Kd') { const image = new Image(); image.onload = () => setTimeout(imageReady, 0); image.src = [model.baseURL, tokens[1]].join('/'); @@ -165,6 +165,7 @@ const DEFAULT_VALUES = { requestCount: 0, materials: {}, interpolateTextures: true, + autoLoadMaterials: true, // baseURL: null, // dataAccessHelper: null, // url: null, @@ -182,6 +183,7 @@ export function extend(publicAPI, model, initialValues = {}) { 'dataAccessHelper', 'interpolateTextures', 'splitGroup', + 'autoLoadMaterials', ]); macro.event(publicAPI, model, 'busy');