Announcement

Collapse
No announcement yet.

Pythonic selection of all vralightmesh nodes

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

  • Pythonic selection of all vralightmesh nodes

    I'm trying to set parameters on multiple VRayLightMesh objects programatically, but I can't seem to get the code right (I am a bit of a maya newbie)

    VRMLgts = cmds.ls(type = "VRayLightMesh")
    for VRMLgt in VRMLgts:
    try :
    print VRMLgt.subdivs
    except :
    print "not working"
    try :
    lgt = cmds.listRelatives(VRMLgt, p=1)[0]
    print lgt.subdivs
    except :
    print "not working either"

    Any ideas where I'm going wrong? I have multiple objects with vrayLightMesh nodes ,but I can't seem to access them in the way I would expect in python.

    Thanks for any suggestions.
    p.
    Patrick Macdonald
    Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/




  • #2
    I think you have to use the getAttr and setAttr methods/commands.
    Search for tutorials about setting/getting attributes or inspect the docs.

    VRayLightMesh behaves as a standard Maya node and thus if you know how to set some attribute of another node you'll be able to do it for VRayLightMesh, too.
    V-Ray developer

    Comment


    • #3
      Set 8 on subdivs of all VRayLightMesh :

      Code:
      [cmds.setAttr('%s.subdivs', 8) % x for x in cmds.ls(type = "VRayLightMesh")]
      Print :
      Code:
      print [cmds.getAttr('%s.subdivs') % x for x in cmds.ls(type = "VRayLightMesh")]
      www.deex.info

      Comment


      • #4
        Hah, nice. Some ninja pythoning right there.
        Thanks for that.
        Patrick Macdonald
        Lighting TD : http://reformstudios.com Developer of "Mission Control", the spreadsheet editor for 3ds Max http://reformstudios.com/mission-control-for-3ds-max/



        Comment

        Working...
        X