I’m attempting to create objects into a group, but mask.addChild() doesn’t work (“Plugin made a change outside the current edit context”).
I have been trying to access the mask several ways, but none of them work.
See second to last line in code here
// rename current selection let frame = selection.items frame.name = 'mask' // create first element const rect1 = new Rectangle() rect1.name = 'rect1' rect1.width = 100 rect1.height = 200 rect1.fill = new Color('red') selection.insertionParent.addChild(rect1) rect1.moveInParentCoordinates(10,20) // bring original frame to the front selection.items = [frame] commands.bringToFront() // mask rectangle with frame selection.items = [frame,rect1] commands.createMaskGroup() // from now on, use mask as reference point let mask = selection.items mask.name = 'Timeline' console.log('is mask a group?', mask instanceof Group); // create another rectangle and add it into the mask const rect3 = new Rectangle() rect3.name = 'rect3' rect3.width = 20 rect3.height = 22 rect3.fill = new Color('lime') mask.addChild(rect3) // THIS LINE rect3.moveInParentCoordinates(75,100)