Announcement

Collapse
No announcement yet.

Wish: Trigger Rendering in Grasshopper from input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    Hi,

    Originally posted by seltzdesign View Post
    Grasshopper is a programming language.
    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)

    Click image for larger version

Name:	Untitled.png
Views:	366
Size:	76.8 KB
ID:	1113332

    here is the code for convenience
    Code:
    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:

    Click image for larger version

Name:	Untitled2.png
Views:	342
Size:	23.4 KB
ID:	1113331

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

Name:	Untitled3.png
Views:	331
Size:	11.2 KB
ID:	1113333

    Happy coding
    Attached Files

    Comment


    • #3
      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!

      Comment


      • #4
        Originally posted by nikolay.bakalov View Post

        You can take your time and explore the other methods available on the renderer component (incl. RenderAnimation()):
        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!

        Comment


        • #5
          The Grasshopper Python approach described in the Chaos help docs worked for my situation. It runs every time there is a new GH solution, so if you are looping, there is no need for a trigger variable.

          Edit: This approach also requires additional script following the custom trigger call that checks to see if the render has posted to the animation directory before the next grasshopper loop is allowed to proceed.
          Last edited by matthew_flamm; 08-02-2022, 01:17 PM.

          Comment


          • #6
            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.
            Last edited by matthew_flamm; 10-02-2022, 02:42 PM.

            Comment

            Working...
            X