Announcement

Collapse
No announcement yet.

MEL command for adding Vray subdivision?

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

  • MEL command for adding Vray subdivision?

    I want to make a menu button that adds Vray subdivision as opposed to going to the attribute menu pulldown and then another pull down to click the checkbox.

    What is the mel command for adding Vray subdivision?

    I am assembling my most used vray buttons (or most hidden in menus buttons) in a tab.

    Thanks.
    ------
    KC

  • #2
    This is my button:

    Code:
    {
    string $sel[] = `ls -sl -dag -s`;
    for ($each in $sel){
    	if (`nodeType $each`=="mesh"){	
    		print ("// adding VRay subdivision attributes to "+$each+"\n");
    		vrayAddAttr($each, "vraySubdivEnable");
    		vrayAddAttr($each, "vraySubdivUVsAtBorders");
    	}
    }
    }

    Comment


    • #3
      Why not create a Vray displacement group on a top level group of your GEO, then you can add a Vray subD node, and set the divisions in the render globals. That way if you add any geo to that group everything will have a Vray SUB-D node.

      Comment


      • #4
        That button works. Only bit is that I was trying to reverse engineer it by turning on "echo all commands" but I couldn't for the life of me make it work that way. Is there a similar setup for adding the "subdivision and displacement quality"? Thanks for your help.

        @ Metzger, the reason I make it per object is so that I can determine each object's necessary displacement subD level. I do like the global idea though, it could be useful if I have groups at varying levels where I could set them up and drop objects in the group node as you mentioned.
        ------
        KC

        Comment


        • #5
          Well if you are having to write a script, then it's time you start grouping.

          Comment


          • #6
            Originally posted by Intuition View Post
            That button works. Only bit is that I was trying to reverse engineer it by turning on "echo all commands" but I couldn't for the life of me make it work that way. Is there a similar setup for adding the "subdivision and displacement quality"? Thanks for your help.
            You would add these lines to the loop:
            Code:
            vrayAddAttr($each, "vrayOverrideGlobalSubQual");
            vrayAddAttr($each, "vrayViewDep");
            vrayAddAttr($each, "vrayEdgeLength");
            vrayAddAttr($each, "vrayMaxSubdivs");
            All the attrs are stored in a file called attributeGroups.txt in the maya/vray/scripts folder. You give the shape name and the attr to the procedure vrayAddAttr and it'll set it for you.

            @Metzger
            Sounds cool, though I haven't tried that approach - mainly because our pipeline is finicky about extra nodes being attached to objects at the moment, and I sometimes want individual control over the UV edge subdivision (doing characters currently)

            Comment


            • #7
              You can save a few lines if you did it like this

              vray addAttributesFromGroup $each vray_subdivision 1;
              vray addAttributesFromGroup $each vray_subquality 1;

              It also means if new attributes are added in future, your code will be less likely to need changing.

              David

              Comment


              • #8
                Thanks David and mfessenden: very handy script suggestions.

                @ Metzger: that's cool too, but the subdiv attributes per shape are still handy if you want to control the quality trough an additional node plus a simple expression.

                I'd like to post your script with the suggested amendment and credits on the 3Dpro forum: do I have your permission?

                Thanks,
                Gianca

                Originally posted by djx View Post
                You can save a few lines if you did it like this

                vray addAttributesFromGroup $each vray_subdivision 1;
                vray addAttributesFromGroup $each vray_subquality 1;

                It also means if new attributes are added in future, your code will be less likely to need changing.

                David

                Comment


                • #9
                  I don't think you need my permission. Do it!

                  Comment

                  Working...
                  X