Highlighted

How to load file into c++ plugin

Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Dear AE fellows,

for my c++ AE plugin to work,

I need to load a special dictionary just once. And then I simply want to call its different elements in the render function.

 

At the moment I simply load this dictionary in my render function (which is extremely inefficient):

 

static PF_Err
Render (
PF_InData *in_data,
PF_OutData *out_data,
PF_ParamDef *params[],
PF_LayerDef *output )
{

 

std::ifstream infile("C:\\dev\\learning\\lesson1\\lesson1\\res\\cmr12.json");

...

}

 

Naturally, the render function simply loads the dictionary "cmr12.json" every frame.

How can I load this dictionary just once, outside render function?

Yaroslav.

 

 

 

Adobe Community Professional
Correct answer by shachar carmi | Adobe Community Professional

global_data is the place to store info that is common for all instances of your effect throughout an AE session. global data doesn't get saved with the project.
sequence_data is the place to store info that is specific to one applied instance of yuor effect, and is not shared by other instances. sequence data can get saved with the project.

TOPICS
SDK

Views

44

Likes

Translate

Translate

Report

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

How to load file into c++ plugin

Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Dear AE fellows,

for my c++ AE plugin to work,

I need to load a special dictionary just once. And then I simply want to call its different elements in the render function.

 

At the moment I simply load this dictionary in my render function (which is extremely inefficient):

 

static PF_Err
Render (
PF_InData *in_data,
PF_OutData *out_data,
PF_ParamDef *params[],
PF_LayerDef *output )
{

 

std::ifstream infile("C:\\dev\\learning\\lesson1\\lesson1\\res\\cmr12.json");

...

}

 

Naturally, the render function simply loads the dictionary "cmr12.json" every frame.

How can I load this dictionary just once, outside render function?

Yaroslav.

 

 

 

Adobe Community Professional
Correct answer by shachar carmi | Adobe Community Professional

global_data is the place to store info that is common for all instances of your effect throughout an AE session. global data doesn't get saved with the project.
sequence_data is the place to store info that is specific to one applied instance of yuor effect, and is not shared by other instances. sequence data can get saved with the project.

TOPICS
SDK

Views

45

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 19, 2020 0
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

global_data is the place to store info that is common for all instances of your effect throughout an AE session. global data doesn't get saved with the project.
sequence_data is the place to store info that is specific to one applied instance of yuor effect, and is not shared by other instances. sequence data can get saved with the project.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 19, 2020 1
Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Thank you, Shachar!

 

I'll try to figure out how this works!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 19, 2020 0
Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Dear Shachar,

I must confess, I'm a bit confused.

 

Suppose I load my dictionary via the function:

json dict()

 

somehere outside main and render functions.

 

(it reads dict file line by line turning it into a json dictionary)

 

Then, in the 

EffectMain()   

 

I load 

 

Render( in_data,
out_data,
params,
output, dict());

 

How do I store  my dict() as a global data ? I looked through sdk, but didn't find instructions.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 19, 2020 0
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

take a look at the "supervisor" sample project, it implements global data.

note that you can put anything you want there. it's just a memory handle, so use as you see fit.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 19, 2020 1
Community Beginner ,
Nov 20, 2020

Copy link to clipboard

Copied

Thank you, Shachar!

I figured it out and now it works!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 20, 2020 0