Page 1 of 1

Linking Mask Paths with script

Posted: November 21st, 2012, 7:54 am
by Ed Smith
I'm trying to link 2 mask paths together inside my script. Here's a snippet of what I've got so far:

Code: Select all

newMask = LayerGrad.Masks.addProperty("Mask");
newMask.maskMode = MaskMode.NONE;
newMask.maskPath.canSetExpression = true;
newMask.maskPath.expression = "comp(\"" + mainComp.name +"\").layer(\"CE Character Grade Master Controls\").mask(\"Mask 1\").maskPath"
I'm getting the error: "Unable to set "canSetExpression". It is a readOnly attribute.

When I link the mask paths manually they work fine, I'd just like to get it all done via the script. Anyway around this issue?

Re: Linking Mask Paths with script

Posted: November 21st, 2012, 8:36 am
by Klustre
The error refers to:

Code: Select all

newMask.maskPath.canSetExpression = true;
You're trying to set this, while it's read only. You could use it in an if statement with double equals (==) to check if you can set the expression. But if you're the only one to use it, you know the path can take an expression, so you might as well leave the line out.

Re: Linking Mask Paths with script

Posted: November 22nd, 2012, 2:10 am
by Ed Smith
Super duper. I just took out the read only line and it works. Surely it IS true though and wouldn't make that much difference? I guess mask paths can only have certain expressions attached so maybe it's only half true.

Thanks for the help.

Re: Linking Mask Paths with script

Posted: November 22nd, 2012, 2:47 am
by Ed Smith
Can't figure out how to rename the masks after they're created. I'd rather not have have them called "Mask 1" and "Mask 2" if possible. Can't seem to find anything in the scripting guide about accessing that attribute. Tried looking at TrackerViz and a few other scripts to see how they're doing it but can't figure it out.

Re: Linking Mask Paths with script

Posted: November 22nd, 2012, 2:55 am
by Klustre
You actually already used it in your expression on the mainComp. But for the newMask:

Code: Select all

newMask.name = "Hullo";

Re: Linking Mask Paths with script

Posted: November 22nd, 2012, 3:25 am
by Ed Smith
ugh. Thanks for that Klustre, no coffee yet this morning.