*UPDATED 3/1/19* Layer Shortcuts tool

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

Very nice tutorial, Dennis. Thank Sienna for me, for the great shout out.

The only other tip I'd give anyone landing here is that the workspace button layer (or group, if the first) is selected when you create the button. So you can immediately reposition your button, use that shortcut to get back where you were, and be ready to select the next layer (maybe using the arrow keys in Layer Shortcuts) and make your next button.


BTW, Dennis, Earnest, as I have the time and brain cells (new job is pretty mentally taxing), I'm researching what I'd need in a EULA.
rocken
Posts: 28
Joined: Wed Mar 21, 2018 1:30 am

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by rocken »

synthsin75 wrote: Thu Apr 25, 2019 1:03 am Very nice tutorial, Dennis. Thank Sienna for me, for the great shout out.

The only other tip I'd give anyone landing here is that the workspace button layer (or group, if the first) is selected when you create the button. So you can immediately reposition your button, use that shortcut to get back where you were, and be ready to select the next layer (maybe using the arrow keys in Layer Shortcuts) and make your next button.


BTW, Dennis, Earnest, as I have the time and brain cells (new job is pretty mentally taxing), I'm researching what I'd need in a EULA.
Thanks for the wonderful Script but i was wondering if it could be possible to create a script to space layers apart with the figures inputted by the user?..In other words, an alignment script to add distribution functions???? If that cant fly , pls what of a script to snap the bezier handles to a perfect angle? please forgive me for if if i have bothered you
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Yeah, I wish Moho had better alignment tools for both layers and shapes.

There actually are handy layer Alignment options that appear when you select multiple layers. It works but unfortunately it doesn't include Distribution options that would complete this feature.

Alternatively, you can use Grid with Snap enabled (which I use for Smart bones all the time,) but unfortunately there is no Global Mode for the Grid that works across all layers.

I put in requests for these features a while back and I last heard the developers were looking into at least part of the requests. Hopefully, we'll see some improvements for alignment options in the future.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

rocken wrote: Wed Jun 19, 2019 6:26 am Thanks for the wonderful Script but i was wondering if it could be possible to create a script to space layers apart with the figures inputted by the user?..In other words, an alignment script to add distribution functions???? If that cant fly , pls what of a script to snap the bezier handles to a perfect angle? please forgive me for if if i have bothered you
All that is possible with Moho scripting, but probably not high on my personal priority list.
rocken
Posts: 28
Joined: Wed Mar 21, 2018 1:30 am

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by rocken »

synthsin75 wrote: Thu Jun 20, 2019 12:04 am
rocken wrote: Wed Jun 19, 2019 6:26 am Thanks for the wonderful Script but i was wondering if it could be possible to create a script to space layers apart with the figures inputted by the user?..In other words, an alignment script to add distribution functions???? If that cant fly , pls what of a script to snap the bezier handles to a perfect angle? please forgive me for if if i have bothered you
All that is possible with Moho scripting, but probably not high on my personal priority list.
What can I do to push it up the personal priority list? I believe it would benefit a lot of users
Paul_Doodles
Posts: 2
Joined: Fri Apr 04, 2014 1:11 pm

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Paul_Doodles »

I just discovered this tool and coulde'nt wait to try it out, Im about to start a big project and this is perfect for what i need. But im getting a lua pop up telling me:

syn_layer_shortcut.iua:544: atempt to index local 'file' (a nil value)


This happens when i click on the tool button or on the dropdown to select the keyboard (which is blank)?

Im on a mac running Moho 12, Ill be updating to 13 at the middle of next month.

Thanks

Paul
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

Paul_Doodles wrote: Mon Jul 15, 2019 5:56 pm I just discovered this tool and coulde'nt wait to try it out, Im about to start a big project and this is perfect for what i need. But im getting a lua pop up telling me:

syn_layer_shortcut.iua:544: atempt to index local 'file' (a nil value)


This happens when i click on the tool button or on the dropdown to select the keyboard (which is blank)?

Im on a mac running Moho 12, Ill be updating to 13 at the middle of next month.

