Sorry, I am not sure if I understood your question properly. There would be no
expression involved in my suggestion.
legCtrl1.fkik would simply be a boolean 0 or 1 type.
You create the scriptJob completely outside of that property. The scriptJob
simply says "run this code when this attribute changes values".
Now you don't have to pass it a callable object. You could have passed it
python strings:
###
jobId = cmds.scriptJob(attributeChange=['legCtrl1.fkik', """
val = cmds.getAttr('legCtrl1.fkik')
if val == 0:
cmds.setAttr('legCtrl1.tx', k=False)
elif val == 1:
cmds.setAttr('legCtrl1.tx', k=True)
"""])
###
Because you are working with the python commands module, the commands expect
python code, not MEL procs.
-- justin
The documentation for scriptJob is here:
http://download.autodesk.com/global/docs/maya2012/en_us/CommandsPython/scriptJob.html
You would not be using expressions (from my example). You would be passing
callable functions.
On Nov 25, 2012, at 9:47 PM, Владимир Пылев wrote:
> I could not quite understand, but we can about how to use scriptJob?
> scriptJob on legCtrl1.fkik -> myExpr - make the procedure, which contains
> the show or hide depending on conditions.sorry if that translate translator.
>
> 2012/11/26 Berg Jones <[email protected]>
> I have one control that I'm using to control FK/IK on a leg. I dont want to
> have one for IK and one for FK because it gets confusing. Right now I have
> reverse foot roll and translate attributes that I want to hide when I'm in FK
> mode and vice versa.
>
> Heres the expression in question that will disable translateX but wont
> unhide switch into IK.
>
> Thanks!!!!
>
> import maya.cmds as cmds
> import maya.mel as mel
>
> mel.eval('proc hideStuff(){setAttr -k 0 "legCtrl1.tx";}')
> mel.eval('proc showStuff(){setAttr -k 1 "legCtrl1.tx";}')
>
> myExpr = '''
> if (legCtrl1.fkik == 0)
> {
> hideStuff();
> }
>
> else if (legCtrl1.fkik == 1)
> {
> showStuff();
> }
> '''
>
> cmds.expression(string=myExpr)
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe