snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.59k stars 291 forks source link

New Feature: Lockable flowchart #997

Open Arylos07 opened 3 years ago

Arylos07 commented 3 years ago

Description

Added an update to the flowchart window and editors so flowcharts can be locked, preventing editing.

What is the current behavior?

Currently, when working with flowchart prefabs and defaults, you may want the flowchart to not be editable at least not without needing to. This can also be useful for tracking what flowcharts are done and not.

Issue Number: #992

What is the new behavior?

Clicking on the padlock icon in the flowchart window (or "lock flowchart" in the flowchart inspector) will lock the flowchart. It will not keep the flowchart in the editor window, unlike locking an inspector, but will prevent the blocks, commands, metadata, and variables from being changed. However, you can still scroll through commands to view them and move through the flowchart freely. It does work by greying out the properties, however. Will edit later if needed.

ezgif-3-5d24a5c22987

In the future, the flowchart window can be adjusted to also lock on one flowchart, not changing if another is selected. However this will only be useful when multiple flowchart windows can be opened at once; a feature that seems to be missing for now.

Important Notes

So far, no breaking changes have been found and it should also merge with #996 with how I edited the code. One main issue is that users may see the padlock and think it locks the flowchart in that window when it does not; only locks editing of it. This will be addressed when multiple flowchart windows can be open, at which point an additional behaviour will be added.

Other information

Important: because I did a silly, this PR includes changes from PR #934 which contains an optional boolean to Writer Audio. When merging this branch, 934 can be deleted as this already contains it. (as usual)

Arylos07 commented 3 years ago

Resolved a merge conflict with CommandListAdaptor after my last changes were merged. I saw this coming so it was simple.

TheEmbracedOne commented 2 years ago

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 commented 2 years ago

Can confirm the fix submitted fixes my issue! Thank you again @Arylos07