Yes, that’s exactly right/what monkey-patching is. I currently use this
approach to inject a path resolution function similar to what you’re
describing, as well as a custom PyQt filebrowser, without having to manually
change any other code.
-Nathan
From: Christopher Horvath
Sent: Tuesday, February 21, 2012 3:20 PM
To: Nuke Python discussion
Subject: Re: [Nuke-python] Setting preferred file-browser directories onstartup.
Gah. Cursed gmail.
I meant:
nuke.originalScriptOpen = nuke.scriptOpen
def myScriptOpen( etc ):
# blah blah
nuke.originalScriptOpen( etc )
nuke.scriptOpen = myScriptOpen
?
On Tue, Feb 21, 2012 at 3:19 PM, Christopher Horvath <[email protected]>
wrote:
Would something like this work? I get extremely confused about whether I'm
manipulating things by value or by reference in python:
nuke.originalScriptOpen = nuke.scriptOpen
def myScriptOpen( ... ):
blah
nuke.script
On Tue, Feb 21, 2012 at 3:13 PM, Nathan Rusch <[email protected]>
wrote:
Monkey-patch nuke.scriptOpen with your own function during the init
sequence that resolves the starting directory and raises the file browser
appropriately. Be sure to keep the original function around somewhere though
(since you’ll need to call it from your patch function to do the actual
opening).
-Nathan
From: Christopher Horvath
Sent: Tuesday, February 21, 2012 3:04 PM
To: [email protected]
Subject: [Nuke-python] Setting preferred file-browser directories on
startup.
Howdy Nuke-python,
We have a python wrapper around the Read and Write nodes that's able to
query environment variables to correctly set the default paths for the file
browsers that these nodes pop up.
However, the actual "File->Open" (for loading a nuke script) paths remain
defaulted to the last directory that was visited - how do I programmatically
set these as well?
Thanks!
Chris
--
I think this situation absolutely requires that a really futile and stupid
gesture be done on somebody's part. And we're just the guys to do it.
----------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
--
I think this situation absolutely requires that a really futile and stupid
gesture be done on somebody's part. And we're just the guys to do it.
--
I think this situation absolutely requires that a really futile and stupid
gesture be done on somebody's part. And we're just the guys to do it.
--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python