Developers can monitor parameter changes using a call-back mechanism, by overriding the PBAccessor class. This allows continuous monitoring of the parameter change. PBAccessor has two methods PBAccessor::Get() and PBAccessor::Set(). In the bend modifier in the below example, the function Set() has been used to check the values of bend_from and bend_to.
PBAccessor::Set() is passed a PB2Value structure which holds the data being changed and an ID of the parameter changing. The following PBAccessor changes the value of bend_from and bend_to depending on a comparison of each other.
class bendPBAccessor : publicPBAccessor { public: voidSet(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) { BendMod* u = (BendMod*)owner; IParamMap2* pmap = u->pblock2->GetMap(); floatfrom, to; switch(id) { case bend_from: u->pblock2->GetValue(bend_to,t,to,FOREVER); from = v.f; if (from >to) { u->pblock2->SetValue(bend_to,t,from); } break; case bend_to: u->pblock2->GetValue(bend_from,t,from,FOREVER); to = v.f; if (from>to) { u->pblock2->SetValue(bend_from,t,to); } break; } } };