Auto-Normalization Script **updated 1.1 (2.49)

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:[INDENT]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.
[/INDENT]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 :slight_smile:


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

Nice work, I can see myself using this script.
You video tutorial was a bit messy but I think I got it. :slight_smile:

Yeah… I was nervous lol.

I hope you find the script useful! I look forward to any thoughts you have after using it :yes:

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.

Oh my :eek: Well hopefully someone more knowledgeable with scripting will be able to help fix bugs if there are a lot of them! lol… :spin:

Edit: But I shall do my best to fix them myself! :smiley:

I just wanted to tell you that this script is a life saver! :smiley:

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! :cool:

Awesome Llew! :smiley:

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


Oh yeah. :yes:

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.


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?

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.

Thanks mikahl :slight_smile:

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!

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.

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 :slight_smile:

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:

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 :yes:

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 :slight_smile:

Myself included :yes: So you’re most welcome! :smiley:

Well I’m pleased to see that no one has encountered any bugs so far! :yes: 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. :cool:

I tried, but i couldm’t get the way to make it function