Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to write the generate_key for the compute cache api

Community Beginner ,
Mar 09, 2023 Mar 09, 2023

Hi everyone. 

We are starting to move to MFR rendering using the new cache api.

in the example given in the SDK, they tell use to use the aegp-hashsuite1 to compute hashes in the generate key function of the AEGP_ComputeCacheCallbacks.

https://ae-plugins.docsforadobe.dev/effect-details/compute-cache-api.html#aegp-hashsuite1

 

however to use the aegp-hashsuite1, we need the AEFX_SuiteScoper that needs in_data pointer.
How are we suppose to do that since the generate_key does not have in_data pointer in its parameters? i hope it s not supposed to be a global variable...

 

TOPICS
SDK
548
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 10, 2023 Mar 10, 2023

good question. in the function below you can see that aquiring a suite requires only SPBasicSuite. the macros requiring in_data do that only for general usage convenience. the value of SPBasicSuite  doesn't change thourghout a session, and indeed some SDK samples show putting SPBasicSuite in a global valriable.

 

however, if you'd like a cleaner solution, you can see that all compute cache callbacks are given a AEGP_CCComputeOptionsRefconP arg. during AEGP_ComputeIfNeededAndCheckout or AEGP_Chec

...
Translate
Community Expert ,
Mar 10, 2023 Mar 10, 2023

good question. in the function below you can see that aquiring a suite requires only SPBasicSuite. the macros requiring in_data do that only for general usage convenience. the value of SPBasicSuite  doesn't change thourghout a session, and indeed some SDK samples show putting SPBasicSuite in a global valriable.

 

however, if you'd like a cleaner solution, you can see that all compute cache callbacks are given a AEGP_CCComputeOptionsRefconP arg. during AEGP_ComputeIfNeededAndCheckout or AEGP_CheckoutCached you can pass a struct that contains relevant caching data, AND a pointer for SPBasicSuite. i would not pass a pointer for in_data, as that pointer is valid only for the duration of a single AE call.

if you'd like to use the suite handling macros, you could create a local copy of the in_data struct and assign the passed value of SPBasicSuite into it's pica_basicP member.

 

 

PF_Err AEFX_AcquireSuite( PF_InData *in_data, /* >> */
PF_OutData *out_data, /* >> */
const char *name, /* >> */
int32_t version, /* >> */
const char *error_stringPC0, /* >> */
void **suite) /* << */
{
PF_Err err = PF_Err_NONE;
SPBasicSuite *bsuite;

bsuite = in_data->pica_basicP;

if (bsuite) {
(*bsuite->AcquireSuite)((char*)name, version, (const void**)suite);

if (!*suite) {
err = PF_Err_BAD_CALLBACK_PARAM;
}
} else {
err = PF_Err_BAD_CALLBACK_PARAM;
}

if (err) {
const char *error_stringPC = error_stringPC0 ? error_stringPC0 : "Not able to acquire AEFX Suite.";

out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE;

PF_SPRINTF(out_data->return_msg, error_stringPC);
}

return err;
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 12, 2023 Mar 12, 2023
LATEST

I see. As always you have the answer ^^.

i was puzzled that the sample in the documentation used in_data as if it was available. also they talk about an AutoColor sample that is not in the sdk... 

But yes, we only need the pica_basicP to workout the suites.

Thank you for the answer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines