Skip to main content
CLWill
Inspiring
September 16, 2021
Question

Accessing the essentialProperty() function for a Comp

  • September 16, 2021
  • 1 reply
  • 1433 views

I'm having fun with the Essential Graphics panel, and the ability to create reusable components. Coupled with power in expressions, this stuff is amazing.

 

I've run into an issue, though. With the Essential Graphics panel you create "Essential Properties" for a comp. You can reference these with the powerful .essentialProperty() function. Great!

 

The problem becomes that you can only use .essentialProperty() on a layer, not on a comp. But the Essential Properties are a feature of a comp, not a layer. So now I have to somehow reference the parent where the comp is used, then the layer that is the comp I'm in, then the properties. So you end up with:

 

    comp("parentComp").layer(thisComp.name).essentialProperty("whatever");

 

But... there is no parentComp() function. So at run time who knows what the containing Comp is called? And any attempt to reference the .essentialProperty() function on a Comp fails, such as thisComp.essentialProperty() or comp("whatever").essentialProperty(). It has to be a layer, for some reason. Even though essential properties are an element of the comp.

 

Does anyone know a workaround for this? This seems like a huge oversight in the creation of Essential Properties.

This topic has been closed for replies.

1 reply

Mylenium
Legend
September 17, 2021

You have a misunderstanding. Why should/ could there even be such a thing as parentComp(), given that any comp can be used a million times as a sub-comp across different comps and different nesting levels?! See the problem? This would simply cause a logic paradox and that pretty much is a clear reason why there can never be such a function unless they completely change that stuff and e.g. expose the internal IDs/ magic numbers AE uses to check dependencies. So no, there is no way to do any of that, at least at the moment.

 

Mylenium

CLWill
CLWillAuthor
Inspiring
September 17, 2021

Also, I note you've made this very comment a number of times, going back several years.

 

Virtually every object oriented piece of software faces this same issue: class vs an instance of a class. They all have functional capability to resolve this, class code that has the capability to refer to either all instances, or this specific instance of the class. This is not a new problem, either for software or for AE.

ShiveringCactus
Community Expert
Community Expert
September 18, 2021

Well, there's already a lot of "pick whipping" going on, becuase I'm doing this in expressions 🙂

 

The issue I'm facing is that I have an object with a "state" control (hidden, painting, normal, highlighted, and so on). That control is a drop down menu in a "controls" layer.. It also is an Essnetial Property. When the state changes, I do a short animation (paint it, highlight it, whatever). When you keyframe this state changes, I look back at the "last key" get it's time, and do the animation from that. Works locally. Sweet!

 

Yet doesn't work if you keyframe the essential property, because it's another context. OK, so I look at the comp above, find myself as a layer with .layer(thisLayer.name) and do .essentialProperty() on that. Works great. Again, sweet!

 

The problem comes when you want to make this whole thing a reusable object. The top level essential properties are the issue. I don't know (or don't want to have to know) the name of the comp it's used in. And so, it's all broken. This could be solved with thisComp.essentialProperties(). But alas, that doesn't work.

 

All this noise said, you have given me a great idea. I'm going to use a null (actually my control layer) to "store" the last state, and the time of the last state change. I should be able to do the animation off of that.

 

Unless you or someone knows how to have some animation kick off whenever some value changes, that seems to be my best choice.

 

Thanks for the idea. Really appreciate your response.


Might not be an exact solution, but this expression from Dan Ebberts fades a layer based on a keyframe:

fadeTime = framesToTime(20);
s = effect("Slider Control")("Slider");
if (s.numKeys > 0){
n = s.nearestKey(time).index;
if (time < s.key(n).time) n--;
if (n > 0)
linear(time - s.key(n).time,0,fadeTime,100,0)
else
0;
}else
0