HeyVern's scripts and tools - (focus on bones)

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

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Bones with the same names are BAD!!!

Post by heyvern » Mon Feb 12, 2007 7:41 pm

Well, I've been over and over several possibilities to get around this seemingly small problem... bones in one layer with the same name.

First off, let me say that I never have bones with the same name. I always rename bones if that occurs during editing.

Here's the issue:

Items in a text list in the UI only have two values, the Label and the ID. The ID is the order it appears in the list.

What this means is that I have no way of determining which bone is being referenced by the name from the list if two or more bones have the same name.

Other UI items have a msg value that is sent when clicked. A menu item or a check box for instance has a msg value that is unique for each item. But a text list only has ONE msg value for the whole thing.

I thought about using two tables with extra info to keep the lists synchronized... same problem. If there is more than one bone with the same name there is no way to know which bone that might be in the table, especially if they are ordered alphabetically. 3 bones with the same name aren't necessarily going to end up in the same spot in the table even if the tables are sorted.

Dealing with bones that don't have a name at all is a lot easier and is not a problem.

The options:

1. Only allow copying and pasting of uniquely named bones. This would require "renaming" same named bones at the beginning of the script. This would be the easiest solution but may be annoying to people.

2. Put a unique "ID" on the label in the text list. I really like this one but what a pain. I would have to do string searches on the names of the labels to get the ID... changing IDs will also be a pain. It could be done though.

Anyway... this little thing is slowing me down a tad.

-vern
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Thu May 24, 2007 4:39 am

There was a bug in my new Flipper script. It would crash when using the undo and also sometimes when deleting key frames.

I believe I have fixed this now so you can download it again and let me know.

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Mon Jun 04, 2007 12:52 pm

Vern! the bones [u][color=red]wizard[/color][/u]!... wrote:Just curious. I wrote a new bone select tool that displays bones in a scrolling list instead of filling the screen with a huge display of all the darn bones and I would like to share it.
Please! post it!, post it! ..... :shock:
:wink:
-G
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Mon Jun 04, 2007 1:36 pm

I can't get it to work in ASP.

I have tried but there is some new funky code and it won't even show up in ASP.

The script works PERFECTLY in Moho but not ASP. I don't understand some of the new code.

Until there is some explanation from efrontier I'm kind of stuck.

I beleive it has to do with:

Code: Select all

LM_SelectBone.BASE_STR = 2285
I have no idea what this is.

Or maybe its:

Code: Select all

MOHO.Localize
I will keep fiddling around with it. I will bet it has something to do with Pro versus Standard versions.

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Mon Jun 04, 2007 1:48 pm

I don't know what have you done but I imagine you have modified your select bone tool lua file from your moho version. What avbout do the same with a copy of select bone tool lua file from Anime Studio? I if it is legal I can send you a copy of the one that is working for me in my linux system.

Also I believe that

Code: Select all

LM_SelectBone.BASE_STR = 2285
is such kind of number that LM uses to define its functions.
BASE_STR is base string.
In this way it call the proper function and not other if some different versions of the script tools are living in the same program. I think those numbers are defined in a txt file inside a folder in Moho folder. Search it and you'll find it. I have not option to do it now.

MOHO.Localize could be a variable (function) where it stores the path to the program?

Please send me the script tool in a PM and try to make it work.

Thanks anyway.
-G
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Mon Jun 04, 2007 2:13 pm

Got it!!!!!!!

IT WORKS!!! YYYEEEEEEHAAAAAA!!!

User error... :oops:

I did modify the ASP version, but there is some new stuff in there I'm not familiar with yet so it's kind of "trial and error".... plus... I typed it wrong. :oops:

I left out a couple of closing ")"... and for some reason my ASP on the PC doesn't show any lua warnings... I don't know why. So I had no feedback where my syntax errors were.

You will have to let me know if you want the scroll box longer. I will probably make it longer right now before I post it. It's too darn short.

I LOVE THIS NEW BONE TOOL!!! FINALLY!!! WOOHOOO!

I will post this in this thread very soon. Genete you will love it!

It seems to work okay... but I haven't tested it a whole lot so you should hang on to your standard bone selection tool just in case.

-vern
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 » Mon Jun 04, 2007 4:06 pm

Hi heyvern,

Again I have to say; what fantastic advances you and Genete are making with these 2.5D techniques you are developing - or should I say 2.7D techniques (after watching that giraffehead!!!).

I was wondering:
Could you possibly put the flipper / transcale / transrotate etc script tools and the 3Dgrid5 together in one "super 2.5D toolbox" script? Please?

I'm looking for solutions in the 2.2D area, as you know. :-)

I think these different tools in some cases might work as very good complements to each other... A simple "scale-rotate" action for the face (stretchy and very "hands on") combined with more pinpoint 3D accuaracy in the rotation movement for nosetips or ears... makes a good cartoon head turn for someone like me who isn't able to draw all those inbetweens very well! :oops:

