Global namespace to attach objects on?
Hi! Thanks for making this boilerplate, this is a great setup.
I'm trying to wrap my head around the communication between extendscript and cep javascript. Do you know if there's a way to directly attach an extendscript object (like a composition item from after effects) directly to a global object that would be accessible from both extendscript and cep javascript? So that a lot of the logic, classes and types could stay on the cep side and just the commands go on the extendscript side?
Here's a simplified version of what I'm trying to do. The last part, when I'm trying to send comp, the item that gets sent doesn't seem to really transport the real comp item. I'm not sure about how this can be resolved or if the way I'm going about it is just wrong.
var comp = null;
var folder = null;
evalTS("createComposition", {
id: "1",
data: {
name: "Composition",
width: 1920,
height: 1080,
pixelAspect: 1,
duration: 10,
framerate: 24,
},
}).then((res) => {
comp = res;
});
evalTS("createFolder", {
id: "1",
data: {
name: "folder",
},
}).then((res) => {
folder = res;
evalTS("addItemToFolder", {
item: comp, // What's going on here? This should be a compItem since this is what is returned from createComposition
folderName: "folder", // we have an extenscript function finding the item by name
});
});