Announcement

Collapse
No announcement yet.

script: Vray Proxy Display Changer

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

  • script: Vray Proxy Display Changer

    Here's a script that I wrote to quickly switch between display modes for VRay Proxies. I'm not experienced with writing maxscript, but I've been using it for about a month and its been very helpful. Works with groups and mixed selections. Any improvements are certainly welcome.

    EDIT: Updated link here
    11/23/2022
    Last edited by maxedesa; 23-11-2022, 02:26 PM.

  • #2
    A few comments.

    The functions you are calling are being defined in the global scope, this means that you can access the functions outside of the tool, this may be what you want to happen but the best practice is to keep the functions in the scope of the tool when possible, this stops peoples global names mixing with other tools.

    The other thing you need to be aware of is if someone adds a modifier onto a vraymesh it changes the class from Vray_proxy to say Editable_mesh or editable_Poly, so the way around this is to query the baseObject property of each object (kind of like the shape node in maya).

    Adjusted below.

    Code:
    -- vrpDisplay v0.61
    -- VRay Proxy Display Changer
    -- Quickly switch between preview modes
    -- This short script is considered open source; if you improve upon it, please share 
    -- Written by Caleb Dermyer
    -- caleb@cdermyer.com
    
    macroScript vrpDisplay
        category:"Caleb"
        toolTip:"vrpDisplay"
    (
    
    
    
        rollout vrpDisplay_roll "VRay Proxy Display Changer v0.61" (
            group "Change Proxy Display in Selection" (
                button btn_faces "Preview Faces" across:2 width:140
                button btn_mesh "Show Whole Mesh" width:140
                progressbar prg
            )
            group "About" (
                label lbl1 "Quickly switch between previewing Faces or Full Mesh " align:#left
                label lbl2 "for VRay Proxies in selection " align:#left
                label lbl3 "C Dermyer" align:#left
            )
            function vrpDispFaces =
            (
                for o in selection where classOf o.baseObject == VRayProxy do (
                    o.display= 3
                )
            )
            function vrpDispMesh =
            (
                for o in selection where classOf o.o.baseObject  == VRayProxy do (
                    o.display= 4
                )
            )
    
            on btn_faces pressed do vrpDispFaces()
            on btn_mesh pressed do vrpDispMesh()
        )
        try (DestroyDialog vrpDisplay_roll) catch()
        createDialog vrpDisplay_roll 300 220
    
    
    )
    Maxscript made easy....
    davewortley.wordpress.com
    Follow me here:
    facebook.com/MaxMadeEasy

    If you don't MaxScript, then have a look at my blog and learn how easy and powerful it can be.

    Comment


    • #3
      Originally posted by Dave_Wortley View Post
      Code:
      for o in selection where classOf o.o.baseObject == VRayProxy do (
      A small typo: double "o."
      Last edited by Haider_of_Sweden; 20-03-2020, 03:22 PM.
      Kindly,
      Haider

      Comment


      • #4
        Originally posted by maxedesa View Post
        (I can't upload the script here for some reason; "Invalid File")
        Zip it, it'll work.
        Lele
        Trouble Stirrer in RnD @ Chaos
        ----------------------
        emanuele.lecchi@chaos.com

        Disclaimer:
        The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

        Comment


        • #5
          out of curiosity: Say that, after you press one button to turn all objects to Preview Faces - you press the button to turn them all back to whatever they were.
          Would a feature like this be doable?
          If yes, where/how would all those object's previews be temporary stored.
          Or maybe, this could work only as long you dont unselect, ie once you unselect it forgets.

          Kindly,
          Haider

          Comment


          • #6
            You can store it into either files, temporarily in memory, and so on.
            It's generally a true PITA to keep track though, because people will delete or rename the proxy after the list was compiled, or some other such thing, so the amount of checks to be done tendentially become far more code than the actual functions to store and retrieve the previous visibility state.
            It can surely be done, though.
            Lele
            Trouble Stirrer in RnD @ Chaos
            ----------------------
            emanuele.lecchi@chaos.com

            Disclaimer:
            The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

            Comment

            Working...
            X