Make ffglquickstart::Plugin::AddParam return the created param index - #108
Open
vjandrea wants to merge 1 commit into
Open
Make ffglquickstart::Plugin::AddParam return the created param index#108vjandrea wants to merge 1 commit into
ffglquickstart::Plugin::AddParam return the created param index#108vjandrea wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All four
Plugin::AddParamoverloads (source/lib/ffglquickstart/FFGLPlugin.cpp:264-304) already computethe 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 independentlyreconstructing the index, e.g. assuming a fixed add order and counting by hand.
This PR changes the four
AddParamoverloads fromvoidtounsigned int, to return the already-computed index(
param->indexfor theParamFFToverload,new_indexfor 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.