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

Traverse composition, layers. getting information

New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

Hi, friends from the Adobe community team and forums. I ran into several problems.

 

1. How to loop through all compositions, layers. The purpose is to get the plugin effect already applied on the layer? Can you give some sample code? It might take you a few minutes but it's like giving me a helping hand.

 

2. How to use DynamicStreamSuite to read and write the parameter string of the plugin according to the effect applied on the layer. (those strings were added using PF_ADD_BUTTON(...)). Because I want to decide the displayed name according to the different actions of the user. It would be nice to have sample code.

 

please.Looking forward to your reply.

TOPICS
How to , Resources , SDK

Views

371

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
community guidelines
Community Expert ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

take a look at the "ProjDumper" sample project. it does exactly that.

Votes

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
community guidelines
New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

Omg I didn't notice such a good example! !
1. So how to modify the text displayed by the parameter? I really want to know. Not in this project. I need a little more time to read this. But I just experienced it, a lot of information is recorded in the .txt generated by the plugin.
2. Also, can .aep files be parsed? Parse into .XML and then parse .XML into .aep . Are there sample projects as well?
3. There is also when a project opens a lower version or a higher version. AE will show which version was created. How does ae determine which version it is? Show that this information is recorded in the .aep file.
Looking forward to your reply.

Votes

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
community guidelines
Community Expert ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

1. AEGP_SetStreamName.

2. there's no API for parsing aep files directly. the AE API only deals with quering the currently open project. i guess xml files should be easy to parse with some trial and error. (except for custom data blocks)
3. that data is stored in the aep file, but as mentioned in clause 2, there's no API for parsing a file, and once AE opened a file there's no trace of which AE version that data originated from.

Votes

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
community guidelines
New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

Follow your instructions. I tried modification. In the project's "PrintAndDisposeStream" function I added:

AEGP_SuiteHandler suites(sP);
AEGP_DynamicStreamSuite1 dynamic_stream; // I wrote
Be
AEFX_CLR_STRUCT(val);

ERR(suites.StreamSuite2()->AEGP_GetStreamName(streamH, FALSE, stream_nameZ));
// The following is also written by me
if (std::strcmp(stream_nameZ, "Gain") == 0)
{
dynamic_stream.AEGP_SetStreamName(streamH, "GAIN");
Be
}

I try to modify it in my judgment. But an exception occurred. Access violation. I seem to have a problem

Votes

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
community guidelines
Community Expert ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

you passed a char string, where it expects an A_UTF16Char string.

lookup "UTF-16" and "wide character".

Votes

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
community guidelines
New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

Ah this. . . , I see what he wants is const A_char. This is essentially char type. Even if I pass:
wchar_t str[] = L"ABCD";
dynamic_stream.AEGP_SetStreamName(streamH, str);
This syntax is wrong. How to modify it?

Votes

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
community guidelines
Community Expert ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

old suite versions used to accept A_char. the newer versions with with A_UTF16Char.

Votes

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
community guidelines
New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

After modification as per your instructions, it is of type A_UTF16Char. I just used AEGP_DynamicStreamSuite1 instead of AEGP_DynamicStreamSuite4
But still crashing abnormally. Or an access violation. Is it wrong to initialize the structure?
Or is it the wrong time to change it? Or is the new string defined incorrectly? . Please indicate
AEGP_DynamicStreamSuite4 dynamic_stream{};

if (std::strcmp(stream_nameZ, "Gain") == 0)
{
A_UTF16Char str[] = { 's' };
dynamic_stream.AEGP_SetStreamName(streamH, str);

}

How can I modify it to make it work properly?

Votes

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
community guidelines
Community Expert ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

you're using an invalid suite pointer which wasn't aquired.

this is wrong:

dynamic_stream.AEGP_SetStreamName

 

this is right:

suites.StreamSuite2()->AEGP_SetStreamName

 

(or whichever suite version you want to use)

Votes

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
community guidelines
New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

That's not right either. There is no AEGP_SetStreamName in suites.StreamSuite2(). I am using the AE 2015 SDK
Are the suites you're talking about here AEGP_SuiteHandler ?

Votes

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
community guidelines
Community Expert ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

