Hello,
There seems to be an issue with undo not working properly for material changes made via a script.
For example, when running a script that changes material color of a selected layer, and then Undoing the script, visually (in viewport) all looks OK as if the change was reverted, but the material color in Material Editor stays as if Undo did nothing, and also when file gets saved and reopened, the Undo had no effect and the changed version of the material is saved in the file.
Here is sample file (for the script to work, Custom material needs to be assigned to selected layer, and the layer “selected” in the Layers panel): ScriptedMaterialChangeUndo_Problem.3dm (254.5 KB)
This happens regardless if I use simple RhinoScript method like this:
Option Explicit
Call Main()
Sub Main()
Dim i : i = Rhino.LayerMaterialIndex(Rhino.SelectedLayers()(0))
Call Rhino.MaterialColor(i, vbRed)
End Sub
or use RDK method:
Option Explicit
Call Main()
Sub Main()
Dim i : i = Rhino.LayerMaterialIndex(Rhino.SelectedLayers()(0))
Dim rdk : Set rdk = Rhino.GetPlugInObject("Renderer Development Kit")
Dim idRDK : idRDK = rdk.MaterialInstanceId(i)
Call rdk.ContentParameter(idRDK, "diffuse", vbRed)
End Sub
@Dale, do you have any idea why this may be happening?
@johnc, pinging you as well since in the past you managed to help solve similar issues.
Any help and insight would be greatly appreciated. Thank you-
–jarek
1 post - 1 participant