Revision: 41711
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41711
Author: jason_hays22
Date: 2011-11-10 02:09:58 +0000 (Thu, 10 Nov 2011)
Log Message:
-----------
While reviewing this part of the code for a Blender Proceedings article, I
noticed that the lock enforcer was taking several improper steps to
redistribute evenly with multi-paint.
Beforehand, a few problems were in view: some of the indexing was changed
towards the end to use the more efficient stack structure, but needed to use
the correct def group indices.
Also, the designated selected group would use its own value to acquire the
standard to base change distributed to the others.
Lastly, the total_change was used rather than -left_overs in the formula to
compute the new designated weight within the means of the locks' allowed
changes.
Now, while maintaining the ratios of the selection, it correctly returns left
over change that could not be redistributed to the unlocked groups.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
2011-11-10 01:58:48 UTC (rev 41710)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
2011-11-10 02:09:58 UTC (rev 41711)
@@ -1342,16 +1342,16 @@
if(vgroup_validmap && total_changed < 0 && total_valid) {
totchange_allowed = total_valid;
}
+ /* the way you modify the unlocked+unchanged groups is
different depending
+ * on whether or not you are painting the weight(s) up or down
*/
+ if(totchange < 0) {
+ totchange_allowed = total_valid - totchange_allowed;
+ }
+ else {
+ totchange_allowed *= -1;
+ }
/* there needs to be change allowed, or you should not bother */
if(totchange_allowed) {
- /* the way you modify the unlocked+unchanged groups is
different depending
- * on whether or not you are painting the weight(s) up
or down */
- if(totchange < 0) {
- totchange_allowed = total_valid -
totchange_allowed;
- }
- else {
- totchange_allowed *= -1;
- }
left_over = 0;
if(fabsf(totchange_allowed) < fabsf(totchange)) {
/* this amount goes back onto the changed,
unlocked weights */
@@ -1375,11 +1375,15 @@
odw = defvert_find_index(odv,
designatedw);
storedw = ndw->weight;
for(i = 0; i < ndv->totweight; i++) {
- if(change_status[ndw->def_nr]
== 2) {
+ if(ndv->dw[i].def_nr ==
designatedw) {
+ continue;
+ }
+ ndw2 = &ndv->dw[i];
+ if(change_status[ndw2->def_nr]
== 2) {
odw2 = &odv->dw[i];
- ndw2 = &ndv->dw[i];
+
if(!designatedw_changed) {
- ndw->weight =
(totchange_allowed + odw->weight + odw2->weight)/(1.0f +
ndw2->weight/ndw->weight);
+ ndw->weight =
(-left_over + odw->weight + odw2->weight)/(1.0f + ndw2->weight/ndw->weight);
designatedw_changed = TRUE;
}
ndw2->weight =
ndw->weight * ndw2->weight / storedw;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs