Skip to content

Make ffglquickstart::Plugin::AddParam return the created param index - #108

Open
vjandrea wants to merge 1 commit into
resolume:masterfrom
vjandrea:fix/issue-69-addparam-return-index
Open

Make ffglquickstart::Plugin::AddParam return the created param index#108
vjandrea wants to merge 1 commit into
resolume:masterfrom
vjandrea:fix/issue-69-addparam-return-index

Conversation

@vjandrea

Copy link
Copy Markdown

All four Plugin::AddParam overloads (source/lib/ffglquickstart/FFGLPlugin.cpp:264-304) already compute
the index where a new param is stored at, and use it internally to register the param with the host, then they discard it.
That leaves a caller with no way to learn a param's index afterward, so they can't call the inherited
CFFGLPluginManager::SetParamGroup/SetParamDisplayName (both index-keyed) without independently
reconstructing the index, e.g. assuming a fixed add order and counting by hand.

This PR changes the four AddParam overloads from void to unsigned int, to return the already-computed index
(param->index for the ParamFFT overload, new_index for the other three). Existing call sites keep compiling and behaving identically whether they capture the return value or not, so this should be 100% backwards compatible.

Fixes #69.

All four AddParam overloads already computed the index a new param
lands at, then discarded it. Without it, callers can't use inherited
CFFGLPluginManager calls like SetParamGroup/SetParamDisplayName,
which take that index. Widens the return type from void to
unsigned int; no other logic changes.

Fixes resolume#69.
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

Successfully merging this pull request may close these issues.

FFGLPlugin - SetParamGroup unusable because it need a param index

1 participant