Page MenuHome

Refactor CustomData interpolation code.
ClosedPublic

Authored by Bastien Montagne (mont29) on Oct 5 2020, 6:58 PM.

Details

Summary
  • Move some security checks outside of interp callbacks. Namely, that we do get interpolation weights, and have something to interpolate. Some callbacks where not checking on those anyway, safer to move that up into calling code.
  • Cleanup usage of sub-weights, lots of interpolation callbacks wher actually using those completely wrong.
  • Change default behavior when no weights are given to higher-level API functions: prevriously, each callback was responsible to handle that case (and one did not even do it!), they were switching to purely additive behavior then. Instead, we now default to expected simple average of source values.

Note that the only real important change here is defaulting to actual
average of source value when no inertpolation weights are given (afaik,
this only happens in Weld modifier code).

Diff Detail

Repository
rB Blender

Event Timeline

Bastien Montagne (mont29) requested review of this revision.Oct 5 2020, 6:58 PM
Bastien Montagne (mont29) created this revision.

Nice refactor, at first I expected interp_weight to be the interpolated value, not the value to be interpolated.

OTOH, I can't think of a much better name, perhaps weight_value ? - since it's the value being interpolated. No strong opinion on this though.

This revision is now accepted and ready to land.Oct 8 2020, 4:09 AM

Nice refactor, at first I expected interp_weight to be the interpolated value, not the value to be interpolated.

OTOH, I can't think of a much better name, perhaps weight_value ? - since it's the value being interpolated. No strong opinion on this though.

Am not sure I understand? interp_weightis the interpolation weight applied to each value being interpolated? So I would keep value out of this, for me value is the data being interpolated, and weight if the interpolation factor applied to those during the interpolation process.

Actually, maybe using interp_factor would be clearer? And would avoid possible confusion with weights from vgroups…

You interpolate values using weights, I think that's standard math terminology we should stick to.

For vertex groups it's also called weights, since they are used as interpolation weights in armature deform.

This revision was automatically updated to reflect the committed changes.