-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(mtlreader): add a boolean to not automatically request and l… #2406
base: master
Are you sure you want to change the base?
Conversation
…oad materials files
@@ -165,6 +165,7 @@ const DEFAULT_VALUES = { | |||
requestCount: 0, | |||
materials: {}, | |||
interpolateTextures: true, | |||
autoLoadMaterials: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to loadMaterialImages
?
@@ -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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jourdain can you please tell us how you use setImageSrc()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 reformat
to have correctly formatted codeTesting