Thanks

Paul
Yeah, it did the same to me. My guess is that you tried out the Moho 13 trial, and it tried to update your keyboard shortcuts from v12. When this happens, Moho 13 adds "_Obsolete.txt" to the end of the keyboard shortcut file name...and back in v12, the shortcuts revert to the default. The layer shortcuts script can only work with custom shortcuts, even they're the same as the default. You might need to remove the "_Obsolete.txt" from the shortcut file name, and probably need to restart Moho.
Paul_Doodles
Posts: 2
Joined: Fri Apr 04, 2014 1:11 pm

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Paul_Doodles »

Thanks for getting back so quickly and thats exactly what i did, Thanks for the tip, sorry to pester you further but ive had a look around and i can find where to remove "_Obsolete.txt" from? is it text in a .lua file or a txt file?

Thanks again

Paul
[/quote]

Yeah, it did the same to me. My guess is that you tried out the Moho 13 trial, and it tried to update your keyboard shortcuts from v12. When this happens, Moho 13 adds "_Obsolete.txt" to the end of the keyboard shortcut file name...and back in v12, the shortcuts revert to the default. The layer shortcuts script can only work with custom shortcuts, even they're the same as the default. You might need to remove the "_Obsolete.txt" from the shortcut file name, and probably need to restart Moho.
[/quote]
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

This weekend I ran into an error when trying to use Layer Shortcuts in Moho 13. Sorry, I meant to ask about it earlier but got distracted. Anyway, I'm back in Moho 13 and trying again.

I've been using custom keyboard shortcuts in both 12.5 and 13 and I don't see the 'obsolete' text in the shortcuts file name, so not sure what's up yet. The tool is apparently working okay in Moho 12.5 but when I try to use it in 13, I'm getting weird behavior and lua errors like this one:

Image

Also, it's not placing the Layer Shortcuts group layer inside the Top group when I use the Local option, it's placing it outside of the Top group.

Maybe something else is interfering? Trying to figure that out now.

I'll post more info if I learn anything new.

P.S., Oh...just discovered that Tiny Pic is going away. Guess I better download my images and find a new host to re-upload from. (I used TinyPic for the above 'cause I'm in a hurry this morning.)
Last edited by Greenlaw on Sun Jul 25, 2021 11:18 pm, edited 4 times in total.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

It seems to be working in 13 now, at least in a simple test case I threw together.

When the lua window is open, I'm still seeing the above error when I click on any layer though. (Not always but most of the time.)

Will continue to investigate for a few more minutes.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

I think some of the weirdness I'm seeing has something to do with my Moho 13 file. When I try to use Layer Shortcuts in the file after opening it in Moho 12.5, I'm getting similar errors and the Layer Shortcuts file is being created outside of the Top group.

Not sure what's different about this file. The has some advanced techniques applied but nothing unusual that I can think of. Apart from my attempting to apply Layer Shortcuts, I believe the rig is using only native features.

A new file in Moho 12.5 seems to work fine with Layer Shortcuts though. I think this is true for 13 as weil...let me check again. BRB.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Yeah, something must be broken in my project and preventing Layer Shortcuts from work properly. Moho simply won't create the Layer Shortcuts group inside of the current Top group, it's always placing it outside of the Top group. I even tried creating a new Top group layer and moving the layers to that one, but getting the same result.

To be clear, I'm doing this in Moho 12.5 with the project file originally created in Moho 13 that previously errored with Layer Shortcuts in Moho 13.

Moho 12.5 and Layer Shortcuts are working fine together with new projects created in Moho 12.5. Moho 13 and Layer Shortcuts are working fine with new projects created in Moho 13.

I think I'm only having this issue with this particular test project in Moho 12.5 and Moho 13. I'm thinking something in Moho 13 broke the file for Layer Shortcuts for both versions of Moho.

BTW, I was mistaken in what I wrote earlier: this is not the 'advanced' character rig I was working on that's giving me errors. This 'broken' test project is nothing fancy and it's only using native features.

