Using the new AEFX_SuiteScoper Template Class
Do folks know about AEFX_SuiteScoper?
I was poking around in AEGP_SuiteHandler.h last night (as you do), and this comment at the top caught my eye:
/** AEGP_SuiteHandler.h
DEPRECATED:
This way of doing things is out of date. See AEFX_SuiteHandlerTemplate.h for the
new way of doing things.
-kjw 2/28/2014
There's no mention of this "new way of doing things" in the SDK documentation, in fact it still instructs you to use AEGP_SuiteHandler suites(in_data->pica_basicP);
However this new template class looks to be much better. For one thing it will be faster and more economical, since you're only loading the suite you want; AEGP_SuiteHandler loads all of the available suites in one go and that can cause slow down if you're acquiring suites in an iteration (which you wouldn't do, of course, right?
). It also means you can get fast, C++-style access to the suites that aren't available using AEGP_SuiteHandler, such as PF_WorldSuite2 and the param suites, including PF_AngleParamSuite1, and not have to worry about disposing of them later. In fact I was looking into writing an "Extra_SuiteHandler" class to load these particular suites that made me stumble upon this new class).
So we go from the rather clunky C-style:
PF_WorldSuite2 *wsP = NULL;
ERR(AEFX_AcquireSuite(in_data, out_data, kPFWorldSuite, kPFWorldSuiteVersion2, "Couldn't load suite", (void**)&wsP));
// Do stuff with WorldSuite2
ERR(wsP->PF_GetPixelFormat(input, &format));
// Don't forget to dispose!
ERR2(AEFX_ReleaseSuite(in_data, out_data, kPFWorldSuite, kPFWorldSuiteVersion2, "Couldn't release suite"));
To this shiny new C++ style:
AEFX_SuiteScoper<WorldSuite2> ws(in_data, kPFWorldSuite, kPFWorldSuiteVersion2);
// Do stuff with WorldSuite2
ERR(ws->PF_GetPixelFormat(input, &format));
// No need to dispose!
Much better! Time to rewrite my plugins!
