jdhill
1
what is the recommended way to support this in a 3rd party renderer:
I have tried a few different ways, by scripting the _snapshots command, but this just seems very hacky
@nathanletwory – does raytraced do it via _snapshots, or is there some api I have missed?
nathanletwory
(Nathan 'jesterKing' Letwory)
2
The API to use is https://developer.rhino3d.com/api/rhinocommon/rhino.render.rendersourceview/rendersourceview
This you can use in the plugin overrides for Render
or RenderView
implementation of your plugin.
protected override Result Render(RhinoDoc doc, RunMode mode, bool fastPreview)
{
Rectangle fullSize = new Rectangle(new Point(0, 0), RenderPipeline.RenderSize(doc, true));
return RenderWithCycles(doc, mode, fullSize, true, fastPreview);
}
protected override Result RenderWindow(RhinoDoc doc, RunMode mode, bool fastPreview, RhinoView view, Rectangle rect, bool inWindow, bool blowup)
{
return RenderWithCycles(doc, mode, rect, inWindow, fastPreview);
}
private Result RenderWithCycles(RhinoDoc doc, RunMode mode, Rectangle rect, bool inWindow, bool fastPreview)
{
var rc = RenderPipeline.RenderReturnCode.InternalError;
using (var rsv = new RenderSourceView(doc))
{
ViewInfo vi = rsv.GetViewInfo();
if (vi == null)
return Result.Failure;
{
foreach (var vw in doc.Views)
{
try
{
// pausing any running realtime displays
if (vw != null && vw.RealtimeDisplayMode != null)
{
vw.RealtimeDisplayMode.Paused = true;
}
}
catch (Exception)
{
// pass
}
}
}
// set up your renderer, pass it on the vi you found.
}
1 Like