Announcement

Collapse
No announcement yet.

VRayDirt - Maxscript to change all subdivs in scene?

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

  • VRayDirt - Maxscript to change all subdivs in scene?

    Hi all

    Somebody help me out here please. I want to change all subdivs for vraydirt texture in the scene...
    Kind Regards,
    Morne

  • #2
    No idea off the top of my head if the macrorecorder doesn't do it, but as a general rule you can do a quick thing by assigning a material like a vray material to a temp object, then do "showproperties $.material" in the listener. It'll feed out the names of all the parameters but also the map channels. I think the vray material uses .diffuse_map as it's slot for diffuse, so if you pop a dirt into that slot and then use showproperties $.material.diffuse_map it'll give you all the maxscript properties for whatever map is in the diffuse slot, and you'll get your parameters to target for the subdivs.

    Another handy one is "classof" and it'll tell you what type of max object something is. So if you had a vray dirt in that material diffuse slot and did "classof $.material.diffuse_map" it'll feed something back like "vray_dirt()" - this is what you'll use to select all of them in the scene.

    The last little bit is getting all of the vray dirts based on the above. There's a really handy maxscript command called getClassInstances and it'll select everything of a type of object in a scene. So if you wanna get all your vray dirts, if the classof thing above says a vray dirt is called vray_dirt() by maxscript, you'd do soemthing like "theDirtMaps = getClassInstances vray_dirt()". This gets you an array of all your dirts. Then it's a case of a for loop to run through all the dirts and use the commands you learned from the showproperties of the dirt to get the right name for it's subdivs property.

    Happy hunting!

    Comment


    • #3
      Originally posted by joconnell View Post
      This gets you an array of all your dirts.
      is not something I thought I would read on here today
      Dan Brew

      Comment


      • #4
        Hi,

        You can use the following steps in order to change the V-Ray Dirt maps subdivs for the entire scene:
        *) Download and extract the Maxscript file:
        Getallmats.zip
        *)Evaluate it in 3ds Max via Maxscript/Run Script
        *) Open 3ds Мax script listener and evaluate allDirts=(getAllTextures sceneMaterials)
        It will return all Dirt maps.
        *) then evaluate setSubdivs allDirts 20
        to change all subdivs to "20", for an example.

        and that's it
        Tashko Zashev | chaos.com
        Chaos Support Representative | contact us

        Comment


        • #5
          Originally posted by DanielBrew View Post
          is not something I thought I would read on here today
          It'd be a text file of every weekend I've had for the past 15 years...

          Comment


          • #6
            Originally posted by joconnell View Post
            It'd be a text file of every weekend I've had for the past 15 years...
            Code:
            (
            	public allDirt = for dirt in getClassInstances weekEnd processAllAnimatables:true target:joconnell collect dirt
            )
            Dan Brew

            Comment


            • #7
              Don't show my parents :/

              Comment


              • #8
                there is also the VMC script you could try, lots of control

                Comment


                • #9
                  Simple one-liner....

                  for o in getclassinstances vrayDirt do o.subdivs = 64
                  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


                  • #10
                    Look at you being all elegant and perfeshunul

                    Comment


                    • #11
                      Originally posted by Dave_Wortley View Post
                      Simple one-liner....

                      for o in getclassinstances vrayDirt do o.subdivs = 64
                      Hey Dave, Just curious : does getclassinstances get all of the textures in the scene, even if they are nested inside things like mix maps, VrayCompTex, multimaterials,etc ? Or do these situations require additional code to dig through the hierarchies ?

                      mekene

                      Comment


                      • #12
                        Yep it's all of them, no digging required.

                        Comment


                        • #13
                          I don't recall but doesn't the excellent VMC script do this?

                          Comment


                          • #14
                            Originally posted by theedge View Post
                            Hey Dave, Just curious : does getclassinstances get all of the textures in the scene, even if they are nested inside things like mix maps, VrayCompTex, multimaterials,etc ? Or do these situations require additional code to dig through the hierarchies ?

                            Yes, that's the nice thing about GetClassInstances()
                            Colin Senner

                            Comment


                            • #15
                              Very nice indeed ! Now I understand how even single-line scripts can pack so much power

                              mekene

                              Comment

                              Working...
                              X