feat(Rendering): report missing view node profile imports#3449
feat(Rendering): report missing view node profile imports#3449daker wants to merge 1 commit intoKitware:masterfrom
Conversation
|
@finetjul what do you think ? |
|
I don't really like that hardcoded list. It's doomed to be out of sync. |
|
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,
};
|
|
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. |
|
@finetjul i can try that if you want |
|
@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 |
|
@Jo-Byr what do you think of the proposed solution ? |
fixes #3343
Context
Results
Changes
PR and Code Checklist
npm run reformatto have correctly formatted codeTesting