I'm going to try Layer Shortcuts with the 'advanced' rig project now in Moho 13 and see what happens.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Ok, I think everything is fine for Layer Shortcuts in both Moho 12.5 and Moho 13. My 'advanced' rig appears to work with Layer Shortcuts for both programs...no error with the Top group.

I do still see the lua error in Moho 13 whenever Moho or I select a layer.

I think this error is unrelated to Layer Shortcut and it's caused by another script I recently installed. Will crawl down that rabbit hole now. :)

Before I go, just to confirm, that 'obsolete' error described earlier probably only appears after a fresh copy of 13 is installed alongside Moho 12, and is run for the first time, correct? I haven't seen that problem yet but I've had Moho 13 installed for some time now and have been using custom keyboard shortcuts in both programs.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by Greenlaw »

Ok, I need to walk this back a little.

I removed the other script that I thought might be conflicting with Layer Shortcuts, and then I restarted Moho 13.

The lua window is popping open when I click the Layer Shortcuts Tool button in Moho 13 for the first time, and it has the Layer Shortcuts error message I posted above. Here's the message:

...\syn_layer_shortcuts.lua:527: attempt to index local 'pFile' (a nil value)

If I close the lua window, clicking Layer Shorts might not open it again but clicking a layer might do that and the window will have the same error.

Otherwise, Layer Shortcuts appears to work correctly, as far as I can presently tell.

The test project still seems broken but other project files are seem to be working correctly with Layer Shortcuts apart from the lua messages.

If you need to look at the files, Wes, I'll be happy to send them to you. They're my personal project files so no clearance issues. Thanks in advance for any help or suggestions.

For the time being, I'm going to stop using Layer Shortcuts in Moho 13. I have plenty of other things to work on for this rig so I'll wait to hear from you before moving forward with Layer Shortcuts.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *UPDATED 3/1/19* Layer Shortcuts tool

Post by synthsin75 »

Paul_Doodles wrote: Tue Jul 16, 2019 9:57 am Thanks for getting back so quickly and thats exactly what i did, Thanks for the tip, sorry to pester you further but ive had a look around and i can find where to remove "_Obsolete.txt" from? is it text in a .lua file or a txt file?

Thanks again
If you're creating custom keyboard shortcuts, then these should be saved as .json files in your custom content folder>Keyboard Shortcuts folder. The "_Obsolete.txt" is added to the file name of your custom .json shortcut file.

____________________________________________________________________________________________________________________________________________________
Greenlaw wrote: Tue Jul 16, 2019 7:27 pm Ok, I need to walk this back a little.

I removed the other script that I thought might be conflicting with Layer Shortcuts, and then I restarted Moho 13.

The lua window is popping open when I click the Layer Shortcuts Tool button in Moho 13 for the first time, and it has the Layer Shortcuts error message I posted above. Here's the message:

...\syn_layer_shortcuts.lua:527: attempt to index local 'pFile' (a nil value)

If I close the lua window, clicking Layer Shorts might not open it again but clicking a layer might do that and the window will have the same error.

Otherwise, Layer Shortcuts appears to work correctly, as far as I can presently tell.

The test project still seems broken but other project files are seem to be working correctly with Layer Shortcuts apart from the lua messages.

If you need to look at the files, Wes, I'll be happy to send them to you. They're my personal project files so no clearance issues. Thanks in advance for any help or suggestions.

For the time being, I'm going to stop using Layer Shortcuts in Moho 13. I have plenty of other things to work on for this rig so I'll wait to hear from you before moving forward with Layer Shortcuts.
No, that's definitely Layer Shortcuts. That pFile error is it trying to find your user settings file in Appdata. Maybe 13 has a folder permissions issue? I don't know, as I'm not seeing that error here. So yeah, it *might* help to see the file giving you trouble. In the meantime, the only thing that will affect is Layer Shortcuts being able to tell you if you're assigning a shortcut that's already in use. So since you only use shortcuts buttons, it shouldn't affect your workflow at all...aside from the annoying Lua error.
Post Reply