RandMats 1.1.2 for Maya (maya script)

Script to randomly assign a selected set of materials to a selected set of objects.

Back to Topics List Previous Next

Q/A

Command for execution?

Date:03/18/2013
Submitted by:ekenryd ekenryd
If I copy/paste all the code into a python tab and run it, I get the script UI, but if I type:

import randMats.py
randMats

..nothing happens. How do I run your script like that?

Replies to this question:

  • Emanuel Claesson

    Emanuel Claesson said over 13 years ago:

    You need to have the script where Maya can find it, such as: My Documents/maya/scripts. From MEL you can open RandMats with: callPython "RandMats" "openRandMats" {} From Python you can open RandMats with: import RandMats RandMats.openRandMats()
  • ekenryd

    ekenryd said over 13 years ago:

    Thanks for the reply. I want to run it from mel but it doesn't seem to work. If I type it like you did I, callPython "RandMats" "openRandMats" {}, I get error that there is no module named RandMats. I then changed the capital R in "RandMats" to lowercase, "randMats" (as that is how you named your .py file) and ran it again and then I get this error: # Error: AttributeError: 'module' object has no attribute 'openRandMats' # Any idea?
  • ekenryd

    ekenryd said over 13 years ago:

    Oh, okay :) Thanks
  • Emanuel Claesson

    Emanuel Claesson said over 13 years ago:

    Ah, sorry. I forgot to tell you. To be able to do that you need to download version 1.1.2 that was released just a few hours ago.

Post a reply:

Sign in