Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #6496 - scale & rotate buttons #6502

Closed

Conversation

DougReeder
Copy link
Contributor

Bisecting showed the PR that introduced the bug was #6487 Among many changes there, findAncestorWithComponents() needed be called with Rigidbody. Holdable was retained and Deletable and MediaLoader were left out.

If it was a simple oversight, this PR should be a complete fix. If there were reasons to drop Deletable and MediaLoader, we'll need to do more work.

@Exairnous Exairnous requested a review from keianhzo September 29, 2024 06:48
@Exairnous
Copy link
Contributor

@DougReeder I think this looks good. Thanks.
@keianhzo can you confirm?

Copy link
Contributor

@keianhzo keianhzo left a comment

Choose a reason for hiding this comment

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

I believe this code will break the Blender grabbables component as they are not deletable so looking for the Deletable component when grabbing will mean that those won't be grabbable anymore.

I'd look further in that code to see why the menu buttons don't catch the focus...

Another option if that PR has introduced many bugs (as it seems) would be to revert it both there and in the Blender component, it's only one feature that would get lost and probably not a massively used one.

@DougReeder
Copy link
Contributor Author

I removed Deletable from this code, and you could scale but not rotate objects. :-S

If restoring Deletable and MediaLoader here breaks the Blender grabbables component, it looks like we should revert #6487

@Exairnous
Copy link
Contributor

I did a little digging and it looks like the reason this PR appears to be working is because it's not finding any entity with all of those components, so it's falling back to using the hovered entity. For some reason, the rotate and scale buttons seem to behave differently from the rest of the menu, probably because they are interactible/grabable instead of just single click buttons. So, I think the correct solution, fingers crossed, should be to check if it's a HoldableButton first, and then use that if it is, or if it isn't then check for the Holdable Rigidbody. Here's is some code that I think should work, but I've only done a cursory test of it.

const holdablebutton = findAncestorWithComponent(world, HoldableButton, hovered);
const interactable = holdablebutton ? holdablebutton : findAncestorWithComponents(world, [Holdable, Rigidbody], hovered);
target = interactable ? interactable : hovered

(note, this was manually retyped from a different computer I was testing on, so beware of typos)

@keianhzo What are your thoughts on this reasoning/solution?

@DougReeder
Copy link
Contributor Author

Withdrawn in favor of PR #6515

@DougReeder DougReeder closed this Nov 9, 2024
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