Copy link to clipboard
Copied
Hi all,
I'm trying to fix a bug I have with my extension.
It consists of 2 panels. One is the Main panel.
The other is an Invisible panel that dispatches an event to the Main panel. This way I can set up a shortcut that opens the Invisible panel and triggers a function in the Main panel.
The Invisible panel runs this code
(function copyFunction () {
'use strict';
var csInterface = new CSInterface();
var event = new CSEvent("copyShortcut", "APPLICATION");
event.data = "Copy";
csInterface.dispatchEvent(event);
csInterface.closeExtension();
}());
...and it works almost fine. The last command csInterface.closeExtension() though, often freezes After Effects for a few seconds (sometimes takes longer, sometimes it doesn't even freeze), which makes the whole shortcut trick a pain in the ass.
I've noticed a couple of things though.
First one: if in the manifest file I change these settings for the Invisible panel from
<AutoVisible>false</AutoVisible>
<Type>Custom</Type>
to
<AutoVisible>false</AutoVisible>
<Type>Panel</Type>
...nothing freezes! It runs very smooth. Nice! The drawback is that the Invisible panel is not invisible anymore. It quickly appears then disappears.
Moreover, if I keep this settings
<AutoVisible>false</AutoVisible>
<Type>Custom</Type>
and remove the line
csInterface.closeExtension();
the first time I open the panel it performs well (and it's invisible), but the second time (as its already open) it doesn't trigger the function (as expected) and becomes visible!! If I try to manually close it, the panel disappears but it's actually still open.
There is no way to both keep the panel invisible and close the panel without freezing AE.
Any help?
I was thinking about leaving the Invisible panel always open and find a way to trigger a function when onfocus or something... any ideas?
No worries Justin,
I've solved the problem!
I've created a jsx file to be put into the script folder that sends an event to the main CEP panel. Much easier and probably faster, as it doesn't require any html.
I just didn't know that it is possible to dispatch an event without using the csInterface module.
Copy link to clipboard
Copied
Was just going to ask, why not leave it open? If you need to constantly open and close it, would be more performant to just leave it open in the background.
Copy link to clipboard
Copied
No worries Justin,
I've solved the problem!
I've created a jsx file to be put into the script folder that sends an event to the main CEP panel. Much easier and probably faster, as it doesn't require any html.
I just didn't know that it is possible to dispatch an event without using the csInterface module.
Copy link to clipboard
Copied
I didn't want that panel because all it does is sending the event to the main panel. It doesn't have any other use.
Copy link to clipboard
Copied
Nice, yea that's a more simple solution!
Copy link to clipboard
Copied
It does sound like a CEP bug though.