Two problems. First, your panel isn't changing the values of firstEntry or secondEntry vars so they will always be '10' and '1' respectively no matter what the user enters. Second, if you use either the panel approach or simply nuke.getInput, you need to cast to float with float(p.value...) before doing setKey on the animation object.
https://gist.github.com/6b6063d6603c9a9798b9 Also, probably best to check that whatever the user inputs can indeed be cast to float (i.e. is either a float or integer and is not something like "asdasdf") before you actually do float(p.value....) -Ean On Fri, Jan 18, 2013 at 1:51 AM, NotDaBod < nuke-python-re...@thefoundry.co.uk> wrote: > ** > How do I get a float from users? > > getInput doesn't seem to work. > > addSingleLineInput doesn't seem to work either. > > Below is my script that doesn't take in a float with p.addSingleLineInput. > > Thanks > > *Code:* import nuke > def setKeyFrameOnSelected(): > firstEntry = '10' > secondEntry = '1' > p = nuke.Panel("Frame Value Key") > p.addSingleLineInput("Set Frame Number", firstEntry) > p.addSingleLineInput("Set Mix Value", secondEntry) > p.addButton("Cancel") > setKeyOnSelected = p.addButton("OK") > result = p.show() > ## store selected in nodes > nodes = nuke.selectedNodes() > ## if the user clicks ok > if not setKeyOnSelected == None: > for i in range(len(nodes)): > ## get attr to be keyed > node_attr = nodes[i]['mix'] > ## change the attr to accept animation > node_attr.setAnimated(0) > ## put knob to animated in a var > node_an = nodes[i]['mix'].animations()[0] > ## set key on frame 20 with value 1 > node_an.setKey(firstEntry, secondEntry) > > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python