Announcement

Collapse
No announcement yet.

select all objects with incompatible materials?

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

  • select all objects with incompatible materials?

    does such a script exist? i cant find anything on scriptspot.

  • #2
    Had same issue, KStudio path was suggested, didnt try it yet (has some options like selecting by name etc.) but what actually solved everything is Vrayscene converter without bothering with those mats anymore
    www.yellimages.com

    Comment


    • #3
      these are octane materials, there isnt any kind of converter that ive found.. id love it if vray scene converter was a bit more full-featured. it would make collaborating with an octane user a damn sight easier!

      Comment


      • #4
        I use this:
        Code:
        (
            local allSceneMats
        
            fn matSortFN mat1 mat2 =
            (
                case of
                (
                    (mat1.name < mat2.name):-1
                    (mat1.name > mat2.name):1
                    default:0
                )
            )
        
            fn getSceneMats =
            (
                local sceneMats = #()
                for c in material.classes where c.creatable == true do
                (
                    mats = getClassInstances c
                    join sceneMats mats
                )
                qsort sceneMats matSortFN
                sceneMats
            )
        
            fn analyseScene =
            (
                clearListener()
                allSceneMats = getSceneMats()
                for om in allSceneMats where (not (areMtlAndRendererCompatible om renderer:(vray())) or (isKindOf om architectural)) do format "% - % %\n" (classOf om) om.name (refs.dependentNodes om)
            )
            analyseScene()
        )
        It prints to the listener the names of any materials that aren't compatible with V-Ray and lists the names of any objects that they are applied to. It could be adapted to select the objects instead very easily.
        Dan Brew

        Comment


        • #5
          If u make this script select em as well, u rock
          www.yellimages.com

          Comment


          • #6
            agreed

            ive got no scriptin' so it would be a big favour.

            Comment


            • #7
              Ok, here's an updated script that selects all objects that have incompatible materials.
              Code:
              (
                  clearSelection()
                  clearListener()
              
                  fn matSortFN mat1 mat2 =
                  (
                      case of
                      (
                          (mat1.name < mat2.name):-1
                          (mat1.name > mat2.name):1
                          default:0
                      )
                  )
              
                  fn getSceneMats =
                  (
                      local sceneMats = #()
                      for c in material.classes where c.creatable do
                      (
                          mats = getClassInstances c
                          join sceneMats mats
                      )
                      qsort sceneMats matSortFN
                      sceneMats
                  )
              
                  fn analyseScene =
                  (
                      local objs = #()
                      for om in getSceneMats() where (not (areMtlAndRendererCompatible om renderer:(vray())) or (isKindOf om architectural)) do
                      (
                          local nodes = refs.dependentNodes om
                          format "% - % %\n" (classOf om) om.name nodes
                          for n in nodes do appendIfUnique objs n
                      )
                      select objs
                  )
                  analyseScene()
              )
              It's a bit difficult to test as I don't have Octane installed so let me know if it doesn't work.
              Dan Brew

              Comment


              • #8
                thanks!

                if i wanted to give this to my colleague, who uses Octane.. is there a way to make it renderer agnostic (i.e. it will select objects with materials that are incompatible with *whatever* the current renderer is?) or would that involve code specific to each renderer?

                Comment


                • #9
                  Originally posted by super gnu View Post
                  thanks!

                  if i wanted to give this to my colleague, who uses Octane.. is there a way to make it renderer agnostic (i.e. it will select objects with materials that are incompatible with *whatever* the current renderer is?) or would that involve code specific to each renderer?
                  No it's quite straightforward...
                  Code:
                  (
                      clearSelection()
                      clearListener()
                  
                      fn matSortFN mat1 mat2 =
                      (
                          case of
                          (
                              (mat1.name < mat2.name):-1
                              (mat1.name > mat2.name):1
                              default:0
                          )
                      )
                  
                      fn getSceneMats =
                      (
                          local sceneMats = #()
                          for c in material.classes where c.creatable do
                          (
                              mats = getClassInstances c
                              join sceneMats mats
                          )
                          qsort sceneMats matSortFN
                          sceneMats
                      )
                  
                      fn analyseScene =
                      (
                          local objs = #()
                          for om in getSceneMats() where not areMtlAndRendererCompatible om renderer:renderers.current do
                          (
                              local nodes = refs.dependentNodes om
                              format "% - % %\n" (classOf om) om.name nodes
                              for n in nodes do appendIfUnique objs n
                          )
                          select objs
                      )
                      analyseScene()
                  )
                  Dan Brew

                  Comment


                  • #10
                    Ur awesome mate! thanks a lot
                    www.yellimages.com

                    Comment


                    • #11
                      Thanks for this script DanielBrew, so helpful!

                      Comment


                      • #12
                        nice one guys... thanks!

                        Comment

                        Working...
                        X