bitECS: Fix grabbable pinned media objects #6231
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6198
Problem
When you drop or paste a media file or url, a
MediaLoader
entity is created. This entity downloads the media file and creates a media (e.g., video) entity. TheMediaLoader
entity object then adds the media entity object as its child.The
MediaLoader
entity does not have a visible object after the loading cube disappears, but the media entity does. Both entities are hover targets, but after the loading cube disappears, theMediaLoader
entity can no longer be hovered because it does not have a visible object. Only the media entity can be hovered at this point.The media entity is not a networked entity, but the
MediaLoader
entity is. This means that theMediaLoader
entity can be pinned (the creator is "reticulum"), but the media entity cannot. If you check whether the media entity is pinned, it will always return false. Then media entity will always be grabbable even if it is pinned (more precisely its parent is pinned).Solution
Check its parent is pinned to check media entity is pinned.
Changes
LoadedByMediaLoader
component to detect a media entity is loaded viaMediaLoader
MediaLoader
inhold-system
that checks its parent is pinned to check whether it is pinned.Additional context
This solution is a bit hacky. Let me know if you have simpler and more elegant solution idea.