Hi everyone,
I'm currently developing a custom Lua script for Moho 14 to automate my shading workflow. My goal is to create a pure, one-click tool that instantly applies specific Layer Shading settings to multiple selected layers without needing to interact with the UI dialogs.
I have successfully accessed and synced most of the Layer Shading properties using the existing API:
fLayerShadingOn
fShadingOffset
fShadingBlur
fShadingContraction
fShadingAngle
fShadingColor
However, I've hit a major roadblock: I cannot find any API methods or properties to toggle the "Inverted" and "Threshold" checkboxes via script.
Here is what I have tried so far:
Brute-forcing property names: I tried setting various logical names using pcall (e.g., fShadingInvert, fShadingInverted, fThreshold, ShadingThreshold, etc.), but none of them worked.
Are these two features simply not exposed to the Lua API yet?
Thanks in advance for any insights!
Missing Lua API bindings for Layer Shading "Inverted" and "Threshold"?
Moderators: Víctor Paredes, Belgarath, slowtiger
-
tiendat414
- Posts: 3
- Joined: Mon Dec 12, 2022 5:04 am
- synthsin75
- Posts: 10472
- Joined: Mon Jan 14, 2008 2:20 pm
- Location: Oklahoma
- Contact:
Re: Missing Lua API bindings for Layer Shading "Inverted" and "Threshold"?
I don't remember what these do:
fShadingNoiseAmp
fShadingNoiseScale
From: https://mohoscripting.com/classes/mohol ... properties
fShadingNoiseAmp
fShadingNoiseScale
From: https://mohoscripting.com/classes/mohol ... properties
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
-
tiendat414
- Posts: 3
- Joined: Mon Dec 12, 2022 5:04 am
Re: Missing Lua API bindings for Layer Shading "Inverted" and "Threshold"?
I also don't know what these two parameters are for. Are they included in these two parameters?synthsin75 wrote: ↑Fri May 15, 2026 11:33 pm I don't remember what these do:
fShadingNoiseAmp
fShadingNoiseScale
From: https://mohoscripting.com/classes/mohol ... properties
- hayasidist
- Posts: 3993
- Joined: Wed Feb 16, 2011 11:12 am
- Location: Kent, England
Re: Missing Lua API bindings for Layer Shading "Inverted" and "Threshold"?
"inverted" means changing the sign of the fOffset value (an AnimVal channel) -- so for example if you have animated layer effects on and you start with an offset of (say) 50 pixels then click the "invert" checkbox at (say) frame 20 - what will happen is that the offset interpolates between 50 and -50 over that 20 frame interval and (assuming a gradual interp mode - i.e. not step) at some point (e.g. frame 10) the offset will pass though zero and that's when the "invert" checkbox will show.
[NOTE: the value in the file, and thus the value that needs to be set by the script, is NOT in pixels - it's converted to moho units - so (depending on your project resolution etc) you might need to set values of, say, 0.05]
However, the shading threshold channel (an AnimBool) does, indeed, not seem to be accessible through the API.
And, curiously, the fShadingNoiseAmp and fShadingNoiseScale that Wes mentioned don't seem to be in the UI for shading (there are other noise settings for the layer) (but are in the API??) and the moho file has them as Value, not AnimVal, in the Layer Shading section???
I've logged an enhancement request.
[NOTE: the value in the file, and thus the value that needs to be set by the script, is NOT in pixels - it's converted to moho units - so (depending on your project resolution etc) you might need to set values of, say, 0.05]
However, the shading threshold channel (an AnimBool) does, indeed, not seem to be accessible through the API.
And, curiously, the fShadingNoiseAmp and fShadingNoiseScale that Wes mentioned don't seem to be in the UI for shading (there are other noise settings for the layer) (but are in the API??) and the moho file has them as Value, not AnimVal, in the Layer Shading section???
I've logged an enhancement request.
-
tiendat414
- Posts: 3
- Joined: Mon Dec 12, 2022 5:04 am
Re: Missing Lua API bindings for Layer Shading "Inverted" and "Threshold"?
I also hope the moho team will soon fix the missing APIs. Honestly, moho software has been great for me; ever since I discovered the scripting feature, it's felt like I've created my own workspace. I feel very sorry that from moho version 13.5 onwards, 3D model support isn't as good as in moho 13. Because sometimes it would be great if moho really supported 3D models well; I think my projects, or others' projects, would have so many more solutions and ways to create animations with moho. Thank you for the explanation.hayasidist wrote: ↑Sat May 16, 2026 1:57 am "inverted" means changing the sign of the fOffset value (an AnimVal channel) -- so for example if you have animated layer effects on and you start with an offset of (say) 50 pixels then click the "invert" checkbox at (say) frame 20 - what will happen is that the offset interpolates between 50 and -50 over that 20 frame interval and (assuming a gradual interp mode - i.e. not step) at some point (e.g. frame 10) the offset will pass though zero and that's when the "invert" checkbox will show.
[NOTE: the value in the file, and thus the value that needs to be set by the script, is NOT in pixels - it's converted to moho units - so (depending on your project resolution etc) you might need to set values of, say, 0.05]
However, the shading threshold channel (an AnimBool) does, indeed, not seem to be accessible through the API.
And, curiously, the fShadingNoiseAmp and fShadingNoiseScale that Wes mentioned don't seem to be in the UI for shading (there are other noise settings for the layer) (but are in the API??) and the moho file has them as Value, not AnimVal, in the Layer Shading section???
I've logged an enhancement request.