Identify a layer as a master reference

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
User avatar
mkelley
Posts: 1646
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Identify a layer as a master reference

Post by mkelley » Wed Sep 16, 2015 2:28 am

Because references aren't *quite* there yet (I have uncovered a bug that keeps a script I have from working properly in adjusting the master, and if I adjust both the child and the master the reference gets broken with no way to restore it -- it's a switch layer and you can't reestablish such switches) I need to be able to find the master layer for that reference so I can just skip the operation that the child doesn't reflect.

I can find whether a layer is a reference using IsReferencedLayer, but I can't see any way to know what the master layer is -- anyone have a clue?
User avatar
synthsin75
Posts: 7112
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Identify a layer as a master reference

Post by synthsin75 » Wed Sep 16, 2015 3:11 am

I haven't tried, but my guess is that you need:

GetLayerRefInfo(MohoLayerRef &refInfo)

I assume you would use it something like this:

local refInfo = MohoLayerRef:new_local()
moho.layer:GetLayerRefInfo(refInfo)
local masterLayer = refInfo.fLayerUUID

Just guessing, mind you.
User avatar
mkelley
Posts: 1646
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Re: Identify a layer as a master reference

Post by mkelley » Wed Sep 16, 2015 10:14 am

Hmmm, that looks like a pretty good guess, Wes.

I may try it out but I was able to work around most of my issues by ignoring the references that were switch layers -- it's a kludge (and really only for my own workflow) but in my case the switches set width by using styles, so I can just adjust that (and that will adjust things properly on both master and reference).
Post Reply