Unwrap UVW Flatten Mapping Limit


I’m encountering a strange issue where there appears to be a limit to the number of nodes to which I can add an Unwrap UVW modifier and run Flatten. I first noticed this when attempting to write a script to flatten all UVs in a selection.

fn Flatten o =
    select o
    uv = Unwrap_UVW()
    addModifier o uv
for s in getCurrentSelection() do
    Flatten s

This script worked for small selections, but when the selection was more than about 10 nodes, the earlier nodes in the selection would not have the flattening applied. The later nodes would still be fine, but the earlier nodes seemed to have been “reset”, even though they still had the Unwrap UVW modifier.

I was able to replicate this manually by selecting a node, adding the Unwrap UVW modifier, opening the UV Editor dialog, and running Flatten: Custom. After repeating this for 10 nodes, I went back to the first node and opened the UV Editor, and the UVs had been reset. Any help or guidance with this issue would be appreciated!