refactor(mtlreader): add a boolean to not automatically request and l…#2406
refactor(mtlreader): add a boolean to not automatically request and l…#2406luciemac wants to merge 1 commit intoKitware:masterfrom
Conversation
…oad materials files
| requestCount: 0, | ||
| materials: {}, | ||
| interpolateTextures: true, | ||
| autoLoadMaterials: true, |
| } | ||
| model.materials[model.currentMaterial][tokens[0]] = tokens.slice(1); | ||
| if (tokens[0] === 'map_Kd') { | ||
| if (model.autoLoadMaterials && tokens[0] === 'map_Kd') { |
There was a problem hiding this comment.
setImageSrc() seems to be implemented to overwrite the image. It's similar to what you need (you already have the image in cache and you do not want to load it again).
Maybe we could combine both usage:
e.g.
image.src = model.imageSourceHelper(tokens[1]);
...
model.imageSourceHelper = (source) => [model.baseURL, source].join('/');
macro.setGet(['imageSourceBuilder']);
...
mtlReader.setImageSourceBuilder((source) => {return ''});
@jourdain what is the purpose of setImageSrc() ? What's the use case ?
There was a problem hiding this comment.
I don't necessarily have it in cache.
Sometimes "map_Kd" is mentioned, but we don't want to use it because the image source file does not exist.
There was a problem hiding this comment.
@jourdain can you please tell us how you use setImageSrc()
There was a problem hiding this comment.
the mtl file will have a name/path and you want to link it to an HTML image so you call
setImageSrc(mtl_name, image_url)
You can see it being used here
There was a problem hiding this comment.
thanks and all my apologies for not finding it myself, I blame github online search (couldn't find it), and my VSCode search that is configured to search only the "Sources" folder. My bad
There was a problem hiding this comment.
No worries and sorry for not providing that info sooner, but still pretty busy on trame v2.
…oad materials files
Context
Results
Changes
PR and Code Checklist
npm run reformatto have correctly formatted codeTesting