[Closed] [SDK] Save/Load custom IParamBlock2
I have some custom parameter blocks that I manage myself, in my plugin’s data structure.
Since I don’t expose them to max as references, I need to save/load them manually.
However, when I run:
customPblock->Save(isave);
when my plugin saves and then run:
customPblock->Load(iload); //after creating it and initializing it with MakeAutoParamBlocks, etc
…the parameter block becomes corrupt or something. I can retrieve the proper values from it using:
customPblock->GetValue(....)
and it returns loaded values correctly. However, when I map it to a rollout using CreateRWParamMap2, all the controls are empty and they flicker the whole UI when modified. Everything works fine as long as I never call “->Load” on the pblock, so I know it’s not a problem with the initialization of the pblock, just the loading of it from the saved data.
Is “->Save” and “->Load” not implemented properly on a pblock? When max auto-saves parameter block references does it use a different set of functions?
So, on closer inspection I discovered that after loading the saved parameter block, the ParamBlockDesc2 of the block was getting reset to default (prior to loading the ParamBlockDesc2 was fine, so the load function literally clears it out).
By running “SetDesc” on the plock, after loading it, and assigning the original ParamBlockDesc2 back to it, everything works.
Seems counter intuitive, but whatever.