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

Custom Parameter Questions & Workflow Help (SDK)

Engaged ,
Nov 15, 2023 Nov 15, 2023

Hi gang;

 

I am attempting to make my first custom parameter. In particular, I am trying to achieve something pretty much identical to the "Opacity Map" custom ECW paramter found in "CC Particle World", where a user can draw a curve which defines a particle's opacity of it's lifetime. This is what it looks like:

 

opacity_over_life_parameter01.png

 

Despite having carefully reviewed the UI examples that ship with the SDK, I am totally in the blind. The closest example is probable the "Custom_ECW_UI" sample.

 

So I have some questions I could really use some help on for guidance:

 

1 - In order to store the time-dependent values of the curve, I have created a vector array. I am storing the user input in the vector when the user draws the curve. The values are inserted into the vector array in the DrawEvent function.  However, the vector array needs to be global in order to be accessed from the SmartRender function and I keep seeing that global variables are bad. Is this the wrong approach? Is there a different approach I should be using for storing the values?

 

2 - Having stored the user input in the vector array, I need to somehow force AE to re-render from the DrawEvent function. Otherwise, the stored values aren't used unless I do a total purge of "All Memory & Disk Cache". "CC Particle World" works how I want it to work where the input is continually reflected in the render as the user drags the mouse across the parameter window. I need to do the same. Is there a way to force rerender from the DrawEvent in order to see these changes reflect in the render?

 

3 - I am using an "PF_ADD_ARBITRARY2" parameter for the custom parameter. My understanding is that these are parameters that can accept all types of inout like color, position, angles, etc. Is this correct? In my case, I need to store values over time so I'm not using except as simply the drawing panel. Hence why I am using a vector array for storage. 

 

Any help regarding the above questions would be really helpfull, as well as any other pointers or tips which would be highly welcome as I feel like I'm completely in the dark over here!

 

Thanks!

-Richard

TOPICS
SDK
431
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 , Nov 15, 2023 Nov 15, 2023

an arb param is the way to go. it can store any type of data, as long as you write it into one continuous block of memory. depending on your data type, you might need to serialize and deserialize your data when writing or reading to and from the arb. (referred to as "flattening" and "unflattening" in the AE sdk)

once you write your data into the arb param, AE will automatiacally invalidate cached frames and re-render them.

 

so the workflow should be:

user interacts with ui -> data is stored in

...
Translate
Community Expert ,
Nov 15, 2023 Nov 15, 2023

an arb param is the way to go. it can store any type of data, as long as you write it into one continuous block of memory. depending on your data type, you might need to serialize and deserialize your data when writing or reading to and from the arb. (referred to as "flattening" and "unflattening" in the AE sdk)

once you write your data into the arb param, AE will automatiacally invalidate cached frames and re-render them.

 

so the workflow should be:

user interacts with ui -> data is stored in a LOCAL array -> local array is serialized and stored in an arb -> AE sees a new value set to the arb and invalidates the cached frames.

 

before displaying the UI, you should read the value from the arb param, deserialize it into your local array, and then draw accordingly. this way, if the user did some undo/redo operations, they will reflect correctly in the UI.

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
Engaged ,
Nov 15, 2023 Nov 15, 2023

Hi Shachar!

 

Thank you for your informative and helpful reply. That workflow you specified actually makes a lot of sense.

 

By serializing, I'm assuming you mean converting the vector of ints or floats into a string, for example, so that all of it can be passed and held by the arb parameter in its entirety. Then in SmartRender I can grab it and convert it back to int / float and grab the value I need, at the time I need it for. Is this correct?


Understood about reading it and drawing it out at the start of the panel call.

 

Thanks,

Rich

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 Expert ,
Nov 15, 2023 Nov 15, 2023
LATEST

the bottom line is that in order to store the data you need to allocate a an AE mem handle of a certain size, and write all your data into it.

serializing is the operation of taking a dataset, which may be split into separate locataions in ram or with pointers leading to other bits of data, and writing it into one sequential piece of memory.

you don't need to convert it to a string... whichever method collecting your data on the way in, and reconstructing it on the way out works for you.

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