Announcement

Collapse
No announcement yet.

VRay Multi Matte quick apply

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

  • VRay Multi Matte quick apply

    Hi guys I was just flicking through the forums so see if there is a script of some sort to
    apply Multi matte and Object IDs to selected groups of objects all at once and specify what IDs they should have?
    I have a huge scene with quite a few objects and need to make this process less of a headache

    thanks in advance

    -A

  • #2
    Originally posted by 4th-Child View Post
    Hi guys I was just flicking through the forums so see if there is a script of some sort to
    apply Multi matte and Object IDs to selected groups of objects all at once and specify what IDs they should have?
    I have a huge scene with quite a few objects and need to make this process less of a headache

    thanks in advance

    -A
    Hi,
    My DeeX VRay Arsenal have this function .
    The tool generate ID based on the name of the selection.

    If you wan create mattes, there is a function to create mattes on the fly (and you can export all).
    Last edited by bigbossfr; 17-06-2013, 01:59 AM.
    www.deex.info

    Comment


    • #3
      As ill be trying to do this at work i dont think the studio will purchase you tool for us lol
      But thanks though

      Comment


      • #4
        Heya

        I've mocked up a while ago a script that could help you, however this one is for materials...

        Select all the materials you want to have custom ID for.

        Use in python
        Code:
         import maya.cmds as cmds
         selectedM = cmds.ls(sl=1)
            try:
                for selectedMat in selectedM:
                    mel.eval('vray addAttributesFromGroup ' + selectedMat + ' vray_material_id 1')
            except:
                pass
            try:      
                for mats in selectedM:
                    x = selectedM.index(mats)
                    cmds.setAttr('%s.%s'%(mats,'vrayMaterialId') ,x + 1)
            except:
                pass

        edit:
        And this is quick mock up for geometry... see if it works.
        Code:
            import maya.cmds as cmds
            selectedO = cmds.ls(sl=1)
            try:
                for selectedOBJ in selectedO:
                    mel eval('vray addAttributesFromGroup '+ selectedOBJ=' vray_objectID 1')         
            except:
                pass
            try:      
                for OBJ in selectedO:
                    x = selectedO.index(OBJ)
                    cmds.setAttr('%s.%s'%(OBJ,'vrayObjectID') ,x + 1)
            except:
                pass
        Last edited by Dariusz Makowski (Dadal); 17-06-2013, 07:23 AM.
        CGI - Freelancer - Available for work

        www.dariuszmakowski.com - come and look

        Comment


        • #5
          Thanks DADAL, but i cant get it to run I get an error

          Comment


          • #6
            Try this one in python. Just select ur objects 1st.
            Code:
            import maya.cmds as cmds
            import maya.mel as mel
            
            try: 
                relative = cmds.listRelatives(s=1)
                for selectedOBJ in relative:
                    mel.eval('vray addAttributesFromGroup ' + selectedOBJ + ' vray_objectID 1')     
            
            except:
                pass
                
            try:     
                relativeO = cmds.listRelatives(s=1) 
                for OBJ in relativeO:
                    x = relativeO.index(OBJ)
                    cmds.setAttr('%s.%s'%(OBJ,'vrayObjectID') ,x)
            except:
                pass
            Ok here it goes. It should work with anything selected so watch out what you are selecting !
            Last edited by Dariusz Makowski (Dadal); 18-06-2013, 06:06 AM.
            CGI - Freelancer - Available for work

            www.dariuszmakowski.com - come and look

            Comment


            • #7
              this is awesome! is there a string that you could add that specifies what ID the object gets?

              Thanks again man this will really help me set up my Ldev scenes!!

              Comment


              • #8
                ID have to script in UI and stuff. How would you want to control it? Select 1 OBJ and type in Number? basically a shortcut rather than Attribute editor or what?

                Thanks, bye.
                CGI - Freelancer - Available for work

                www.dariuszmakowski.com - come and look

                Comment


                • #9
                  Umm something like select like either one object and input a number or shift select 3 objects and then input the 3 different numbers?
                  or is that a huge ask?
                  whats ever is easier!

                  Thanks again!

                  Comment


                  • #10
                    Well if you want 1 object then just select 1 object and keep attr editor open with slided to the bottom. You can just type the ID there. Then everytime you click on new object the UI should stay and you can type other numbers... regarding multi selection humh...maybe I'll see what I can do ( could be fun exercise) but dont expect it to happen too quick :S.

                    Thanks, bye.
                    CGI - Freelancer - Available for work

                    www.dariuszmakowski.com - come and look

                    Comment


                    • #11
                      Thank You! for this script very useful ... have you had the chance to play with some kind of UI yet?

                      Comment

                      Working...
                      X