feat(Rendering): report missing view node profile imports#3449
Open
daker wants to merge 1 commit intoKitware:masterfrom
Open
feat(Rendering): report missing view node profile imports#3449daker wants to merge 1 commit intoKitware:masterfrom
daker wants to merge 1 commit intoKitware:masterfrom
Conversation
Collaborator
Author
|
@finetjul what do you think ? |
Member
|
I don't really like that hardcoded list. It's doomed to be out of sync. |
Collaborator
Author
|
i think propose something like registerProfileHints in each Profil but it would sill need to maintan a list for each profile // Geometry.js
import { registerProfileHints } from 'vtk.js/Sources/Rendering/SceneGraph/ViewNodeFactory/profileHints';
registerProfileHints(
[
'vtkActor',
'vtkActor2D',
'vtkCamera',
'vtkCubeAxesActor',
'vtkMapper',
'vtkMapper2D',
'vtkPixelSpaceCallbackMapper',
'vtkRenderWindow',
'vtkRenderer',
'vtkScalarBarActor',
'vtkSkybox',
'vtkTexture',
],
'Geometry'
);
import 'vtk.js/Sources/Rendering/OpenGL/Profiles/Geometry';
import 'vtk.js/Sources/Rendering/WebGPU/Profiles/Geometry';
// registerProfileHints.js
const PROFILE_HINTS = Object.create(null);
export function registerProfileHint(className, profile) {
PROFILE_HINTS[className] = profile;
}
export function registerProfileHints(classNames, profile) {
classNames.forEach((className) => {
registerProfileHint(className, profile);
});
}
export function getSuggestedProfile(classNames) {
return classNames.find((className) => PROFILE_HINTS[className]);
}
export function getProfileForClass(className) {
return PROFILE_HINTS[className];
}
export default {
registerProfileHint,
registerProfileHints,
getSuggestedProfile,
getProfileForClass,
};
|
Member
|
if the hard-coded list is in the same file (e.g. Sources/Rendering/OpenGL/Profiles/Geometry.js) than the imports, then it I guess it would be fine. It could also handle the case where there are more supported "view nodes" in WebGPU than in WebGL. |
Collaborator
Author
|
@finetjul i can try that if you want |
Collaborator
Author
|
@finetjul we can't do it in Profiles/*.js because we are trying to tell the user to import that exact missing import :D so the registerProfileHints won't be called at all, i have tried something else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #3343
Context
Results
Changes
PR and Code Checklist
npm run reformatto have correctly formatted codeTesting