Wish: Trigger Rendering in Grasshopper from input

It would be very helpful to be able to trigger the Render and Render Animation in Grasshopper using a button or boolean. Alternatively, it would be nice to have a boolean output of the Render node that is true while it is rendering and false while it isn’t.

I am building a render loop and need to write to an excel sheet, but I only want to trigger the writing during rendering.

There have been a few discussions on the McNeel Forum on why it is a terrible idea to hide options in right-click menus. Grasshopper is a programming language and you want to be able to expose all the options to the user in a way that they can build it how they want. Hiding things in right-click menus basically breaks those possibilities.

Thanks for considering.

Hi,

I agree, however, as discussed countless times before, triggering render, and especially render animation in this manner can cause a deadlock. Since most of the users are not really familiar with the “programming” concepts and their pitfalls, such kind of “actions” are put into the context menu.

However, your desired workflow is very much possible (which was also discussed somewhere on the forums). You simply add a script component and use it on your own risk (I assume you know what you’re doing)

here is the code for convenience

private void RunScript(object x, object y, ref object A)
{
    VRayRenderer renderer = x as VRayRenderer;
    if((bool) y)
        renderer.Render();
}

you need to reference the VRayForGrasshopper assembly:

You can take your time and explore the other methods available on the renderer component (incl. RenderAnimation()):

Happy coding

Wow, thank you, that is awesome. I totally understand the complications and potential pitfalls of doing things that might cause issues and we have always pushed Grasshopper to its limits using countless plugins and script components. I will definitely give this a go and play around! :slight_smile:

Just coming back to this and finally giving this a go. It works great. The only thing I noticed is that if you use a normal button to trigger the render, Grasshopper gets stuck in the weird limbo where you can’t click any longer. If you use the “True Only Button” from the Pancake Plugin this doesn’t happen and works just fine. Again, thanks!

There seems to be some exposure or light duplication if you have a light rigged to move between between renderings, have exposure on, and are not using the timeline component.