sidebar features
sidebar content

Go Back   Blender Artists Forums > General Forums > Python & Plugins

Reply
 
Thread Tools
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696


Hello fellow Blenderheads!

As per the discussions in this thread, I have decided to try my hand at writing a normalization script for managing bone groups. This is my first Blender script, but I am satisfied with the functionality I have been able to achieve with it! The script provides the following capabilities:
Normalizes the entire mesh (per vertex) by distributing all weights evenly, or preserving 100% groups based on 3 rules:
1.)If there are no 100% groups, all weights are evenly distributed.
2.)If there are more than one 100% groups, they are divided evenly, and all other memberships are removed.
3.)If there is just one 100% group, it becomes the owner of the vert and all other influences are removed.
It also provides a "mode" which allows you to update the selected/active group and normalize its weights by either preserving the weights entirely, or distributing them evenly. Non-bone groups are left untouched.

As well, the peak (100%) value can be set, and there is a tolerance setting to determine the minimum value of a 100% weight.
It is a little confusing to explain in writing, which is why I made a video screencast to demonstrate the basic use of the script. I've also attached a demo file (updated to 1.1) in the rigging thread with a dummy rig to test on (since I just noticed attachments are disabled here!). The latest version of the script will continue to be posted on my 'google pages' page, which is also linked from my blog.

Again, this is an alpha release, so it likely has bugs to find! Please report any bugs or suggestions to this thread.

Thank-you

-Gord

Version 1.1 - 2.49 released July 17 2009
-removes weights with 0% influence (instead of assigning with 0 values, keeps weights clean)
-normalizeOverlapping() more or less fixed but still not quite right so normalization() left as default
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.

Last edited by feelgoodcomics; 18-Jul-09 at 17:00.
#1   Old 09-Jul-09, 15:14   
Reply With Quote


Holmen's Avatar
Holmen Holmen is offline
Member
 
Join Date: May 2008
Location: Sweden
Posts: 157
Nice work, I can see myself using this script.
You video tutorial was a bit messy but I think I got it.
............................................
------------
Take a look at HOLMEN FACE RIG it's in this thread.
#2   Old 09-Jul-09, 16:27   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Quote:
Originally Posted by Holmen View Post
Nice work, I can see myself using this script.
You video tutorial was a bit messy but I think I got it.
Yeah... I was nervous lol.

I hope you find the script useful! I look forward to any thoughts you have after using it
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.
#3   Old 09-Jul-09, 16:31   
Reply With Quote
Holmen's Avatar
Holmen Holmen is offline
Member
 
Join Date: May 2008
Location: Sweden
Posts: 157
Sure I keep you posted on how it works.
BTW, I tipped blender nation about this script just now so you might get allot of feedback.
............................................
------------
Take a look at HOLMEN FACE RIG it's in this thread.
#4   Old 09-Jul-09, 16:34   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Quote:
Originally Posted by Holmen
BTW, I tipped blender nation about this script just now so you might get allot of feedback.
Oh my Well hopefully someone more knowledgeable with scripting will be able to help fix bugs if there are a lot of them! lol...

Edit: But I shall do my best to fix them myself!
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.

Last edited by feelgoodcomics; 09-Jul-09 at 23:59.
#5   Old 09-Jul-09, 16:42   
Reply With Quote
Llew's Avatar
Llew Llew is offline
Member
 
Join Date: Aug 2007
Posts: 13
I just wanted to tell you that this script is a life saver!

I rig armor for a game, and it requires that each bone has weight of no more than 1. Which would mean, if I didn't have this script, that I would have to edit and triple check every single vertice against all the bones in the vicinity to make sure all the weights added up to exactly one.

Rock on man!
............................................
English does not borrow from other languages, English follows other languages down dark alleys, knocks them over, and goes through their pockets for loose grammar.
#6   Old 11-Jul-09, 21:49   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Quote:
Originally Posted by Llew View Post
I just wanted to tell you that this script is a life saver!
Awesome Llew!

