What script is causing this?

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

What script is causing this?

Post by mmmaarten »

Hi,

For some reason when using the Select Bones tool and hitting the 'Select Bones' button in the popup list there are some kind of placeholders/headers in the list of bones which cannot be selected and show wrong information (like calling named bones 'nameless').

Image

After sending this as a ticket to Lost Marble I got the reaction that this isn't done by Moho and might be done by a script. I cannot find what script might (have) cause(d) this tho and I only use scripts in the tools panel, which AFAIK never fire when not used. And I don't use any script as 'bone organiser' or something related.

Anybody perhaps knows what script could cause these '_____(17 NAMELESS BONES)`-style placeholders to appear in the bones list or perhaps you're the author of a script that does this? And/or how to get rid of this?

Thanks in advance!
Adults should play more often
User avatar
SimplSam
Posts: 1049
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: What script is causing this?

Post by SimplSam »

I guess they are being considered nameless because some lexical comparison is being done to see if B# is in the bone name. i.e. 'B' followed by digits.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
hayasidist
Posts: 3529
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: What script is causing this?

Post by hayasidist »

It's the function MOHO.BuildBoneChoiceMenu() in FO_Utilities from Lukas. (https://mohoscripts.com/script/FO_Utilities) The FO_ version replaces the factory version of the bone choice menu
User avatar
SimplSam
Posts: 1049
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: What script is causing this?

Post by SimplSam »

hayasidist wrote: Tue Aug 08, 2023 5:51 pm It's the function MOHO.BuildBoneChoiceMenu() in FO_Utilities from Lukas. (https://mohoscripts.com/script/FO_Utilities) The FO_ version replaces the factory version of the bone choice menu
Well I'll be dammed. I always thought that it was a built-in 'system' feature. Very handy!
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

Re: What script is causing this?

Post by mmmaarten »

SimplSam wrote: Tue Aug 08, 2023 6:01 pm Well I'll be dammed. I always thought that it was a built-in 'system' feature. Very handy!
Indeed, it could be handy, if it works (and installed intentionally) :)
However I find it a bit scary tho that some script is fired even though we're not using the tool and the tool is meant to do a complete other thing. I would rather like to know it if something gets fired and not firing something that I don't even know about tbh. I mean, what else does it do? And if something in MOho is not working quite right, is it an issue in Moho, or caused by some background script doing something?!

I wished it didn't do this. Guess now I will uninstall both lk_nudge_keys and lk_togglekeysfilter because it's obviously doing more than it should by the name of the tool. I would've liked it better if it would've been a seperate thing we choose to install rather than to fire something in the background. No offense to Lukas tho, these are clearly great helpful tools. It's me not liking things to go off in the background, without installing it intentionally or pressing/clicking something. When I install a tool to do A, I don't like it if it does B, C, D and F in the background. I think a tool should only do what is advertised.

Anyways, I see what the issue is now. The regular expression in the nameless bone detection is not right. It's detecting if there is a B followed by numbers, but it doesn't say that it must START with a B. So with that script now nameless are names starting with B and numbers, but also when the B and numbers are somewhere in the middle or end of the name.

In my file I am using many names ending with B followed by a number, like jaw.B2 which is now wrongly seen as nameless.

Image

I don't know lua, but I do know regular expressions. To fix this the regex should start with a ^ character to indicate the following expression should be found from the start of the string/bone name.

Than this is nameless: B42, but this is not: level.B42

Like so:
Image


[edit] Not sure why this string uses %d instead of the normal \d as used in regular expressions tho, but it has two other issues now;
At the moment this is ALSO found to be nameless: 'B42a' and this now is found to have a name, while this should be nameless: 'B1234'.
So to have everything full covered the regular expression should be this:
^B\d(\d)*$
(= ^ to Start with a B, followed by at least one digit (\d), than followed by zero or more digits and after that it must be the end of the name ($))

Not sure how to write this in the lua string, but my guess would be:
"^B%d(%d)*$"

Hope Lukas reads this :)
Last edited by mmmaarten on Tue Aug 08, 2023 6:47 pm, edited 1 time in total.
Adults should play more often
User avatar
SimplSam
Posts: 1049
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: What script is causing this?

Post by SimplSam »

Yeah. It is a little naughty to change system stuff.

The regex should probably be : "^B%d+$"
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

Re: What script is causing this?

Post by mmmaarten »

SimplSam wrote: Tue Aug 08, 2023 6:46 pm Yeah. It is a little naughty to change system stuff.

The regex should probably be : "^B%d+$"
Ah, you beat me, I just changed my post and saw your response just now. Yes, indeed, using a + is even shorter and better than the * I used.
Adults should play more often
User avatar
hayasidist
Posts: 3529
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: What script is causing this?

Post by hayasidist »

mmmaarten wrote: Tue Aug 08, 2023 6:14 pm Hope Lukas reads this
you could PM him!
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

Re: What script is causing this?

Post by mmmaarten »

hayasidist wrote: Tue Aug 08, 2023 7:09 pm
mmmaarten wrote: Tue Aug 08, 2023 6:14 pm Hope Lukas reads this
you could PM him!
I just wrote him an e-mail. But good to know PM is possible too. I didn't know that. Thanks!
Adults should play more often
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

Re: What script is causing this?

Post by mmmaarten »

Thanks for your quick and helpful responses @SimplSam and @hayasidist! Because of this the cause could be found so quickly. Nice to know now what it was :D
Adults should play more often
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: What script is causing this?

Post by Lukas »

Thanks for the email Maarten, and SimplSam for the fix. 😎

I should have moved that function from the FO_Utilities script into its own file, before releasing it in the public. 😳 Oops

All these scripts were initially just created for in house production and our specific pipeline... In this case, the menu allows us to quickly identify any unnamed bones, as we want every bone named to be able to re-use animation in more situations). It also shows smartbones separated in the list, if you pass the extra 'moho' argument when creating the dropdown menu, but you'd need a customized select bone tool. Since this menu is created in multiple tools I replaced the original function.
I will see if I can move them to a separate lua file without breaking other scripts and update them on Mohoscripts.com so users can choose if they want the extended bone menu or not.

Edit: I've updated https://mohoscripts.com/script/FO_Utilities and commented out the 2 functions that replaced MOHO functions. I'll re-release the bone menu after cleaning up some code in a separate download. But for now at least there's no unexpected adjustments by the scripts. 🙂
Last edited by Lukas on Wed Aug 09, 2023 8:10 am, edited 1 time in total.
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

Re: What script is causing this?

Post by mmmaarten »

Lukas wrote: Wed Aug 09, 2023 7:46 am and SimpleSam for the fix. 😎
uh... ?
Lukas wrote: Wed Aug 09, 2023 7:46 am I will see if I can move them to a separate lua file without breaking other scripts and update them on Mohoscripts.com so users can choose if they want the extended bone menu or not.

Edit: I've updated https://mohoscripts.com/script/FO_Utilities and commented out the 2 functions that replaced MOHO functions. I'll re-release the bone menu after cleaning up some code in a separate download. But for now at least there's no unexpected adjustments by the scripts. 🙂
Thanks!
Adults should play more often
Post Reply