PDA

View Full Version : something is invalid..


Sorath
02-12-2011, 05:42 PM
why is this saying it's invalid???

expr = sel[0] + '.translateY = rand(time);'
mc.expression(expr)

# Error: Object |bucket1|driver.translateY = rand(time); is invalid
# Traceback (most recent call last):
# File "<maya console>", line 12, in <module>
# TypeError: Object |bucket1|driver.translateY = rand(time); is invalid #

ah and actually I want to add a range to the rand so it goes between 0 and 5.6 or so.. where to put this?

got stuck,
thanks for help!

NaughtyNathan
02-12-2011, 07:46 PM
Hi Bastian.. you don't use the expression command like that.. with python commands in Maya you usually only give the object name on it's own.. for almost everything else you have to give it as a FLAG.. so for the expression command you have to use the s='expression' flag to denote your expression string. You're just declaring the expression as the whole command parameter.
mc.expression(s = expr):nathaN

Sorath
02-13-2011, 05:18 PM
oh, overlooked that.
thanks for pointing me out nathan!

CGTalk Moderation
02-13-2011, 05:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.