Thanks for letting me know! I was wondering if anyone was putting it to good use...

Cheers!
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.
#7   Old 11-Jul-09, 23:51   
Reply With Quote
Llew's Avatar
Llew Llew is offline
Member
 
Join Date: Aug 2007
Posts: 13
Oh yeah.

In conjunction with an auto-rigging tool which does the initial rigging, your script allowed me to rig another armor in about 15 minutes because I didn't have to check the weights individually.

Invaluable.
............................................
English does not borrow from other languages, English follows other languages down dark alleys, knocks them over, and goes through their pockets for loose grammar.
#8   Old 12-Jul-09, 02:31   
Reply With Quote
Loolarge's Avatar
Loolarge Loolarge is offline
Member
 
Join Date: Aug 2008
Location: Germany
Posts: 176
Isn't there allready a script like this coming with blender called "Normalize/Scale Weight" which you can find under the paint menu in weight paint mode? I have been using that one all the time.
#9   Old 12-Jul-09, 08:05   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Quote:
Originally Posted by Loolarge View Post
Isn't there allready a script like this coming with blender called "Normalize/Scale Weight" which you can find under the paint menu in weight paint mode? I have been using that one all the time.
Yes there is a script in the paint menu. I was playing around with it before I wrote this script.

However I have been unable to determine the rules of it. I certainly don't get the same behaviour from it as I do with this script.

It can also be a drag to select Paint->Normalize/Scale weight, and re-configure your settings every time you want to use it, instead of just reaching over and clicking a big button with your settings intact.

If you use it, can you explain how it is you get the same behaviours with it? What are the settings you use?
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.

Last edited by feelgoodcomics; 12-Jul-09 at 14:40.
#10   Old 12-Jul-09, 14:23   
Reply With Quote
mikahl's Avatar
mikahl mikahl is offline
Member
 
Join Date: May 2006
Location: Vancouver, Canada
Posts: 590
Tried the script - really nice. This will make things more predictable. Nice, easy to grasp interface.
Something like this should be hard-coded, its seems like such a basic feature.
............................................
www.watchmike.ca

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort."
---Herm Albright
#11   Old 13-Jul-09, 18:41   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Thanks mikahl

I appreciate the feedback! I'm glad to hear you find it useful!

In my first attempts, I was trying to get the script to be interactive, so that you could turn the mode on and just paint normalized continuously. However I quickly realized it just wasn't feasible for a high-level script, and went for the manual update style instead. The nice thing about that though, I think, is that you aren't forced to have the mode either on or off, you can have both behaviours at the same time.

And I agree, if it wasn't basic I don't think I would have been able to write it lol. Having the script be adapted into the program would be cool, if enough users decide they want it. However, I think the nice thing about having the tool as a separate script is that it doesn't have to even appear in the menu to confuse those who don't need to use it... though I guess it also makes it hard to find for those who do!
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.
#12   Old 13-Jul-09, 19:18   
Reply With Quote
mikahl's Avatar
mikahl mikahl is offline
Member
 
Join Date: May 2006
Location: Vancouver, Canada
Posts: 590
Quote:
Originally Posted by feelgoodcomics View Post

However I quickly realized it just wasn't feasible for a high-level script, and went for the manual update style instead. The nice thing about that though, I think, is that you aren't forced to have the mode either on or off, you can have both behaviours at the same time.
That's my only gripe with the plugin actually. Personally I'd like to actually be updated after every stroke - and if you don't like it, simply turn the plugin off.

Hopefully this kind of behavior can be achieved in 2.5.
............................................
www.watchmike.ca

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort."
---Herm Albright
#13   Old 13-Jul-09, 20:33   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Well understand that if it was updating in realtime, the weights would be jumping around all over the place on you. So you probably wouldn't like it
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.
#14   Old 13-Jul-09, 20:41   
Reply With Quote
amoose136's Avatar
amoose136 amoose136 is offline
Member
 
