fungus icon indicating copy to clipboard operation
fungus copied to clipboard

Feature Request: Lock Flowchart

Open TheEmbracedOne opened this issue 3 years ago • 11 comments

Is your feature request related to a problem? Please describe. I have a prefab that houses all of my fungus components that is present in all my scenes. When I need to modify a flowchart that is part of this prefab and I enter prefab mode, but if I do that while having selected the flowchart, I need to click the flowchart again while in prefab mode to edit the prefab version of it. Sometimes it happens that I forget this and I end up editing a flowchart accidentally NOT in prefab mode, leading to a lot of cherrypicking stuff to revert/apply to the prefab.

Describe the solution you'd like I'd like there to be a way to lock a flowchart from being edited until the lock is removed; no commands may be modified, no commands may be removed or added, or blocks moved.

This way I could make sure I only edit my flowcharts in prefab mode, but I think the use for this feature is wider range than that, a user may want to lock a flowchart they're finished working on and so on.

TheEmbracedOne avatar Jun 16 '21 18:06 TheEmbracedOne

This should solve your problem https://docs.unity3d.com/ScriptReference/SelectionBaseAttribute.html

You may well do this. Toggle off the invisibility OR lock the object in the hierarchy. This was added since 2019 version image

breadnone avatar Jun 18 '21 09:06 breadnone

but isnt the SelectionBaseAttribute to do with scene view selection?

In the Unity Scene View, when clicking to select objects, Unity will try to figure out the best object to select for you.

I'm not selecting anything in scene view. All I'd like to do is lock the flowchart and all of the scripts on it from editing, so no commands or blocks can be added/removed/edited.

I've found a free asset on the store https://assetstore.unity.com/packages/tools/utilities/editor-aider-the-lost-jigsaw-71306#description and it locks the object in the hierarchy and it prevents me from editing the object's scripts. Unity_kikU6CyFXO

and while it also prevents me from dragging around commands in the Flowchart window on blocks, tMEi8dcJsY

it doesnt stop me from dragging, adding or removing blocks Ibm2XBLNc3

TheEmbracedOne avatar Jun 18 '21 13:06 TheEmbracedOne

I think I may have a solution for this. I'll do some research over the weekend and report back.

Arylos07 avatar Jun 19 '21 13:06 Arylos07

@Arylos07 thanks, I look forward to hearing about your findings!

TheEmbracedOne avatar Jun 19 '21 13:06 TheEmbracedOne

Okay, I definitely have a solution that is pretty lightweight. I'll try and get that added by Monday as a separate pull request.

Arylos07 avatar Jun 19 '21 23:06 Arylos07

#997 Adds this ability now. I feel like it can be a bit jank, but it is the best implementation I can think of without doing anything memory intensive like caching values.

Let me know what you think.

Arylos07 avatar Jun 20 '21 03:06 Arylos07

Cheers @Arylos07 i've added this now, I'll report back if I run into any issues!

TheEmbracedOne avatar Jun 20 '21 17:06 TheEmbracedOne

This has been working wonderfully for the past weeks, I'll close the issue for now.

TheEmbracedOne avatar Jul 08 '21 15:07 TheEmbracedOne

Hi @Arylos07 I lef this message on Discord as well, but I'm leaving it here for transparency:

I've been using your lock flowchart feature ever since you PR'ed in, and I only now ran into a bug with it, where it prevents editing the flowchart itself, I mean the actual Flowchart.cs on the gameobject, it seems like it redraws itself constantly if I try to edit it EVEN if the lock is off. I went back to a version right before I added the PR and the bug is not present there. Could you please take a look at this issue sometime? Thank you

DaIBQH5dSz

Gif added to demonstrate (as soon as I click an editable field or open the inspector window selection thing, it gets redrawn)

TheEmbracedOne avatar Aug 03 '21 19:08 TheEmbracedOne

Actually ignore this, I left this comment on the PR instead! #997

TheEmbracedOne avatar Aug 03 '21 19:08 TheEmbracedOne

Why did you close this? The related pr is still active :)

breadnone avatar Aug 07 '21 12:08 breadnone