Skip to content

feat(Rendering): report missing view node profile imports#3449

Open
daker wants to merge 1 commit intoKitware:masterfrom
daker:debug-profiles
Open

feat(Rendering): report missing view node profile imports#3449
daker wants to merge 1 commit intoKitware:masterfrom
daker:debug-profiles

Conversation

@daker
Copy link
Collaborator

@daker daker commented Mar 25, 2026

fixes #3343

Context

Results

image

Changes

  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js:
    • OS:
    • Browser:

@daker
Copy link
Collaborator Author

daker commented Mar 25, 2026

@finetjul what do you think ?

@finetjul
Copy link
Member

I don't really like that hardcoded list. It's doomed to be out of sync.

@Jo-Byr

@daker
Copy link
Collaborator Author

daker commented Mar 25, 2026

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,
};

@finetjul
Copy link
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.

@daker
Copy link
Collaborator Author

daker commented Mar 25, 2026

@finetjul i can try that if you want

@daker
Copy link
Collaborator Author

daker commented Mar 25, 2026

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Help debug missing profile

2 participants