-
Notifications
You must be signed in to change notification settings - Fork 186
Description
Describe the bug 📝
`const syncHiddenObjectsStore = async () =>
{
if (!componentsRef)
{
return;
}
const hider = componentsRef.get(OBC.Hider) as OBC.Hider | undefined;
if (!hider)
{
return;
}
const hiddenMap = await hider.getVisibilityMap(false);
const hiddenInternalIds: string[] = [];
for (const [modelId, list] of Object.entries(hiddenMap))
{
if (!list)
{
continue;
}
for (const localId of list as number[])
{
hiddenInternalIds.push(`${modelId}:${localId}`);
}
}
const { setHiddenObjIds } = useSceneObjectsStore.getState();
setHiddenObjIds(hiddenInternalIds);
};`
I implemented a visibility-tracking function that synchronizes show/hide/isolate actions in the viewer with other UI components (e.g., greying out hidden nodes in the project tree). While the visibility operations themselves are fast, getVisibilityMap becomes a bottleneck when handling tens of thousands of objects, even though that scale should be manageable.
Reproduction ▶️
No response
Steps to reproduce 🔢
Call this function When lots of elements are hidden
const hiddenMap = await hider.getVisibilityMap(false);
System Info 💻
-Used Package Manager 📦
yarn
Error Trace/Logs 📃
No response
Validations ✅
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
- Check that this is a concrete bug. For Q&A join our Community.
- The provided reproduction is a minimal reproducible example of the bug.