Looks fine.
The problem with your previous attempt was that using quoted around "f" means literally the letter f, rather than referring to the variable f you created earlier. By using str() you cast the value of the variable f to be a string, e.g. 123 turns into "123", which is what the frame knob expects (unfortunately).



On 20/01/17 9:33 AM, Andrew Mumford wrote:
Answering my own question I hope ...

r = nuke.Root()

f = r.knob('first_frame').value()

n = nuke.selectedNode()

print n['frame'].setValue(str(f))

Seems to get me the result I was hoping for - anyone see any problems in this ?

Thx

---
Andrew Mumford

On Jan 19, 2017, at 12:29 PM, Andrew Mumford <[email protected]> wrote:

It tells me it's expecting a string not a float - I guess maybe that's because I can type expressions in there like "frame/2" do I need to mangle a float into a string maybe ?
---
Andrew Mumford

On Jan 19, 2017, at 12:24 PM, Nathan Shipley <[email protected]> wrote:

Does it work if you take 'f' out of the 'quotes'? So: print n['frame'].setValue(f)

On Thu, Jan 19, 2017 at 12:15 PM, Andrew Mumford <[email protected] <mailto:[email protected]>> wrote:

    Trying to do the simplest thing for days now but still failing.

    I want to set a selected Read node knobs "expr" and "frame" to
    "start at" and "nuke.Root.first_frame()" so when I get file
    frame nos such as 103094 - 103122 I can set the to some "human
    useable" range.

    Failing on the second part ...

    r = nuke.Root()

    f = r.knob('first_frame').value()

    n = nuke.selectedNode()

    print n['frame'].setValue('f')


    This sets "frame" to "f"  even though


    print r.knob('first_frame').value()


    Returns a Number "101" for example...

    Anyone help me out here - I'm sure it's my basic lack of code knowledge ?

    Thx

    ---
    Andrew Mumford


    _______________________________________________
    Nuke-users mailing list
    [email protected]
    <mailto:[email protected]>,
    http://forums.thefoundry.co.uk/ <http://forums.thefoundry.co.uk/>
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
    <http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users>


_______________________________________________
Nuke-users mailing list
[email protected] <mailto:[email protected]>, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
_______________________________________________
Nuke-users mailing list
[email protected] <mailto:[email protected]>, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users


_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to