Announcement

Collapse
No announcement yet.

maya2019 vrayImportVRayMaterial usage details

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

  • maya2019 vrayImportVRayMaterial usage details

    Im on maya2019 and would like to use vrayImportVRayMaterial to import a materials.vrscene into maya with a python script.
    Id like to call vrayImportVRayMaterial with a full path to the vrscene file.
    I cant find any documentation on the syntax to do that.
    How do I get a usage printed for this vrayImportVRayMaterial function?

  • #2
    vrayImportVRayMaterial just opens the dialog, it doesn't accept any arguments. If you want to make a script that loads materials from a specified file, you can use the same commands that the dialog uses. Here is a simple Python script that reads a file, prints the materials found in it, and imports them.
    Code:
    from maya import cmds
    fileName = 'test.vrscene'
    isDup = True # Allow duplicates
    cmds.vray('loadFromFileInit', fileName)
    mtls = cmds.vray('getMtlsList') # Returns a list of materials in the file
    for mtl in mtls:
        print('Importing '+mtl)
        cmds.vray('loadFromFile', fileName, isDup, mtl)
    cmds.vray('loadFromFileEnd')
    Deyan Spirov
    V-Ray for Maya developer

    Comment


    • #3
      Thank you Deyan,

      That works!!
      How did you figure out the commands the dialog uses?

      One tiny little gotcha. On windows for full file paths to the vrscene fileName string has to use '/' instead of '\'.

      The other thing Im noticing is the texture maps are not included in the import process.
      This is also the case when you use the vrayImportVrayMaterial dialog.

      Comment

      Working...
      X