bitfocus / companion

Bitfocus Companion enables the reasonably priced Elgato Streamdeck and other controllers to be a professional shotbox surface for an increasing amount of different presentation switchers, video playback software and broadcast equipment.
http://bitfocus.io/companion
Other
1.46k stars 489 forks source link

Custom Variable within a Button #2827

Closed josh-justjosh closed 2 months ago

josh-justjosh commented 2 months ago

Is this a feature relevant to companion itself, and not a module?

Is there an existing issue for this?

Describe the feature

At present there can be a lot of repetition within the creation of buttons. I'd like to have the ability to have input fields that can then be used throughout a button's actions and feedbacks. Perhaps within the button editor, there would be a place to input the variable. Potentially reusing the existing Custom Variables UI either in the top area of the button editor (see mock up below) or as a tab with Actions and Feedbacks.

In Head

This kind of links with https://github.com/bitfocus/companion/issues/1909 where people are suggesting introducing variables of the button being accessed as $(button:variable)

Obviously, a current workaround is to just create custom variables in the existing variables interface. However, that creates a lot of clutter and isn't as streamlined as being linked specifically to the button

Usecases

I primarily use companion with vMix. When programming buttons, I will often start with one and copy and paste it to create buttons for different inputs. I will often be setting the input number in the button's text, one or two actions and then one or two feedbacks. When copying this button for different vMix inputs, each of these fields needs updated. It'd be useful to have the ability to just have one place per button to change a variable that all the fields referred to.

Julusian commented 2 months ago

I have been thinking of doing something similar to this, but my thinking was to provide 'local variables'/'local expressions' within a button. I was thinking that wouldn't be settable in the same way that custom variable are, instead designed to be set by the user configuring the button and referenced elsewhere within the button just like normal variables. Do you think these variables need to be settable through actions?

But unfortunately this is blocked by the same underlying limtation as #1909.

the way that modules parse variables does not let companion know any context for that. Due to the async nature of modules in 3.0, there isnt a way to directly tie variable parsing to an action execution without updating modules to support it. It is a fairly simple change to make in modules, but means that it will also be up to the module to parse in the correct way to support it.

We are getting closer to wanting to start pushing for modules to support this (now that there are the $(this:....) variables), I have a feeling there was something else I wanted to look into before doing that though

In fact, this might be pretty much the same thing as the last comment there https://github.com/bitfocus/companion/issues/1909#issuecomment-1588176862

dnmeid commented 2 months ago

Although this request is not 100% the same as #1909, I think it is close enough. Especially if you see that the comments there already suggest extending local variables to be also settable and being variables not just reflecting other state. So I'm closing this as a duplicate and would encourage you to rather add requests for extended functionality to #1909.

josh-justjosh commented 2 months ago

Thanks for your comments, I'll throw a summary in #1909 for easier reference