Skip to content

vtkSMTransferFunctionPresets become a singleton

Rationale : it was possible to have multiple instance at some point. (typically, the pqChoosePresetReaction, through a pqSavePresetDialog, has a long-live vtkSMTransferFunctionPresets instance) But as they used to ignore each other and write the preset file in the destructor, modifying both instance was not well supported (in fact, file will represent the last destroyed one).

Now it is a singleton, so no more sync problem. Two new methods were added to force the writing (SaveToFile()) and the reading (ReloadPresets()) of the preset file, if needed.

Use case: I'm working on adding preset mechanism to ChartSeries (see wip !3589 (closed)), and I faced this problem were the ColorMap editor handles a vtkSMTransferFunctionPrests instance and the SeriesEditorPropertyWidget handle a second one.

Edited by Nicolas Vuaille

Merge request reports