Announcement

Collapse
No announcement yet.

Help - a Script that will Select Objects (Geo and Spline)with NO V-Ray Mat Assigned

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

  • Help - a Script that will Select Objects (Geo and Spline)with NO V-Ray Mat Assigned

    Please can someone point me to a script that will do what I am asking in the title of this thread ?

    i.e.

    I want to create a toolbar button which when pressed Selects/highlights all objects and splines which have NOT got a V-Ray material assigned.

    So, for example, a Standard material would also be classed as NO material for me, so that object/spline should also be included in the selection set.

    OR;

    A Script that can Select Objects/Shapes which have Standard Materials assigned. And another script which will select objects which have V-Ray materials assigned.

    Many thanks.
    Last edited by JezUK; 01-07-2016, 02:44 AM.
    Jez

    ------------------------------------
    3DS Max 2023.3.4 | V-Ray 6.10.08 | Phoenix FD 4.40.00 | PD Player 64 1.0.7.32 | Forest Pack Pro 8.2.2 | RailClone 6.1.3
    Windows 11 Pro 22H2 | NVidia Drivers 535.98 (Game Drivers)

    Asus X299 Sage (Bios 4001), i9-7980xe, 128Gb, 1TB m.2 OS, 2 x NVidia RTX 3090 FE
    ---- Updated 06/09/23 -------

  • #2
    Here's a really quick one which select all the objects that have VRay shaders.

    Code:
    (
    	local arrObjs = #()
    	
    	for i in objects where (ClassOf i.material == VRayMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRay2SidedMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayBlendMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayBumpMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayCarPaintMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayFastSSS2) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayFlakesMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayGLSLMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayHairMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayMtlWrapper) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayOSLMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayOverrideMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayPointParticleMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayScannedMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayScatterVolume) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRaySimbiontMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRaySkinMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayStochasticFlakesMtl) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayVectorDIsplBake) do append arrObjs i
    	for i in objects where (ClassOf i.material == VRayVRMatMtl) do append arrObjs i
    	
    	
    	select arrObjs
    )
    Software:
    Windows 7 Ultimate x64 SP1
    3ds Max 2016 SP4
    V-Ray Adv 3.60.04


    Hardware:
    Intel Core i7-4930K @ 3.40 GHz
    NVIDIA GeForce GTX 780 (4096MB RAM)
    64GB RAM


    DxDiag

    Comment


    • #3
      pretty usedful, did it work?
      Architectural and Product Visualization at MITVIZ
      http://www.mitviz.com/
      http://mitviz.blogspot.com/
      http://www.flickr.com/photos/shawnmitford/

      i7 5960@4 GHZm, 64 gigs Ram, Geforce gtx 970, Geforce RTX 2080 ti x2

      Comment


      • #4
        Code:
        (
            local theObjs=#()
            for o in geometry where (classof o != targetObject) and (not (matchpattern ((classof o.material) as string) pattern:"VRay*")) do append theObjs o
            clearNodeSelection redraw:false
            select theObjs
        )
        This does.

        edit: o in GEOMETRY, not objects, sorry. silly mistake.
        Last edited by ^Lele^; 01-07-2016, 06:19 AM.
        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
          Originally posted by ^Lele^ View Post
          Code:
          (
              local theObjs=#()
              for o in geometry where (classof o != targetObject) and (not (matchpattern ((classof o.material) as string) pattern:"VRay*")) do append theObjs o
              clearNodeSelection redraw:false
              select theObjs
          )
          This does.

          edit: o in GEOMETRY, not objects, sorry. silly mistake.
          yeah, Lele did it again thanks, mate, this will be useful for sure !
          Nicolas Caplat
          www.intangibles.fr

          Comment


          • #6
            Yep. nice for sure
            Software:
            Windows 7 Ultimate x64 SP1
            3ds Max 2016 SP4
            V-Ray Adv 3.60.04


            Hardware:
            Intel Core i7-4930K @ 3.40 GHz
            NVIDIA GeForce GTX 780 (4096MB RAM)
            64GB RAM


            DxDiag

            Comment


            • #7
              Eheh, Art, i never noticed your script until after i previewed the post, so went ahead nevertheless.
              The only few differences is that i won't select anything else than geometry, so no lights, cameras, helpers or targets.
              Besides having been a LOT lazier with the typing, that is
              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


              • #8
                Originally posted by ^Lele^ View Post
                Code:
                (
                    local theObjs=#()
                    for o in geometry where (classof o != targetObject) and (not (matchpattern ((classof o.material) as string) pattern:"VRay*")) do append theObjs o
                    clearNodeSelection redraw:false
                    select theObjs
                )
                This does.

                edit: o in GEOMETRY, not objects, sorry. silly mistake.
                Thanks Lele, this is great.

                What if I wanted the same script but instead it selects geometry (including "rendered shapes") that have NO material or NO V-RAY material assigned ?
                Jez

                ------------------------------------
                3DS Max 2023.3.4 | V-Ray 6.10.08 | Phoenix FD 4.40.00 | PD Player 64 1.0.7.32 | Forest Pack Pro 8.2.2 | RailClone 6.1.3
                Windows 11 Pro 22H2 | NVidia Drivers 535.98 (Game Drivers)

                Asus X299 Sage (Bios 4001), i9-7980xe, 128Gb, 1TB m.2 OS, 2 x NVidia RTX 3090 FE
                ---- Updated 06/09/23 -------

                Comment


                • #9
                  Originally posted by ^Lele^ View Post
                  ... Besides having been a LOT lazier with the typing, that is
                  I'm pretty sure you are NOT lazy with the typing
                  paolo vaja
                  www.3d-arch.it

                  Comment


                  • #10
                    Originally posted by JezUK View Post
                    Thanks Lele, this is great.

                    What if I wanted the same script but instead it selects geometry (including "rendered shapes") that have NO material or NO V-RAY material assigned ?
                    The script will select either: if you read the condition carefully, it says "select anything for which 'VRay' isn't found in the material class name"
                    So standard materials and "undefined" (no material assigned, undefined class) will get selected.

                    Because it works on the "geometry" superclass, anything from nurbs to splines, renderable or not, will be considered.
                    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


                    • #11
                      Just thinking out loud here, but what about objects with multisub materials?
                      A.

                      ---------------------
                      www.digitaltwins.be

                      Comment

                      Working...
                      X