Join Date: Feb 2007
Location: Knoxville, TN
Posts: 145
Might want to move the script away from google pages. Google said they are closing down the service.
............................................
the evil moose
#15   Old 15-Jul-09, 05:48   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Quote:
Originally Posted by amoose136 View Post
Might want to move the script away from google pages. Google said they are closing down the service.
Yeah I noticed that...

But they also say:

Quote:
Originally Posted by Google
Do nothing, and your pages will automatically be moved to Google Sites... We'll set up the new site and move your pages for you... Visits to your googlepages.com URL will redirect to your new site.
Which sounds like there's no cause for concern. But don't worry, if for some reason the link or site is unreachable, I'll find a new place to put it. Just let me know
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.
#16   Old 15-Jul-09, 14:43   
Reply With Quote
blenderificus's Avatar
blenderificus blenderificus is offline
Member
 
Join Date: Jun 2008
Posts: 538
there have been calls for such a weight normalizing script as this for some time, and now you've come along and saved MANY people a ton of hours of needless tweaking, thank you :-)
#17   Old 17-Jul-09, 19:34   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Quote:
Originally Posted by blenderificus View Post
there have been calls for such a weight normalizing script as this for some time, and now you've come along and saved MANY people a ton of hours of needless tweaking, thank you :-)
Myself included So you're most welcome!
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.
#18   Old 17-Jul-09, 21:52   
Reply With Quote
feelgoodcomics's Avatar
feelgoodcomics feelgoodcomics is offline
Member
 
Join Date: May 2009
Location: Vancouver, Canada
Posts: 696
Well I'm pleased to see that no one has encountered any bugs so far! However, I have been aware of a problem with the script that occurs when subtracting weights so I thought I should fix it up before it causes anyone any grief. It actually turned out to be a simple fix with just 2 lines of code in the assignWeights() function.

The problem was that the script was assigning all weights to 0... so once a vert was a member of a group, it remained that way. Say you had an influence of 1, and you painted it down to 0.5 and updated it. All the other groups (even with 0 values) would be scaled up. Which can lead to very unpredictable behaviour during long sessions. So now the 0 weights are removed entirely. The script is intended to be used with 'add' in the paint tool anways, but I just wanted to make sure that subtracting didn't cause problems.

I think this also fixed the 'double transform' problem I was getting with the normalizeOverlapping() function I mentioned in the video. So that works now too, though it doesn't produce the exact result I was hoping it would. I think the function currently in use is better, so I left it as the default. But in case you want to try the other function you can comment out line 464 and use line 465. The problem is just that it doesn't allow you to paint on the overlapping area, but it will keep the active weight locked. I'll keep thinking about how to do it with the lock, and being able to paint on the opposite side, but I don't think it's urgent.

The new version (1.1) is available on my google page.

That's all for now.
............................................
Feel-Good Comics Blog

The Rigging Repository
->Tutorials, Characters, Examples, Scripts, etc...

Sharing good ideas is the intelligent way to make brilliant ideas.

Last edited by feelgoodcomics; 18-Jul-09 at 04:21.
#19   Old 18-Jul-09, 04:19   
Reply With Quote
OriginalBBB OriginalBBB is offline
Member
 
Join Date: Dec 2008
Posts: 100
I tried, but i couldm't get the way to make it function
#20   Old 25-Jul-09, 07:12   
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 15:49.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Logo and website design copyright © 2006 by froodee design bureau. All rights reserved.
Other Blender Sites
new icon Blender Homepage »
The official Blender homepage
new icon BlenderNation »
Fresh Blender News, Every Day
new icon Blenderart Magazine »
Blender articles, tutorials and images.
Blender Headlines
Featured Artwork
Short animation: Barrel by Phlopper
Woolly mammoth by sebastian_k
Photorealistic classic furniture by eMirage
Social BlenderArtists