Announcement

Collapse
No announcement yet.

Micha's Render Tools (Render Queue)

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

  • Micha's Render Tools (Render Queue)

    Hello, all

    I am using Micha's render tools and within the tools, there are scripts written by Gelfling in 04.

    This buttons save views and render all the saved views with another button.

    Only issue is that the button saves views in parallel perspective regardless of my current normal perspective. (I want to save in normal perspective).

    Can someone who knows about scripting help me out? (I have no knowledge on scripting..)

    I really need you guys' help

    Thank you in advance!

    ========= SCRIPT TO ADD SCENES=========
    -_RunScript (
    Option Explicit
    'Script written by Gelfling '04

    Sub AddQueueElement()
    Dim strCurrentView 'As String
    Dim curCamPosition 'As PointArray
    Dim curTarPosition 'As PointArray
    Dim curPerspective 'As Boolean
    Dim curPerspectiveAngle 'As Double
    Dim curViewUpVector 'As PointArray
    Dim strQueueCode 'As String
    Dim allCodes 'As StringArray

    strCurrentView = Rhino.CurrentView
    If Rhino.IsViewPerspective(strCurrentView) Then
    curPerspective = True
    curCamPosition = Rhino.ViewCamera(strCurrentView)
    curTarPosition = Rhino.ViewTarget(strCurrentView)
    curViewUpVector = Rhino.ViewCameraUp(strCurrentView)
    curPerspectiveAngle = Rhino.ViewCameraLens(strCurrentView)
    Else
    curPerspective = False
    curCamPosition = Rhino.ViewCamera(strCurrentView)
    curTarPosition = Rhino.ViewTarget(strCurrentView)
    curViewUpVector = Rhino.ViewCameraUp(strCurrentView)
    curPerspectiveAngle = 1.5E300
    End If

    allCodes = AllQueueCodes()
    If IsNull(allCodes) Then
    strQueueCode = Rhino.StringBox("Name of new queue element [" & strCurrentView & "]", strCurrentView, "Render queue manager")
    If IsNull(strQueueCode) Then Exit Sub
    Else
    strQueueCode = Rhino.ComboListBox (allCodes, "Name of new queue element", "Render queue manager")
    If IsNull(strQueueCode) Then Exit Sub
    End If

    AddQueueCode strQueueCode, curCamPosition, curTarPosition, curPerspective, curPerspectiveAngle, curViewUpVector

    End Sub
    AddQueueElement

    Function AllQueueCodes()
    AllQueueCodes = Null
    Dim allCodes
    Dim i, N
    Dim queCodes()

    allCodes = Rhino.GetDocumentData()
    If Not IsArray(allCodes) Then Exit Function
    N = 0
    For i = 0 To UBound(allCodes)
    If Left(allCodes(i),14) = "GELFLINGQUEUE_" Then
    ReDim Preserve queCodes(N)
    queCodes(N) = Mid(allCodes(i),15)
    N = N+1
    End If
    Next
    If N = 0 Then Exit Function
    AllQueueCodes = queCodes
    End Function

    Function IsQueueCode(strQueueCode)
    Dim varRet
    IsQueueCode = False
    varRet = Rhino.GetDocumentData("GELFLINGQUEUE_" & strQueueCode)
    If Not IsNull(varRet) Then IsQueueCode = True
    End Function

    Function AddQueueCode(strCode, arrCam, arrTar, blnPerspective, dblAngle, arrUp)
    Rhino.SetDocumentData "GELFLINGQUEUE_" & strCode, "CAMERA", Rhino.Pt2Str(arrCam)
    Rhino.SetDocumentData "GELFLINGQUEUE_" & strCode, "TARGET", Rhino.Pt2Str(arrTar)
    Rhino.SetDocumentData "GELFLINGQUEUE_" & strCode, "VIEWUP", Rhino.Pt2Str(arrUp)
    If blnPerspective Then
    Rhino.SetDocumentData "GELFLINGQUEUE_" & strCode, "TYPE", "Perspective"
    Else
    Rhino.SetDocumentData "GELFLINGQUEUE_" & strCode, "TYPE", "Parallel"
    End If
    Rhino.SetDocumentData "GELFLINGQUEUE_" & strCode, "ANGLE", CStr(dblAngle)
    AddQueueCode = True
    End Function
    )

    =======SCRIPT TO RENDER ALL SAVED SCENES IN THE QUEUE=======================

    -_RunScript (
    Option Explicit
    'Script written by Gelfling '04
    'Change: Updated/Fixed formats 'Damien Alomar, ASGvis

    Sub RenderQueue()
    Dim allCodes, chkCodes()
    Dim selCodes
    Dim i
    Dim strFolderPath
    Dim FileFormat
    Dim curView

    curView = Rhino.CurrentView
    allCodes = AllQueueCodes
    If IsNull(allCodes) Then
    Rhino.Print "There are no stored views in the render-queue"
    Exit Sub
    End If

    ReDim chkCodes(UBound(allCodes))
    For i = 0 To UBound(chkCodes)
    chkCodes(i) = vbTrue
    Next

    selCodes = Rhino.CheckListBox(allCodes, chkCodes, "Select queue elements to render", "Render queue manager")
    If IsNull(selCodes) Then Exit Sub

    FileFormat = Rhino.ListBox(Array("JPEG", "Bitmap", "Targa", "Tiff", "PNG", "HDR", "EXR"), "Select a fileformat to use", "Render queue manager")
    If IsNull(FileFormat) Then Exit Sub
    Select Case UCase(FileFormat)
    Case "JPEG": FileFormat = ".jpeg"
    Case "BITMAP": FileFormat = ".bmp"
    Case "TARGA": FileFormat = ".tga"
    Case "TIFF": FileFormat = ".tiff"
    Case "PNG": FileFormat = ".png"
    Case "HDR": FileFormat = ".hdr"
    Case "EXR": FileFormat = ".exr"
    Case Else: FileFormat = ".bmp"
    End Select

    strFolderPath = Rhino.BrowseForFolder(,"Select a folder to save to", "Render queue manager")
    If IsNull(strFolderPath) Then Exit Sub

    If msgBox("Are you sure all settings are correct?" & vbNewLine & _
    "Render engine, resolution, quality...", _
    vbYesNo Or vbQuestion, "Render queue manager") = vbNo Then Exit Sub

    For i = 0 To UBound(allCodes)
    If selCodes(i) Then
    Rhino.Print "Element [" & allCodes(i) & "] restored..."
    Call RestoreQueueCode(allCodes(i), curView)
    Rhino.Command "-_Render", vbFalse
    Rhino.Command "-_SaveRenderWindowAs " & Chr(34) & strFolderPath & allCodes(i) & FileFormat & Chr(34), vbFalse
    Rhino.Command "-_CloseRenderWindow", vbFalse
    Else
    Rhino.Print "Element [" & allCodes(i) & "] skipped in queue..."
    End If
    Next

    Rhino.Print "Completed!"
    End Sub
    RenderQueue

    Function AllQueueCodes()
    AllQueueCodes = Null
    Dim allCodes
    Dim i, N
    Dim queCodes()

    allCodes = Rhino.GetDocumentData()
    If Not IsArray(allCodes) Then Exit Function
    N = 0
    For i = 0 To UBound(allCodes)
    If Left(allCodes(i),14) = "GELFLINGQUEUE_" Then
    ReDim Preserve queCodes(N)
    queCodes(N) = Mid(allCodes(i),15)
    N = N+1
    End If
    Next
    If N = 0 Then Exit Function
    AllQueueCodes = queCodes
    End Function

    Function RestoreQueueCode(strCode, strView)
    Rhino.EnableRedraw vbFalse
    Dim newCamPosition 'As PointArray
    Dim newTarPosition 'As PointArray
    Dim newPerspective 'As Boolean
    Dim newPerspectiveAngle 'As Double
    Dim newViewUpVector 'As PointArray

    newCamPosition = Rhino.Str2Pt(Rhino.GetDocumentData("GELFLINGQUEUE_ " & strCode, "CAMERA"))
    newTarPosition = Rhino.Str2Pt(Rhino.GetDocumentData("GELFLINGQUEUE_ " & strCode, "TARGET"))
    If Rhino.GetDocumentData("GELFLINGQUEUE_" & strCode, "TYPE") = "Perspective" Then
    newPerspective = True
    Else
    newPerspective = False
    End If

    newPerspectiveAngle = CDbl(Rhino.GetDocumentData("GELFLINGQUEUE_" & strCode, "ANGLE"))
    newViewUpVector = Rhino.Str2Pt(Rhino.GetDocumentData("GELFLINGQUEUE_ " & strCode, "VIEWUP"))

    If newPerspective Then
    Rhino.ViewProjection strView, 0
    Rhino.ViewCameraTarget strView, newCamPosition, newTarPosition
    Rhino.ViewCameraUp strView, newViewUpVector
    Rhino.ViewCameraLens strView, newPerspectiveAngle
    Else
    Rhino.ViewProjection strView, 1
    Rhino.ViewCameraTarget strView, newCamPosition, newTarPosition
    Rhino.ViewCameraUp strView, newViewUpVector
    End If
    Rhino.EnableRedraw vbTrue
    RestoreQueueCode = True
    End Function
    )

    ================================================== ================

  • #2
    when was the last time you used these successfully? what version of rhino? I can't get the "SCRIPT TO RENDER ALL SAVED SCENES IN THE QUEUE" script to run at all, lots of errors, i'm wondering if this uses an old version of rhino script.
    emil mertzel
    vray4rhinoWiki

    Lookinglass Architecture and Design

    Comment


    • #3
      Thank you for your reply.
      I use Rhino 5 64 bits. I can use it fine now as well but the issue is they are all saved in the parallel perspective. I really need help from someone that knows scripting language..
      I think you need the whole package. Do you want me to send you the render tools toolbar?

      Originally posted by fooprobe View Post
      when was the last time you used these successfully? what version of rhino? I can't get the "SCRIPT TO RENDER ALL SAVED SCENES IN THE QUEUE" script to run at all, lots of errors, i'm wondering if this uses an old version of rhino script.

      Comment


      • #4
        What is your email address? I will send you the whole toolbar package or you can also download it from Micha's post on tip, tutorials forum

        Originally posted by fooprobe View Post
        when was the last time you used these successfully? what version of rhino? I can't get the "SCRIPT TO RENDER ALL SAVED SCENES IN THE QUEUE" script to run at all, lots of errors, i'm wondering if this uses an old version of rhino script.

        Comment


        • #5
          I'm pretty sure I have it somewhere. I'll load it and take a look.
          emil mertzel
          vray4rhinoWiki

          Lookinglass Architecture and Design

          Comment


          • #6
            Hello, fooprobe!
            Thank you so much. Could you please let me know as soon as you check it out? You can also download the toolbar if you go to the tutorials, tips forum. It is one of the sticky posts!

            Originally posted by fooprobe View Post
            I'm pretty sure I have it somewhere. I'll load it and take a look.

            Comment


            • #7
              Ok, so good news and bad news.

              Good: I found why it was changing to parallel view and fixed it - rhinoscript changed the way one of their commands (ViewProjection) works so a change had to be made in the "render a queue" and "restore a queue" scripts.

              Bad: I'm having problems using this with Vray 1.50.xx No problem using rhino render, and i imagine it will be ok with Vray 1.05. Vray has also changed, and now rhinoscript can't tell when the rendering is done, and so this script saves the frame buffer almost immediately after the rendering starts, instead of at the end.

              I'm attaching the updated toolbar, in case it's useful to you, but if you're using 1.50 it probably won't be:

              RenderTools_tb_R5.zip

              good luck
              emil mertzel
              vray4rhinoWiki

              Lookinglass Architecture and Design

              Comment


              • #8
                Hello! fooprobe!

                This is fantastic. Thank you very much for your help. Do you mind sending me via email? puha0941@hotmail.com
                I do not have the permission to download, the forum says..

                Perhaps, for the bad news, did you tick the "batch render" option in vray 1.50.xx. (I cannot confirm this because I am using the veta version 1.48 xx something for now but if they are the same, ticking the batch render button made the queue work for me. When I do not have it ticked on, then it crashes.

                Thank you for your great effort!! much appreciated..! By the way, I want to learn scripting and I would like to know which one would be the best to start.. there are so many kinds.. c#, c++, Phyton ... etc

                Originally posted by fooprobe View Post
                Ok, so good news and bad news.

                Good: I found why it was changing to parallel view and fixed it - rhinoscript changed the way one of their commands (ViewProjection) works so a change had to be made in the "render a queue" and "restore a queue" scripts.

                Bad: I'm having problems using this with Vray 1.50.xx No problem using rhino render, and i imagine it will be ok with Vray 1.05. Vray has also changed, and now rhinoscript can't tell when the rendering is done, and so this script saves the frame buffer almost immediately after the rendering starts, instead of at the end.

                I'm attaching the updated toolbar, in case it's useful to you, but if you're using 1.50 it probably won't be:

                [ATTACH]12952[/ATTACH]

                good luck

                Comment


                • #9
                  I tested it with batch render enabled and it works fine.

                  Thank you,
                  Micha
                  www.simulacrum.de - visualization for designer and architects

                  Comment


                  • #10
                    email sent.

                    well, that's embarrasing. Yeah, it was just the batch render switch. I was remembering the problem outlined in this thread:
                    http://www.chaosgroup.com/forums/vbu...487#post552487
                    but I clearly forgot the solution =) which is also clearly indicated there. oops.

                    As for scripting.... if you have a background in simple programming (any language) then you can learn to script without a huge effort. I haven't really learned rhinoscript or rhinopython (or autolisp - anyone remember that one?) to any deep deep level - but i don't do this for a living, just when i need something specific. so i just research what i need to do - scripting languages are pretty easy to pick up and there's a ridiculous amount of info online. my code is not elegant but i don't mind as long as it works. on the other hand, i wind up giving up on some things (and making a mess for myself on others) because i don't really understand the full potential of the language.

                    If you don't have a background in coding and are looking to learn something that works with rhino, i find rhinoscript (vbscript) a little easier than python, at least when learning it. There are great resources here:
                    http://wiki.mcneel.com/developer/rhinoscript
                    and here:
                    http://www.kokkugia.com/wiki/index.p...t_introduction

                    good luck.

                    -e
                    emil mertzel
                    vray4rhinoWiki

                    Lookinglass Architecture and Design

                    Comment


                    • #11
                      ALSO - please note that R5 now supports TWO kinds of perspective viewports: the usual 3-point perspective and a new 2-point perspective. the old toolbar code couldn't take this into consideration since it didn't exist back then, so when saving the queue it just made a distinction between parallel and perspective type views - and this is where the error was coming from. i changed the code so that if it detected ANY KIND OF PERSPECTIVE VIEWPORT it would consider it 3-point. this will obviously cause problems if you use 2-point viewports. i really don't have the time right now to rebuild the code to account for it (though it probably wouldn't be hard to do) so please be aware of this problem.

                      I also wonder why the code doesn't just save viewports and restore them - it actually builds its own viewport queue and that's where the problem is. it would be simpler just to save and restore. again, this will have to be a problem for another day. i still haven't had a chance to update my own little UI project.
                      emil mertzel
                      vray4rhinoWiki

                      Lookinglass Architecture and Design

                      Comment


                      • #12
                        Great Stuff! Got it fixed finally! yay!
                        Thanks everyone

                        Originally posted by Micha_cg View Post
                        I tested it with batch render enabled and it works fine.

                        Thank you,
                        Micha

                        Comment


                        • #13
                          Hi, Fooprobe

                          Thank you for your tips. I will look into it! I wish I will be able to at least understand and perhaps be able to write as well.

                          Best,
                          C

                          Originally posted by fooprobe View Post
                          email sent.

                          well, that's embarrasing. Yeah, it was just the batch render switch. I was remembering the problem outlined in this thread:
                          http://www.chaosgroup.com/forums/vbu...487#post552487
                          but I clearly forgot the solution =) which is also clearly indicated there. oops.

                          As for scripting.... if you have a background in simple programming (any language) then you can learn to script without a huge effort. I haven't really learned rhinoscript or rhinopython (or autolisp - anyone remember that one?) to any deep deep level - but i don't do this for a living, just when i need something specific. so i just research what i need to do - scripting languages are pretty easy to pick up and there's a ridiculous amount of info online. my code is not elegant but i don't mind as long as it works. on the other hand, i wind up giving up on some things (and making a mess for myself on others) because i don't really understand the full potential of the language.

                          If you don't have a background in coding and are looking to learn something that works with rhino, i find rhinoscript (vbscript) a little easier than python, at least when learning it. There are great resources here:
                          http://wiki.mcneel.com/developer/rhinoscript
                          and here:
                          http://www.kokkugia.com/wiki/index.p...t_introduction

                          good luck.

                          -e

                          Comment


                          • #14
                            Very clear. Yes, the two point perspective is something new in Rhino 5. Perhaps the two-point perspective will be the next task for me. It can be a good challenge for me to figure it out myself.

                            Thank you for your help Fooprobe

                            Originally posted by fooprobe View Post
                            ALSO - please note that R5 now supports TWO kinds of perspective viewports: the usual 3-point perspective and a new 2-point perspective. the old toolbar code couldn't take this into consideration since it didn't exist back then, so when saving the queue it just made a distinction between parallel and perspective type views - and this is where the error was coming from. i changed the code so that if it detected ANY KIND OF PERSPECTIVE VIEWPORT it would consider it 3-point. this will obviously cause problems if you use 2-point viewports. i really don't have the time right now to rebuild the code to account for it (though it probably wouldn't be hard to do) so please be aware of this problem.

                            I also wonder why the code doesn't just save viewports and restore them - it actually builds its own viewport queue and that's where the problem is. it would be simpler just to save and restore. again, this will have to be a problem for another day. i still haven't had a chance to update my own little UI project.

                            Comment


                            • #15
                              Hello, Fooprobe!

                              I thought it would be nice to send you the update on the render queue button script. It was done by someone. It fixes "pong" to "png" and adds other vray supported output foramts to the button.

                              By the way, would it be very hard to write the code so that the script can understand and take into consideration of the two-point perspective option?
                              I tried to understand how the script works and it is very slow.. at this point it is super challenging for me to write it...
                              I wonder how long it would take for you to write the script so that it also works for the two-point perspective as well.
                              It would be fantastic for renderings like architectural scenes...

                              Please let me know,
                              I am sending you the render queue button update via email

                              Best,
                              C

                              Originally posted by fooprobe View Post
                              ALSO - please note that R5 now supports TWO kinds of perspective viewports: the usual 3-point perspective and a new 2-point perspective. the old toolbar code couldn't take this into consideration since it didn't exist back then, so when saving the queue it just made a distinction between parallel and perspective type views - and this is where the error was coming from. i changed the code so that if it detected ANY KIND OF PERSPECTIVE VIEWPORT it would consider it 3-point. this will obviously cause problems if you use 2-point viewports. i really don't have the time right now to rebuild the code to account for it (though it probably wouldn't be hard to do) so please be aware of this problem.

                              I also wonder why the code doesn't just save viewports and restore them - it actually builds its own viewport queue and that's where the problem is. it would be simpler just to save and restore. again, this will have to be a problem for another day. i still haven't had a chance to update my own little UI project.

                              Comment

                              Working...
                              X