Announcement

Collapse
No announcement yet.

How to create V-Ray attribute via MEL or Python?

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

  • How to create V-Ray attribute via MEL or Python?

    Hi,

    I'd like to be able to add "Texture input gamma" to a file node, but I'd like to do it using either MEL or Python. What is the correct syntax to do this?

    If I were to do it via the Maya UI, I'd select the file node and then click "Attributes -> V-Ray -> Texture input gamma".
    Best Regards,
    Fredrik

  • #2
    The way to find the command is:
    0. Open the script editor
    1. Enable History->Echo all commands in the script editor
    2. Clear the log Edit->Clear history
    3. Select the node and add the attributes you're interested in
    4. Search the history in the script editor for a line starting with "vray addAttributesFromGroup " (without the quote).
    If you find such line then this is the command you can use to create the attributes with a script.

    Hope it helps.
    V-Ray developer

    Comment


    • #3
      Excellent, thank you very much for the swift response. I found the MEL command and it works great!
      Best Regards,
      Fredrik

      Comment


      • #4
        Use the help, most of the extra attribue scripting is there.
        V-Ray/PhoenixFD for Maya developer

        Comment


        • #5
          Dragging up a slightly old thread, I see the commands in the help docs, but whats the best way to use that command via python? Hopefully something better than using eval()
          www.simonreeves.com - me
          www.analogstudio.co.uk - where I work

          Comment


          • #6
            I just looked this up, all you need is here:

            https://github.com/BigRoy/mayaVrayCo...butesFromGroup
            Dmitry Vinnik
            Silhouette Images Inc.
            ShowReel:
            https://www.youtube.com/watch?v=qxSJlvSwAhA
            https://www.linkedin.com/in/dmitry-v...-identity-name

            Comment


            • #7
              Oh that looks interesting thanks, I have used the eval so far, and then worked out how to set the attrbute (not a big deal but Im new to maya)

              Code:
              # Set material ID to index of the loop
              VRayMaterial.vrayMaterialId.set(5)

              Ideally I want this! But I don't understand where the attribute comes from (I see the commands are attribute from group)

              Code:
              VRayMaterial.addAttribute('[COLOR=#333333][FONT=Arial]vray_material_id[/FONT][/COLOR]')
              (using pymel)
              Last edited by simonreeves; 24-02-2015, 07:46 AM.
              www.simonreeves.com - me
              www.analogstudio.co.uk - where I work

              Comment


              • #8
                I guess I there is no pymel equivilant of "cmds.vray" ?

                Better than eval anyway thank you.
                www.simonreeves.com - me
                www.analogstudio.co.uk - where I work

                Comment


                • #9
                  > I guess I there is no pymel equivilant of "cmds.vray" ?

                  Nope.
                  Best Regards,
                  Fredrik

                  Comment


                  • #10
                    Thanks Fredrik
                    www.simonreeves.com - me
                    www.analogstudio.co.uk - where I work

                    Comment

                    Working...
                    X