It looks like there was a change in the script editor in the latest SR that alters this behaviour.
In previous versions modifying the input mesh in a script would not actually cause the upstream object to change.
The safer option when scripting is to make a copy and modify that, so the script above would become:
private void RunScript(Mesh x, int n, ref object a)
{
Mesh m = x.DuplicateMesh();
m.Reduce(n, true, 10, true);
a = m;
}
However, there’s maybe an argument for keeping the old behaviour where this wasn’t necessary.
Hi Daniel, thanks for the insight. I don’t know what the benefit of the upstream change is and I’m a little affraid some existing scripts will have to be revised / verified…
Windows 11 (10.0.22631 SR0.0) or greater (Physical RAM: 128GB)
.NET 7.0.18
Computer platform: DESKTOP
Standard graphics configuration.
Primary display and OpenGL: NVIDIA RTX A5000 (NVidia) Memory: 22GB, Driver date: 3-12-2024 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 551.86
> Accelerated graphics device with 4 adapter port(s)
- Secondary monitor attached to adapter port #0
- Windows Main Display attached to adapter port #1
Secondary graphics devices.
NVIDIA Quadro K2200 (NVidia) Memory: 4GB, Driver date: 3-12-2024 (M-D-Y).
> Accelerated graphics device with 4 adapter port(s)
- There are no monitors attached to this device!
OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)
Anti-alias mode: 8x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High
Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 3-12-2024
Driver Version: 31.0.15.5186
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 23028 MB
Rhino plugins that do not ship with Rhino
C:\Users\martinsiegrist\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\NVIDIADenoiser\0.4.3\NVIDIADenoiser.Windows.rhp “NVIDIADenoiser.Windows” 0.4.3.0
@martinsiegrist I pushed a fix for this. It was one specific case that was missing from unit tests and I added it to my tests now so it does not happen again
Here is a simpler test file with just a sphere mesh that captures the bug: