06 - prompts with pymel
Use promptDialog of course! The way this behaves is strange and counter intuitive; its the way the original python-in-maya behaves. Strange that pymel didn't fix this.
python
from pymel.core import *
promptDialog(message='what exposure do you want to add?', text='1')
value = promptDialog(query=True, text=True)
value = float(value)
[ x.exposure.set( x.exposure.get() + value ) for x in ls(type='phxAreaLight') ]
from pymel.core import *
promptDialog(message='what exposure do you want to add?', text='1')
value = promptDialog(query=True, text=True)
value = float(value)
[ x.exposure.set( x.exposure.get() + value ) for x in ls(type='phxAreaLight') ]
What that's doing under the hood is this:
- import pymel (obviously)
- make a prompt, show it to the user
- after the users hits 'confirm', the prompt hangs around in memory
- you then query the now invisible prompt for whatever text the user entered, assign it to a variable 'value'
- that value is just text, we need it as a number, a floating point number. you can convert variables to float by calling float(variable)
- you use that variable in the list comprehension