Skip to content

Conversation

keyboardspecialist
Copy link
Contributor

@keyboardspecialist keyboardspecialist commented Sep 25, 2025

Description

Improves tile selection change detection by checking if tiles were selected previous frame. Allows for LoD to load and render correctly.

Issue number and link

Testing plan

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

Thank you for the pull request, @keyboardspecialist!

✅ We can confirm we have a CLA on file for you.

@mzschwartz5 mzschwartz5 self-requested a review October 13, 2025 14:21
Comment on lines +841 to +856
const selectionChanged = () => {
const currentSelection = tileset._selectedTiles;
if (this._previousSelectionLength !== currentSelection.length) {
this._previousSelectionLength = currentSelection.length;
return true;
}
for (let i = 0; i < currentSelection.length; i++) {
if (!currentSelection[i]._wasSelectedLastFrame) {
this._previousSelectionLength = currentSelection.length;
return true;
}
}

this._previousSelectionLength = currentSelection.length;
return false;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - the update function is pretty long as-is, why not just extract this into a proper function instead of a lambda?

Copy link
Contributor

@mzschwartz5 mzschwartz5 Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other comments:

  1. Every branch of this function sets this._previousSelectionLength = currentSelection.length;, so rather than doing it 3x we do it just once, at the top.
  2. "selection" refers to a 3D tile, right? This function seems like it belongs to the tileset class, not to this class. The logic itself isn't specific to splats. It also seems like, if it were done in the tileset class, there may be a more performant way to do it that doesn't involve iterating over the whole surrent selection.

(Note that 2 is mutually exclusive with my other comment above; we can only do one or the other)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last this._previousSelectionLength = currentSelection.length; is unnecessary anyhow, because when they are not (already) equal, the first if has already kicked in.

All this should refer to selected tiles that have splat content - but this is not handled, see other issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point- actually, by the same logic, the second this._previousSelectionLength = currentSelection.length; is also unnecessary.

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.

3 participants