Script Issue: Placing Keys Offset from the Timeline Marker

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Script Issue: Placing Keys Offset from the Timeline Marker

Post by GaryC »

I was taking a look at Janimatic's script from here and found there's some odd behaviour with it.
If you right click and drag the timeline to shift it then the script creates keys offset from the actual timeline marker.

Eg. If you have the timeline marker at frame 100 and you shift the keys 10 frames to the right then Janimatic's script will create a key at 110 instead of at 100 where you'd want it to be. I had thought that it was an issue with using moho.frame vs. moho.layerFrame but it seems to be behaving identically when I switch in moho.layerFrame (and I would have thought moho.frame would be the one that would solve this problem anyway)

A bit of an aside, I saw somewhere that the way to refresh menu scripts without quitting and re-opening Anime Studio was to press Ctrl + F5 but that's doing nothing when I try it. I don't see it in the list of shortcuts so if if someone could direct me to the correct method it'd speed me up a lot! I am slightly suspicious that even when I quit and re-open Anime Studio it's not fully updating my script and maybe caching it somehow? I had that happening to me when I was making a lot of changes to layer scripts before so if I had a more direct refresh method that'd put that possible source of the problem out of my head.
User avatar
synthsin75
Posts: 9981
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script Issue: Placing Keys Offset from the Timeline Mark

Post by synthsin75 »

Changing all instance of moho.frame to moho.layerFrame works here, at least on the keySkeleton script.

Layerscripts need to be unembedded and reembedded to reload the code, but tool/menu/button scripts use the shortcut Ctrl+Alt+Shift+L.
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Re: Script Issue: Placing Keys Offset from the Timeline Mark

Post by GaryC »

synthsin75 wrote:Changing all instance of moho.frame to moho.layerFrame works here, at least on the keySkeleton script.

Layerscripts need to be unembedded and reembedded to reload the code, but tool/menu/button scripts use the shortcut Ctrl+Alt+Shift+L.
Ah yes, that shortcut works perfectly thank you.
Unfortunately I did try switching out moho.frame for moho.layerFrame and they both produce the exact same results for me so I'm not sure if there's some setting that interferes with this or what.


EDIT: Ok this is weird. I was trying something out and realised that what I put inside addKey() is not actually changing anything.
I tried it with moho.frame - 5 and that changed nothing, I even just removed it entirely so the brackets are empty and it's still updating just as it did before.

So then I tried deleting the entire text in the script and reloading to see if maybe there's some deeper cache that ASP retains if newer versions have problems or errors. And... it replaced the menu option for this script with an entirely different script from an entirely unrelated folder. But when I just delete everything inside the MK_key_skeleton:Run function it goes back to running exactly as before. Note I removed any other version of this script that existed so ASP shouldn't even have access to the necessary code to do this unless it's keeping copies somewhere.

This is extremely odd behaviour, can anyone clear up what's going on?

EDIT2: I think I might understand what was happening a little better. There was another copy of the script as a tool in a different folder, so I think it may have been using the code from that instead of the local script I was writing. It did, however, take the UI info from my menu script (the text that appeared in the Scripts menu was reflecting my edits but nothing else was).
It's odd that ASP automates this behaviour and doesn't even log to console maybe or note that it's taking code from elsewhere but at least I have a good idea of what seems to have happened.

And lastly, yes swapping out frame for layerFrame worked as intended!
User avatar
synthsin75
Posts: 9981
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script Issue: Placing Keys Offset from the Timeline Mark

Post by synthsin75 »

Any function can be called from any script, so it is crucial to have unique function names. And there's no telling which of duplicate function names may be activated when called.

Glad you got it sorted.
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Re: Script Issue: Placing Keys Offset from the Timeline Mark

Post by GaryC »

synthsin75 wrote:Any function can be called from any script, so it is crucial to have unique function names. And there's no telling which of duplicate function names may be activated when called.

Glad you got it sorted.
That makes sense. I was especially caught off guard by this because I had removed the duplicate scripts in the menu folder but obviously there was still the tool one I didn't spot. Thanks for the help!
Post Reply