Announcement

Collapse
No announcement yet.

Global Material Override via Maxscript

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

  • Global Material Override via Maxscript

    Does anyone know how to access/open the V-ray Global switches > override material > include/exclude dialog window via maxscript?

  • #2
    Code:
    vr = renderers.current
    
    showinterfaces vr
    Gives us:

    Code:
    V_Ray_DEMO_3_30_03:V_Ray_DEMO_3_30_03
    
      Interface: VRay
       Properties:
        .excludeListOverrideMtl : node array : Read|Write
        .includeListOverrideMtl : node array : Read|Write
        .excludeListRenderSubset : node array : Read|Write
        .includeListRenderSubset : node array : Read|Write
       Methods:
        <integer>saveCausticsPhotonMap <filename>fileName
        <integer>saveGlobalPhotonMap <filename>fileName
        <integer>loadIrradianceMap <filename>fileName
        <integer>saveIrradianceMap <filename>fileName
        <integer>clearIrradianceMap()
        <integer>saveLightCache <filename>fileName
        <integer>clearLightCache()
        <integer>showLastVFB()
       Actions:
    OK
    so something like

    Code:
    vr.includeListOverrideMtl
    Is an array and you can use normal array commands in maxscript to add and remove objects from this. It's a node array as opposed to a normal one in case that makes any differences to the code you're searching for in the help!

    Comment


    • #3
      Thank you joconnell! I'm headed home for the night but will dig into this a bit more in the morning. At first glance, I think this may do it or at least help but I need to look into populating the exclusionListDlg() with these arrays since I essentially need to recreate that section of the Vray UI in a separate tool. I've never messed around with the Maxscript side of the exclusion list dialog before so I don't even know if it is possible to pass it arrays when opening. Was hoping for the equivalent of a VRAYexclusionListDlg() but I'll spend some more time with it in the morning. Thanks for the help!

      Comment


      • #4
        Yeah it should be just a normal list of objects that you can set or append to.

        Comment


        • #5
          Originally posted by joconnell View Post
          Yeah it should be just a normal list of objects that you can set or append to.
          just an fyi...you can't append to the list directly. See http://forums.chaosgroup.com/showthr...Maxscript-help
          Last edited by dlparisi; 21-01-2016, 08:04 AM. Reason: spend-->append
          www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

          Comment


          • #6
            Thanks guys. As expected, I stumbled into a dead end as I can not find a way to pass an array to the exclusionListDlg() so unless anyone can enlighten me to a blatant oversight, I'm dead in the water short of coding my own Include/Exclude dialog I can pass the .excludeListOverrideMtl and .includeListOverrideMtl arrays to. It seems crazy to me you can't pass this dialog an array to have it open already populated. What am I missing!?!?!?
            Last edited by bhh; 21-01-2016, 03:20 PM.

            Comment


            • #7
              What is it that you're trying to accomplish? I've written scripts to add or remove the selected objects to the override list. They don't open the dialog box though, they just add them to the list. I can post if it helps.
              www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

              Comment


              • #8
                We're developing a "Quick Render" dialog that automates all of the vray settings for key phases of our workflow. In the Camera Development phase for example, we currently use a simple Override Mtl on everything except glass, mirrors, etc. I'm able to loop through the scene geometry and automatically add *glass*, *mirror*, etc. to the exclusion list but since the user is no longer using the standard Render Setup window, if they want to manually add or remove exclusions, they need to open that dialog up and navigate into the global switches to do so. I was hoping to do it all from within this new tool.

                The workaround I may look into is to just create a .net list view with checkboxes that essentially works as a simple, alternate exclusionListDlg() where I could give the user a GUI interface to the .excludeListOverrideMtl
                Last edited by bhh; 21-01-2016, 04:10 PM.

                Comment


                • #9
                  I'm not the best at maxscript but couldn't you simply use a selectbyname dialog to build an array of objects that the user selects and add them to the override list? See below...
                  Code:
                  vr=renderers.current
                  oldExclList=vr.excludeListOverrideMtl
                  tempExclList=#()
                  currentSel=$
                  
                  
                  fn geo obj = 
                  (
                      superclassof obj==GeometryClass
                  )    
                  
                  clearSelection() clearNodeSelection redraw:false
                  select vr.excludeListOverrideMtl
                  tempExclList=selectbyname showHidden:false title: "Select Objects for Override Exclusion" filter:geo
                  select currentSel
                  
                  
                  if tempExclList!=undefined then vr.excludeListOverrideMtl = tempExclList
                  
                  
                  ---do your render here---
                  
                  
                  vr.excludeListOverrideMtl = oldExclList
                  It stores the current selection, clears it, then loads up a selectbyname with the current Exclusion list highlighted. Any changes to the list are only temporary as the original exclusion list gets replaced at the end of the script along with the original scene selection. It could easily be modified to only ADD objects to the exclusion list as well instead of replacing it. This is how I would go about it but I might not be the best reference . This just intrigued me and I thought I'd fool around a bit.
                  Last edited by dlparisi; 21-01-2016, 10:59 PM.
                  www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

                  Comment


                  • #10
                    Nice post dlparisi! I'm certainly not the best at maxscript either but that selectbyname dialog looks perfect for this application. Thank you for sharing because I wasn't familiar with it. The GUI stuff always seems to cause me the most difficulty.

                    Edit: So I just spent a little time with the docs and this Dialog suffers from the same issue that the exclusionListDlg() does in that you can not have this dialog open with items pre-selected. Ideally, the interface would open with the vr.excludeListOverrideMtl items pre-selected. I could do this with a dot net list view, for example, where it lists all the objects in a scene and then loops through the vr.excludeListOverrideMtl to "select" those items so the user can edit and manipulate the exclusions and not have to start-over each time they launch the dialog.
                    Last edited by bhh; 22-01-2016, 08:51 AM.

                    Comment


                    • #11
                      Originally posted by bhh View Post
                      Ideally, the interface would open with the vr.excludeListOverrideMtl items pre-selected. I could do this with a dot net list view, for example, where it lists all the objects in a scene and then loops through the vr.excludeListOverrideMtl to "select" those items so the user can edit and manipulate the exclusions and not have to start-over each time they launch the dialog.
                      I'm pretty sure that's what my script example does. It loads the current exclusion list into the dialog by first selecting the items in the exclusion list (via the "select vr.excludeListOverrideMtl"). When you're done selecting items and close the dialog it restores the original scene selection (via the "currentSel=$" and "select currentSel").
                      www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

                      Comment


                      • #12
                        You're right! I completely missed it the first time, the scene I had open didn't have anything stored in that array and I didn't catch what the "select vr.excludeListOverrideMtl" was doing when I skimmed through the code. This is going to work perfectly, thank you so much for following up and helping out! Makes me wonder if there is something similar with the exclusionListDlg() that I haven't found as well.

                        Thanks again. I really appreciate it.

                        Comment


                        • #13
                          Great. Glad I could help out.
                          www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

                          Comment

                          Working...
                          X