Linking Mask Paths with script

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Ed Smith
Posts: 19
Joined: October 22nd, 2007, 3:57 am
Location: Dublin, Ireland
Contact:

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?
It's not the dog in the fight, it's the fight in the dog that matters.
Klustre
Posts: 21
Joined: July 27th, 2011, 2:53 am

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.
Ed Smith
Posts: 19
Joined: October 22nd, 2007, 3:57 am
Location: Dublin, Ireland
Contact:

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.
It's not the dog in the fight, it's the fight in the dog that matters.
Ed Smith
Posts: 19
Joined: October 22nd, 2007, 3:57 am
Location: Dublin, Ireland
Contact:

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.
It's not the dog in the fight, it's the fight in the dog that matters.
Klustre
Posts: 21
Joined: July 27th, 2011, 2:53 am

You actually already used it in your expression on the mainComp. But for the newMask:

Code: Select all

newMask.name = "Hullo";
Ed Smith
Posts: 19
Joined: October 22nd, 2007, 3:57 am
Location: Dublin, Ireland
Contact:

ugh. Thanks for that Klustre, no coffee yet this morning.
It's not the dog in the fight, it's the fight in the dog that matters.
Post Reply