Yellow-Dog-Man / Resonite-Issues

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

Add OnSelected and OnDeselected nodes #2495

Open ExoTheWicker opened 2 weeks ago

ExoTheWicker commented 2 weeks ago

Is your feature request related to a problem? Please describe.

Currently there is no way of telling is a slot (item) is selected.,

Describe the solution you'd like

Add nodes for when a slot it selected and deselected

Describe alternatives you've considered

None.

Additional Context

No response

Requesters

ExoTheWicker, Tmmydale1

ProbablePrime commented 2 weeks ago

By selected do you mean:

Also, What would you like to use this for?

ExoTheWicker commented 2 weeks ago

Both gizmo and inspector

TisFoolish commented 2 weeks ago

I personally can see this being used as part of a system for tutorializing how to build things in Resonite. Being able to tell when a specific object is selected would be extremely useful for such things.

We could also create items that have an "edit" mode (not to be confused with Edit Mode), reacting to being selected. There are both a bunch of fun, dumb memes that could be made with such nodes, as well as general effects and reactive items. I imagine someone like Rusty would make their avatar physically 'open up' when they select a part of themselves.

Alternatively, having a dev tool tip being able to return when it selects/unselects an object and what object it selected would allow me to build some niche accessibility things for myself.

JackTheFoxOtter commented 2 weeks ago

I'm not sure I'm a big fan of this. Generally, editing something with the inspector should be kind of a transparent operation to the world. The object's state shouldn't change when it is opened in the inspector. This could lead to a lot of highly confusing behaviour when debugging something. Even when there are dedicated nodes for it, it's still a state change.

TisFoolish commented 2 weeks ago

The object's state shouldn't change when it is opened in the inspector.

Shouldn't that be up to the creator of said object?

JackTheFoxOtter commented 2 weeks ago

I wouldn't say so, this is a bit of a fundamental of how the editing system works. If you want to make a tutorial like system, I'd heavly suggest doing it the other way around, modifying the tool / inspector to add custom selection behavior. I don't think the object itself should know or change whatsoever when it's selected. That's not really something the object knows right now to begin with. Selection is handled by the thing that does the selection, not by the thing that gets selected.

From a different perspective, this could also be very abusive, for example a malicious piece of code that obfuscates / hides / deselects itself when it gets selected.

TisFoolish commented 2 weeks ago

That's not really something the object knows right now to begin with.

Because that state is not exposed, which is what this request addresses. Not exposing it because it's not exposed is circular logic.

this could also be very abusive, for example a malicious piece of code that obfuscates / hides / deselects itself when it gets selected

You can already do that through refhacking. It's harder, but not impossible. And while yes, you can create code malicious code that makes selecting it harder, it wouldn't be impossible. It'd be a low grade "well that's annoying" moment.

And guess what? If your concern is malicious code, we shouldn't have access to flux in the first place because there are a lot worse things we can already do. The possibility of maliciousness is very low compared to a lot of things we can already do with Flux.

JackTheFoxOtter commented 2 weeks ago

RefHacking is not supported. If this was added, this would be officially supported, and I'm not sure I like the idea of the editing system no longer being transparent to the objects being edited. But I've voiced my concerns, no need to argue.

shiftyscales commented 2 weeks ago

Can you provide additional context on the issue you're trying to solve for, and why you want to determine if an object / slot is being inspected / selected / deselected, @ExoTheWicker?

Having more information on what you're trying to do would help us better understand the issue and how best to resolve it.

ExoTheWicker commented 2 weeks ago

Can you provide additional context on the issue you're trying to solve for, and why you want to determine if an object / slot is being inspected / selected / deselected, @ExoTheWicker?

Having more information on what you're trying to do would help us better understand the issue and how best to resolve it.

I think it would be useful for a couple of reasons

  1. For providing educational/tutorial items for users
  2. Allowing users to have access to this could be used in creating effects for when an item is selected
  3. It Could allow users to make their own asset protection systems.
shiftyscales commented 2 weeks ago

It Could allow users to make their own asset protection systems.

That's why I was curious- that part of your request would be better handled by other issues like hardening the permission system #1103.

Nytra commented 2 weeks ago

This might be solved by https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/599

TisFoolish commented 1 week ago

Another thing that would make use of an OnSelected node is being able to toggle on a debug UI for the object selected. EG I could add in a system that when I select a specific slot on my avatar and no one is in it, it displays specific info and fields about the various systems I have built in.