Use the "Transformations" filter in script

I’m looking for a way to use the Transformations filter in a script, more precisely the Background option.

For now, I’m calling it like this:

transformFilterClass = NSClassFromString("Transformations")
transformFilter = transformFilterClass.alloc().init()
transformFilter.runFilterWithLayer_error_(layer,None )

This is working, except it opens the Transformations panel and I have to press ok for the script to continues to its next task. I can’t find how to just run the filter. I looked at some of @mekkablue’s plugins that use the offset curve filter where I see stuff like this:

def offsetLayer( thisLayer, offset, offset2, makeStroke=False, position=0.5, autoStroke=False ):
  offsetFilter = NSClassFromString("GlyphsFilterOffsetCurve")
    offset, offset2,
    None, None )

But I can’t find offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_error_shadow_() when looking at the methods available for NSClassFromString(“GlyphsFilterOffsetCurve”), I have no clue on how to set up the Transformations filter this way? I don’t find any such method when looking at NSClassFromString(“Transformations”). Where can I look?

The interpolation with background is not easily useable from a script. But the function has only 20 lines or so :wink: I’ll see what I can do.

1 Like

I admit I could write that snippet back then because I had privileged access to the source code. :sunglasses:

Ah, I see, VIPs get to party with secret methods :wink:
I’m going to handle the interpolation with a function instead of the filter then. I initially wanted to use existing tools if possible, but it’s indeed not a lot of additional code anyway.
Thanks guys :v:

I can fish it out tomorrow for you.

1 Like

I added an interpolate function to my script last night so I don’t have to use the Transformations filter anymore :wink:

1 Like