I was also wondering:
would it be possible to incorporate some of that trigonometry stuff into the simpler flipscaling tools? You know, when the "flip bone" is closing in to the "now bone" the amount of scaling (or rotating or whatever tool we are talking about) would also slowly decrease...? ... a SINUS function.

(because then the "scale-rotate" part and the 3D rotation part would be closer "in sync" with eachother and could more easily be controlled by the same master bone.)

:-)
capricorn ( - just call me "cap")
children's tv pro, character animator
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Mon Jun 04, 2007 4:28 pm

Genete, on the new bone selection tool...

I ran into a problem. In files with a lot of bones for some reason it crashes. Small files are okay. I am working on the fix. It is so close... so close.

The problem is the darn text lists just are... weird. They just don't work like a menu.

---------
Cap,

Yes, I had planned to add all those "extras" into the 3Dgrid eventually. Want to wait till we get it worked out because that extra code might confuse things.

I absolutely plan to put that trig code into the flipper. I was going to do that before I thought of this thing. ;)

-vern
User avatar
capricorn33
Posts: 249
Joined: Sun Oct 02, 2005 9:49 am
Location: Finland
Contact:

Post by capricorn33 » Mon Jun 04, 2007 4:57 pm

heyvern wrote: Yes, I had planned to add all those "extras" into the 3Dgrid eventually. Want to wait till we get it worked out because that extra code might confuse things.
Yup. You two go ahead and make your magic.
It's just like christmas time you know... all this waiting around... wishing it would be christmas RIGHT NOW ;-)

Just kidding! It's nice to have something to look forward to. :-)
capricorn ( - just call me "cap")
children's tv pro, character animator
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Mon Jun 04, 2007 7:32 pm

Yuuhhuuu!!
Thank you Vern! It helps me a lot!. I will keep the original in the "Other" section and play with yours in the Bone palette area. If there is any bug I'll let you know.

:D :D :D :D :D :D
: BIG SMILE:

THANKS!

-G
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Mon Jun 04, 2007 7:56 pm

:(

The drop down menu says:
Bone constraints instead of Select Bone. The other labels are wrong.
Also it is very slow. Every bone I select it takes a loooong time to select it.
Also have crashed sometimes ...

:cry: :cry: :cry:

Don't worry... I can live with the original select bone tool for the moment. Try to maintain the bones not overlapped.

Thanks anyway.
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Tue Jun 05, 2007 12:16 am

I don't understand.

It looks and works perfectly for me. I even downloaded the file and installed it just to be sure.

I did notice one little bug when there were no bones on a layer but I know how to fix that.

I am not giving up.

-vern
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Tue Jun 05, 2007 12:48 am

Genete,

How many bones do you have? Any guesses?

How old is your machine? Mine is ancient and I have no trouble selecting bones.

It could be that it slows down when there are a lot of bones... more bones than I expected. The menu is "created" from the bone list. It could be that a text list is more memory intensive than a menu in AS.

I spent a lot of time on this so I need to figure this out.

Just to make sure... could you download it and try again? Just for fun. ;)

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Tue Jun 05, 2007 6:15 am

Downloaded again the files and re installed.
Here a screenshot

Image

If I maintain the drop down menu open and select a bone the drop down menu list is scrolled completely (funny thing but loosetime). I think it do the same internally when you select a bone even when it is closed. That's the reason for the delay. Not a memory issue because my memory status bar is ok. During the scrolling the CPU is 100% loaded.

Hope it helps.
-G
User avatar
heyvern
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern » Tue Jun 05, 2007 6:58 am

Okay there is something really really confusing about creating these custom tools.

It is most like user error, although in the past I have used all kinds of custom bone and draw tools ALONG SIDE of the original "Moho" tools.

This problem is only related to ASP and custom tools for some reason.

There is some kind of conflict. Each tool that does the same thing, creates the same kind of menus is fighting for control. On my Mac version of Moho THIS NEVER HAPPENED.

When I moved over to ASP on my PC I have had no end of problems getting this to work.

What you see with the items at the top all confused and switched is not how the script is written. It has to do with both bone tools trying to do the same thing. It must be using the same global variables.

I am working on a fix right now. Took me an hour to get my PC version of ASP to work again. Even after putting the old bone select tool back in and setting it as the default tool it wouldn't work with the other one in the tool folder.

Like I said this is probably MY FAULT! I apologize. To my credit though, I have 3 different bone select tools in my Moho folder... including this new one and they all work perfectly fine together.

I will sort this out but it may require taking the old bone select tool out of the tool folder to use this one.

Genete the crashing and slowness and odd behavior you experienced I am sure is because of the two bone tools doing the same thing at the same time to the same global variables. This tool works PERFECTLY in Moho. I am determined to get it working in AS.

There shouldn't be 2 "Lock Bone" things at the top. Each bone select script has them in the same place. They are "fighting" each other.

One script has an "extra" dialog box for the bone selection that is similar to the bone constraints box. I think both tools are "mixing" their variables and creating bizarre results.

-vern

-vern
Post Reply