bitfocus / companion-module-obs-studio

OBS Studio Module for Companion
MIT License
44 stars 28 forks source link

Option to use variables for selection boxes #239

Closed slords closed 4 months ago

slords commented 1 year ago

Some functions offer a where you can put a variable in but others don't. I'm needing functionality that allows me set most of the parameters using variables instead of dropdowns. Would it be possible to make it so any option could be filled in using a custom variable?

Specifically, I need the following functions to allow variables.

Set Preview Scene (already done) Set Source Filter Visibility (need both Source and Filter) Set Source Visibility (need both Scene and Source) Source Enabled in Scene (need both Scene and Source)

Thanks for your consideration

slords commented 1 year ago

The Set Source Filter Visibility I can work around by using a custom call but the other one I cant.

bryce-seifert commented 1 year ago

I agree that having variables would be helpful in many cases.

This will likely have to wait until https://github.com/bitfocus/companion/issues/2345, as that would be the most straightforward implementation of this instead of having to add a toggle for every action.

MeestorX commented 1 year ago

This is already possible within Companion. My module allows variables in drop-downs for example.

bryce-seifert commented 1 year ago

I know it can be added manually to every action, but with the number of actions in the module I think the more straightforward long term solution is to use something like https://github.com/bitfocus/companion/issues/2345 is discussing.

MeestorX commented 1 year ago

Not sure I know what you mean. The only types that you can't use variable on are numbers and booleans. You were speaking of drop downs, no? If you were, then they (and text fields) already support variables. Maybe you can give an example or explain more what you are looking for?

bryce-seifert commented 1 year ago

I understand they support variables. But that would require adding variable parsing for every option, when the simpler implementation would be Companion-wide the ability to make any field an expression.

I'll look at adding variables for the actions listed above regardless so we can close this out.

slords commented 6 months ago

Any progress on this?

bryce-seifert commented 4 months ago

In the latest Companion beta, you should now be able to type into the dropdown boxes on the requested actions/feedbacks. This will allow you to paste custom variables, and it will parse those when executing. Let me know if you run into any issues

Screenshot 2024-06-02 at 10 01 17 AM
slords commented 3 months ago

This appears to be working well except for one thing. When I use a variable for feedback on a button it isn't being updated when the variable changes. It will update the feedback if I click on the button but it should update any time the variable value changes.

bryce-seifert commented 3 months ago

Got it, I think I know why that is. I will work on a fix.

bryce-seifert commented 3 months ago

@slords This should be fixed in the next module version, 3.6.0, which should be in Companion beta builds by tomorrow.