Notifications
Clear all

[Closed] PBAccessor::Set WTAF

these lovely snippet from the sdk help

This method is called when IParamBlock2::SetValue is called on parameter 'id', and the parameter value being set is v. This is called just before calling SetValue() on the parameter's controller, so it can take note of the value going in and change it if desired.

{} Notes: The content of 'v' is the value being set on the IParamBlock2 parameter, and can be changed by this Set method. If you get the value of the parameter from the parameter block from within the Set method, whether the value returned will be the existing value or the new value varies by parameter type and whether the parameter is animatable. For parameter types that correspond to data types such as float, integer, and point3, the Set method is called before the parameter block parameter is set unless the parameter block parameter is already animated or setting the value would cause it to be animated. If the parameter block parameter would remain constant after the set, the Set method is called after the parameter block parameter is set.

so in a nutshell “if the value has changed it’s already set in the parameter block, if it’s unchanged then it’s not been set”

absolutely fucking useless to man or beast

class GradTintMod_PBAccessor : public PBAccessor
{
public:

	void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)    // set from v
	{
		GradTintMod* mod = (GradTintMod*)owner;
		if(mod != NULL)
		{	
			switch (id)
			{
				case kgradtint_mapchannel: // keep low less than high
				{
					mprintf(_T("current value = %d  newvalue = %d\n"), mod->pblock->GetInt(kgradtint_mapchannel), v.i);
					break;
				}
			}
		}
	}
};

any guesses to the output of the above code ? (and it isn’t animated btw )