Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: New 'hidden' variable type #121

Open
DT-is-not-available opened this issue Feb 21, 2023 · 1 comment
Open

Suggestion: New 'hidden' variable type #121

DT-is-not-available opened this issue Feb 21, 2023 · 1 comment

Comments

@DT-is-not-available
Copy link

Adding a 'hidden' variable type to the internal Variable class, that functions identical to a regular scratch variable, but is hidden from the variable list entirely. Why? Extensions would be able to more easily store values inside a project that are used often, for example:

_stageTarget.createVariable('cameraX', 'cameracontrols.cameraX', 'hidden', false)

Then the extension could provide custom reporters or blocks for interacting with these variables, or store them internally for some other purpose, and the value is saved with the project.
There is a rather hacky workaround as of right now, however I do not know of possible dangerous effects of saving and loading variables with this property, and it would be nice to have this available as an actual feature:

_stageTarget.createVariable('cameraX', 'cameracontrols.cameraX', '', false)
_stageTarget.variables.cameraX.type = 'hidden'

The workaround works but upon loading a project with 'hidden' variables, the variables discard the custom property which requires them to be reset on project load, which still ends up showing them in the toolbar until it gets reloaded.

If there is already a way to store extension variables, please tell me, I'm typing this in a frenzy at 1 in the morning so I might have missed something or explained poorly.

@FurryR
Copy link

FurryR commented Nov 2, 2023

util.target.extensionVar = new Map()

is much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants