Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
137 stars 2 forks source link

The Canvas BlockAllInteractions field is saved as True when facets are saved while grabbed #2275

Open Zyzyl opened 4 months ago

Zyzyl commented 4 months ago

Describe the bug?

When a user grabs a Facet, the BlockAllInteractions field is set to true on the associated Canvas for the duration of the grab. If the Facet is saved while grabbed, then BlockAllInteractions is saved as true. This means that the Facet will be non-interactable when spawned from the inventory.

Since the BlockAllInteractions field is set to false when a Facet is released from being grabbed, one can simply grab the Facet after spawning it to make it interactable again. Arguably this feature makes this issue relatively minor, since most Facets will be grabbed after being spawned. However, I thought I'd log this as an issue because it confused me that Facets I was working on were sometimes spawning with interactions blocked.

To Reproduce

With the Dev Tool, open the Create New menu > Object > Facet. While grabbing the Facet, save it either via the context menu button or the Save Held button in the inventory. Spawn the facet (without grabbing it!) and note that the BlockAllInteractions field on the Canvas is True.

Expected behavior

I would expect that, in general, Facets would not be saved in such a way that they become non-interactable unless subsequently grabbed.

Screenshots

No response

Resonite Version Number

Beta 2024.6.5.1084

What Platforms does this occur on?

Windows

What headset if any do you use?

Tested in Desktop mode and VR (HP Reverb G2)

Log Files

Zyzyl - 2024.6.5.1084 - 2024-06-09 21_23_55.log

Additional Context

No response

Reporters

Zyzyl (zyzylian on Discord)

lxw404 commented 4 months ago

I've just noticed this too, I can't believe I haven't run into this sooner, though I have gotten in the habit of just saving things from the slot ref just to be extra safe lately. I noticed if you set BlockAllInteractions to true then grab the canvas and release it, it will also reset this state back to false. Not sure if this is intended behavior, but it is a bit confusing especially if you expect a canvas to block interaction, but still be allowed to be moved around.

shiftyscales commented 4 months ago

This means that the Facet will be non-interactable when spawned from the inventory.

Do you mean at all? Even after being placed? Or just in the brief moment while it is spawned into userspace before the user picks it up to place it, @Zyzyl?

Not sure if this is intended behavior

I suspect it is by design, @lxw404. E.g. say a canvas had physical touch enabled, and interactions weren't disabled while grabbed- this could result in inadvertently interacting while it is grabbed.

Functionally I don't think this has ever been an issue- as even if it spawns in initially with BlockAllInteractions on- it should still be reset as expected when the user grabs and places the facet.

if you expect a canvas to block interaction

If you expect the canvas to not interact- presumably you just wouldn't include any interactive elements like buttons in the first-place, @lxw404?

lxw404 commented 4 months ago

@shiftyscales Sometimes it's desirable to turn off interactions for certain UI in a world, for example a panel/tablet which you want to selectively turn off its interactivity while it is in a "closed"/"off" state, but you can still physically pick up the object and move it around without worrying about triggering its function, bring it with you and later switch it to "open"/"on" again when you want to actually interact with it. Right now this sort of functionality is sort of broken by this issue.

I do understand the idea of turning off interaction while grabbing but letting go should probably revert to its previous state instead.

Zyzyl commented 4 months ago

This means that the Facet will be non-interactable when spawned from the inventory.

Do you mean at all? Even after being placed? Or just in the brief moment while it is spawned into Userspace before the user picks it up to place it, Zyzyl?

@shiftyscales The Facet's Canvas will have BlockAllInteractions set to True whether it's spawned into Userspace or another world. This state will remain until such time as someone grabs the Facet or otherwise interacts with the Canvas' BlockAllInteractions field.

I can also see that it makes sense that Facets should become non-interactable when grabbed due the Userspace Facet placement mechanics - I'm definitely not asking for that to be removed.

I agree with Lux that there are conceivable situations where a user might want BlockAllInteractions to be true on a Facet even if it has interactable elements (e.g. preventing interaction while some async flux is running). There are probably alternative solutions (e.g. disabling Button components individually), but BlockAllInteractions could be a nice catch-all for that kind of thing. As suggested, it seems like remembering the prior BlockAllInteractions state and then restoring on grab released would make sense.

As for saving, I don't know if it's technically feasible to remember the BlockAllInteractions state (usually false) prior to grab and save the item with that prior state, rather than with interactions blocked. As mentioned in the original post, I agree this is a pretty minor issue so if it'll take substantial or hacky engineering work I think we could probably survive without changing this.