then use suites.StreamSuite4().

the sing is to use it from the suires structure, of to aquire it manually correctly.

Votes

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
community guidelines
New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

I made it! Heartfelt thanks! ! !
But there are a few doubts:
How does A_UTF16Char convert to and from std::string? Mainly std::string to A_UTF16Char. In addition, if this parameter modification exceeds the original length, will ae handle it automatically? It won't crash. . .

Votes

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
community guidelines
Community Expert ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

converting an std::string to a utf16 is a rather general c++ issue and not AE specific. there's a lot of data about it on the web, and it has also been discussed here in the forum, so give it a quick search.

 

as for the max size, it's up to you to truncate your strings. use AEGP_MAX_STREAM_NAME_SIZE as your limit (which i think icludes the terminating null in that limit)

Votes

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
community guidelines
New Here ,
Jan 13, 2022 Jan 13, 2022

Copy link to clipboard

Copied

Hi Charming I'm back. I found some ways on the net, but the results are either broken or garbled (non-English).
A_UTF16Char str[AEGP_MAX_STREAM_NAME_SIZE] = { '\u6d12', '\u6d12', '\0'};
This is also garbled. Is there a workaround?

Votes

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
community guidelines
Community Expert ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

on windwos i use:
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;

 

on mac:

NSString *utf8 = [NSString stringWithUTF8String:u8];
uint16_t* utf16 = (uint16_t*)[utf8 cStringUsingEncoding:NSUTF16StringEncoding];

Votes

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
community guidelines
New Here ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

Hi there. I see that your avatar is very kind, like a light in the dark. Thank you for helping me so much. This problem has been solved, but your way is much better than mine. Change to your solution later.
But I ran into the problem again:
1. Modify the parameter display text of a plugin, when I use Ctrl + D to duplicate the layer in AE. The original modified text is changed back to the default text. And tried to modify it here, but it didn't work. What's happening here? I don't understand. . . Is there a solution?
2. Can you use some APIs in the SDK to communicate with external programs (independent exe), or that external programs can regularly obtain and set some layer information parameters, effect parameters, etc. Is this possible?

Votes

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
community guidelines
Community Expert ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

param name changes don't "stick". they don't save with the project and get reset when an instance is re-created (as in the case of copy, where sometimes the original is moved and the copy takes the original place).

to make names stick, you have to check for the need to alter names during UPDATE_PARAMS_UI. that's the only call that will allow you to monitor and change the names without the user seeing the original names.

 

as for communicating with an external program, there's no API for that in AE's sdk, however, it's no different from any other dll. it just an inter process com.

the one thing to notice, is that the dll can only talk to AE during AE calls. meaning, a rnder call or idle call. talking to AE at any other time will result in crashes and project corruption. so communicate with your external program however and whenever you want. but interact with AE only during AE's calls to your plugin.

Votes

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
community guidelines
New Here ,
Jan 15, 2022 Jan 15, 2022

Copy link to clipboard

Copied

Hi, first of all thanks for your reply.

1. But shouldn't the UPDATE_PARAMS_UI issued by the parameter name update be obtained by the target plugin (for example, if the parameter of Example.aex is changed, Example.aex will receive UPDATE_PARAMS_UI), but this and my plugin also cannot receive UPDATE_PARAMS_UI. . . . Do I get UPDATE_PARAMS_UI when other plugins have UPDATE_PARAMS_UI?
2. If an effect is applied to a layer, the applied effect will read the composition and layer information regularly through the timer. This method should be possible, right?

Votes

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
community guidelines
Community Expert ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

LATEST

1. UPDATE_PARAMS_UI is sent only to the layer effects. if the effect who's param names you're changing is not yours where you can have it talk to your AEGP upon receiving UPDATE_PARAMS_UI, then there's not much you can do to ensure immediate name changes. you'll need your AEGP to scan the project on idle hook and look for effect that need treating.

 

2. layer effects don't get regular idle calls (except for cusom UI's, when the effect is selected of the mouse hovers over the param's custom UI). only AEGPs get idle calls and they do not relate to a specific instance. you can scan the current comp or the whole project during an AEGP idle call.

Votes

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
community guidelines