"Intensity" setting for each setting (similar to opacity multiply)

I’ve realized a fairly common issue I’ve had is that all inputs are “added up” (mypaint-mapping.c:184). So, if you want to control the “intensity” of an effect, you have to try to create a mapping that will reverse the setting by way of adding or subtracting values. This can be impossible in many cases, for instance, when trying to attenuate a random input. Or, you might end up with large negative values when really you just want to arrive at zero.

My first thought was to have a dropdown for each input that lets you specify the operator (add/mult) but then you’d have to consider order of operations (PEMDAS), not to mention changing data models and GUI, etc etc. Then I remembered multiply opacity setting that already does what I’m talking about, but only for opacity (mypaint-brush.c:615). So I’m thinking if we could just programmatically create an additional setting for every setting, lumped under its own category called something like “Intensity”. As an aside, it’d be great if the setting “group” was part of libmypaint instead of mypaint gui.

So, is it possible to create settings on-the-fly? Or, should I just edit brushsettings.json and create all of these manually? Or can anyone think of a better way to handle this kind of “intensity” setting? I’m also not sure how the multiply should affect the base value. Should the base value be preserved so that even if you multiply by zero the greater of the two values is used? I think that might make more sense, so that it is only controlling the intensity of the effect of all the inputs, not the base value.

I think this sounds like a good idea. For me, the best way to specify it would be if the GUI was changed such that at the top (or bottom) you could specify a formula for how you want to combine the inputs. Like, for example, you might want the opacity to be controlled by:

(fine_speed + pressure) * random + other

where “other” is parsed and translated into a sum of the remaining legal parameters not found in the string. The end result can then be compiled into a function to be evaluated.

That would be really flexible and nice if it was hidden under an advanced section. Maybe “other” doesn’t need to be specified and it can just be implied that any other inputs would be “added on”. All of that is way beyond my skills, sadly, so for now I’m just adding a few new settings manually. I realized not every setting needs an intensity setting so having a programmatic way to create them might not be necessary.