
Bone label script?
Moderators: Víctor Paredes, Belgarath, slowtiger
Bone label script?
I know there's an auto bone naming feature already but can any of you scripting guru's make a script that automatically labels bones ON the canvas? i.e. floating next to the bone so they're easier to identify. I would if I could but I'm not smart enough to do any actual scripting. Not that a whole lot of people would find it useful but people you use bone constraints would love it I'm sure. Just a thought I had, don't know if it's a good one.....lol! 

Practice random acts of kindness and senseless acts of beauty! Pause, consider, do! I dare you!
- funksmaname
- Posts: 3174
- Joined: Tue May 29, 2007 11:31 am
- Location: New Zealand
Re: Bone label script?
Hey Guyver,
I'm not sure how useful this would be? you wouldn't want it on every bone, it would really clutter your canvas - so for individual bones, why not attach a hidden layer (won't render) with some labels if need be? Just an idea for a workaround, I wouldn't know where to start either with the scripting
I'm not sure how useful this would be? you wouldn't want it on every bone, it would really clutter your canvas - so for individual bones, why not attach a hidden layer (won't render) with some labels if need be? Just an idea for a workaround, I wouldn't know where to start either with the scripting

Re: Bone label script?
A nice solution would be to show the names on rollover, only one name at a time.
Re: Bone label script?
Didn't one-time forum member heyvern do something like this way back in AS prehistory?
You can't have everything. Where would you put it?
Re: Bone label script?
You have to say my name 3 times in front of a mirror with the lights out. 
Yes, I did create a script for this a looooong time ago. AND it actually worked! I was able to display bone name labels that followed bone rotation and translation etc plus it could create bone groups with color highlighting. Bone label text was scaled based on bone length and scaling. The best part of the script I still use. I created a custom simple font that could be drawn using simple "connect the dots" in the script. I use a version of that code to create very light weight text layers. Strokes only, with very very few points so you can cram a ton of text on a vector layer without bloating the file. The text isn't "pretty" but it's very readable even at small sizes and great for instructions and labels.
I gave up on the bone label/grouping script. At the time I don't think I understood scripting as well as I do now. In order to make it work I edited all the tools! All of them! All tools had a reference to custom utility code in order to display the bone labels and colorizing all the time. It also had a custom tool to turn off the labels and colors. At the time it seemed to be the only way to pull it off. The editing of all the tools wasn't that hard, It was only 3 or 4 lines of code but it was starting to become a chore to keep it up to date. Plus it would be absolutely over the top to have regular users try to install this thing and do all that themselves.
The other draw back was storing the bone group data for groups and colorizing. At the time I wrote the script there was no metadata storage in the file format like there is now for 8.2. I had to store this data in a text file saved in the same directory as the ASP file. Now with metadata storage I could save that info in the file and eliminate that nightmare.
Now that I think about it... I really should give it another shot. My thought now would be to have a permanently floating window from a script that could possibly, do it's thing without needing to edit all the tools. I have never tried that yet. The tricky part is the constant updating required. With the original, the code was "built in" to all the tools so it worked very smoothly. I am not 100% sure I can pull that off with a floating scripted window. The key is having a way to call the same redraw code with different tools selected.
-vern -vern -vern


Yes, I did create a script for this a looooong time ago. AND it actually worked! I was able to display bone name labels that followed bone rotation and translation etc plus it could create bone groups with color highlighting. Bone label text was scaled based on bone length and scaling. The best part of the script I still use. I created a custom simple font that could be drawn using simple "connect the dots" in the script. I use a version of that code to create very light weight text layers. Strokes only, with very very few points so you can cram a ton of text on a vector layer without bloating the file. The text isn't "pretty" but it's very readable even at small sizes and great for instructions and labels.
I gave up on the bone label/grouping script. At the time I don't think I understood scripting as well as I do now. In order to make it work I edited all the tools! All of them! All tools had a reference to custom utility code in order to display the bone labels and colorizing all the time. It also had a custom tool to turn off the labels and colors. At the time it seemed to be the only way to pull it off. The editing of all the tools wasn't that hard, It was only 3 or 4 lines of code but it was starting to become a chore to keep it up to date. Plus it would be absolutely over the top to have regular users try to install this thing and do all that themselves.
The other draw back was storing the bone group data for groups and colorizing. At the time I wrote the script there was no metadata storage in the file format like there is now for 8.2. I had to store this data in a text file saved in the same directory as the ASP file. Now with metadata storage I could save that info in the file and eliminate that nightmare.
Now that I think about it... I really should give it another shot. My thought now would be to have a permanently floating window from a script that could possibly, do it's thing without needing to edit all the tools. I have never tried that yet. The tricky part is the constant updating required. With the original, the code was "built in" to all the tools so it worked very smoothly. I am not 100% sure I can pull that off with a floating scripted window. The key is having a way to call the same redraw code with different tools selected.
-vern -vern -vern

Re: Bone label script?
Here's the updated script if you want to try it out. Instructions in the zip.
bone-groups-v8.zip

Important Notes:
1) I have not figured out how to store the data in the file yet, so there is an external file created when the AS file is saved that must stay with that document in the same folder. This file has a ".tbl" extension... not sure why (of course I chose that extension, just can't remember why when .txt works as well). It is a "table" type text file that stores bone grouping and color information.
2) There is also a utility script that must be put in the scripts/utility folder.
Other than that it works okay. Of course it's pretty useless without being able to use it with other tools... still trying to work on that. There is ONE really nice actual use for it. The bone grouping allows you to select just the bones in the group. By selecting from the menu it selects all bones in the group. You can have bones in more than one group.
-vern
bone-groups-v8.zip

Important Notes:
1) I have not figured out how to store the data in the file yet, so there is an external file created when the AS file is saved that must stay with that document in the same folder. This file has a ".tbl" extension... not sure why (of course I chose that extension, just can't remember why when .txt works as well). It is a "table" type text file that stores bone grouping and color information.
2) There is also a utility script that must be put in the scripts/utility folder.
Other than that it works okay. Of course it's pretty useless without being able to use it with other tools... still trying to work on that. There is ONE really nice actual use for it. The bone grouping allows you to select just the bones in the group. By selecting from the menu it selects all bones in the group. You can have bones in more than one group.
-vern
Re: Bone label script?
If you feel comfortable editing your tools directly you can add the following code to any bone tool just above the "Tool options" comment. DO NOT USE MS WORD! Or any other word processing type application. Use Notepad or textedit. Something that is just plain ascii editing.
This sample was added to the lm_rotate_bone.lua tool. You only need to copy/paste the DrawMe function and not the comment below it. That's just to show where it is in the tool. Also make sure you change the function name to match the tool. In this case LM_RotateBone:DrawMe is the function name for that tool. If it were the Select bone tool, it would be changed to LM_SelectBone:DrawMe
As you can see, it's not hard to do. Adding that code just to the rotate bone tool is awesome. You can turn off "Paths" in the display and only see the bone groups. You can turn bone groups on and off etc. The performance is off the hook considering all the crap running in the back end of the script, drawing all the text and the bone shapes etc. It's probably because this is UI Drawing and not actual vector drawing.
With a little effort I should be able to have the bone label rotate to the "top".
-vern
This sample was added to the lm_rotate_bone.lua tool. You only need to copy/paste the DrawMe function and not the comment below it. That's just to show where it is in the tool. Also make sure you change the function name to match the tool. In this case LM_RotateBone:DrawMe is the function name for that tool. If it were the Select bone tool, it would be changed to LM_SelectBone:DrawMe
Code: Select all
function LM_RotateBone:DrawMe(moho, view)
HV_SharedUtils:DrawMe(moho, view)
end
-- **************************************************
-- Tool options - create and respond to tool's UI
-- **************************************************
With a little effort I should be able to have the bone label rotate to the "top".
-vern
Re: Bone label script?
I modified rotate and select bone tools for this video.
Re: Bone label script?
Hey Heyvern, this looks very promising. It would be nice if a 'green' bone, would show 'green' keyframes on the timeline. With the new coloured keyframes in ASP9.
For example, if you have a smart bone for a 'blink'. You can easily identify all the blinks on the timeline. This would be great.
For example, if you have a smart bone for a 'blink'. You can easily identify all the blinks on the timeline. This would be great.
Re: Bone label script?
A thought I'd like to share:
It would be nice to be to create bone groups (for example, all green bones would be the green group, although you don't want to limit the number of groups to the available number of colors).
And it would be great if you could automatically have the group make the keyframes a color on the timeline. And even better, be able to have a separate channel on the timeline. For example, if you have a rig with the body AND face in the same bone layer. It would be sweet if you'd be able to see them separated on the timeline. Instead of only just 'all bones keyframes' and 'selected bone keyframes' channels, you could make your own.
In a rig with a 'blink' smartbone, I'd love to have a channel just for the blink-bone rotation. So I can see where my character is blinking without having to select the bone. And without it being in the same channel as my walkcycle animation keyframes.
It would be nice to be to create bone groups (for example, all green bones would be the green group, although you don't want to limit the number of groups to the available number of colors).
And it would be great if you could automatically have the group make the keyframes a color on the timeline. And even better, be able to have a separate channel on the timeline. For example, if you have a rig with the body AND face in the same bone layer. It would be sweet if you'd be able to see them separated on the timeline. Instead of only just 'all bones keyframes' and 'selected bone keyframes' channels, you could make your own.
In a rig with a 'blink' smartbone, I'd love to have a channel just for the blink-bone rotation. So I can see where my character is blinking without having to select the bone. And without it being in the same channel as my walkcycle animation keyframes.
Re: Bone label script?
Aaahhh this is a favourite old chestnut of mine too, if only...It would be nice to be to create bone groups
