I’m trying to support snapshots in my renderer, and from reading here and looking through the sdk, I gather we can only save/restore/delete snapshots via RunScript (please let me know if there is another way).
However, while this approach is working fine from within a script runner, I am (perhaps unsurprisingly) seeing strange behavior when trying to script -Snapshots from within the Render override. Here is a small example that will demonstrate the behavior:
using Rhino;
using Rhino.Commands;
using Rhino.PlugIns;
namespace TestRenderPlugIn
{
public class TestRenderPlugInPlugIn : RenderPlugIn
{
protected override Result Render(RhinoDoc doc, RunMode mode, bool fastPreview)
{
RhinoApp.RunScript("_-snapshots _save name _enter", true);
return Result.Success;
}
}
[CommandStyle(Style.ScriptRunner)]
public class TestRenderPlugInCommand : Command
{
public override string EnglishName => "TestRenderPlugInCommand";
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
RhinoApp.RunScript("_-snapshots _save name _enter", true);
return Result.Success;
}
}
}
What I am seeing here (win10, 6.20.19322.20361) is that when called from within Render, Rhino just prints ‘_-snapshots’ on the command line, and nothing else happens. The idea was to store a temporary snapshot, restore the chosen one for rendering, then restore back to the temporary and delete it after rendering, assuming there’s not some better way of supporting snapshots.