ShotGunDropper v1.6


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Frank Rueter
Website: www.ohufx.com
enable drag and drop from Shotgun into Nuke
Requirements:
11.0, 10.5, 10.0, 9.0, 8.0, 7.1, 7.0, 6.3, 6.2, 6. or later
Linux, Mac, Windows
13 Aug 2019
876

v1.6 fixed bugs with windows paths


 

v1.5 fixed bugs in v1.4 that broke the tool


v1.4 downloads the original filr frmo Shotgun if sg_path_to_frames is empty (rough and dirty as prooff of concept)


v1.3 modified to work with nukescripts.addDropDataCallback. Please see instructions below for updated info on how to get this running. Also, this verison supports drag&drop of Shots and Playlists.


v1.2 has a bit of code optimisation to avoid unnecessary Shotgun connections (as suggested by Mihall - thanks).

 


 

v1.1 also works with Shotgun's email links. Check out the new video here.


 

This python snippet enables you to drag Shotgun Versions from your browser straight into Nuke to create Read nodes.

For those of you who aren't familiar with the Shotgun's vfx database, check it out here

 A short demo can be found here.

 

In order to get this to work with your shotgun config follow these steps:
  1. put ShotgunDropper.py into your plugin path
  2. make sure the path to the shotgun api is part of NUke's PYTHONPATH or NUKE_PATH (currently shotgun_api3 is used)
  3. add your shotgun server's name, script name and script key in lines 65-67
  4. in your menu.py, add this line:
1
2
import ShotGunDropper
nukescripts.addDropDataCallback(ShotGunDropper.dropSG)

(Re)Start Nuke and you're off...

Please login in order to download these files.

Comments   

 
# Diogo Girondi 2010-11-22 19:53
Sweet!

That is something I wasn't even considering to do. Really nice idea Frank.
 
 
# Frank Rueter 2010-11-22 20:46
yeah, the dropData (ex drop.tcl) is something a lot of people aren't aware of.
It opens up worlds of integration fun
 
 
# Vincent Poitras 2010-11-23 09:45
Awesome Frank. Another tool to help our shotgun-nuke blend!
 
 
# Mihail Temelkov 2010-12-09 09:10
i would do the Shotgun setup (lines 22-26) just before running the query. otherwise if the pattern match does not find an ID, you're connecting unnecessarily to Shotgun.
 
 
# Frank Rueter 2010-12-09 12:24
very true. will change that and update the file soon.
cheers!
 
 
# Mihail Temelkov 2010-12-09 14:20
Another thought (after having a bit more time to look at the code):

Right now a new Shotgun object is created with every drag&drop (and call to dropSGVersion(url)).
It may be better to instance Shotgun after the imports, so you have a single Shotgun object, which is created when the Nuke GUI starts and menu.py loads.
 
 
# Mihail Temelkov 2010-12-09 14:23
...that goes against my previous recommendation, so there are pros and cons to each approach.
 
 
# Mihail Temelkov 2010-12-09 14:37
...i meant to say against my 'just-in-time instancing' recommendation. but as far as Shotgun object efficiency, it may be even better.
 
 
# Frank Rueter 2010-12-09 16:17
yes, I know. I have my own way of localising a shotgun cache to make things snappier and everyone probably has their own way of dealing with it.
I wouldn't want to create a Shotgun object on start up (i.e. through the menu.py) cause it would slow down each nuke launch. You could play with keeping the shotgun object in memory for subsequent calls into the same session. This is why I said it's more of an example for how to do this. There is heaps of room for improvement, and when I get time I will play with it more, so keep suggestions coming.
 
 
# Mihail Temelkov 2010-12-13 07:32
nice tool. too bad when i drag and drop one version url and then another url (for a different version), Nuke crashes.
It happens on CentOS. No such issue on a Mac.

I've had this issue with Shotgun crashing Nuke on Linux before as well.
The first time I query Shotgun from inside Nuke things are ok.
When i try to query Shotgun a second time, Nuke crashes.
 
 
# Frank Rueter 2010-12-13 17:34
Sounds like a bug in the python backend. I am on the road for a couple of weeks but can have a go on my Linux box when back home. I may need reminding though ;-)
 
 
# Paul Hudson 2011-01-31 13:34
This is a very nice and clever tool.

I think the dropData function needs one small adjustment. I believe returning False completely bails on any dropData processing. Returning None allows the base Nuke functionality to still happen.

Besides that, Awesome!
 
 
# Mihail Temelkov 2011-01-31 13:50
works for me in its current form. i'd question Nuke's logic - usually you return True or False, not True or None (although None evaluates to False in a boolean context).
 
 
# Frank Rueter 2011-01-31 15:08
yeah, I think the dropData needs to be more in the form of a callback so multiple dropData functions can concatenate.
 
 
# Christian Kauppert 2011-02-21 13:32
thanks for the script, frank!

i had some problems on windows with the path to the frames because of the backslashes. i fixed it by replacing the backslashes to slashes in the path from shotgun. nuke likes this more, too. :-)

maybe you want to add it to your script for the windows users:

#DO THE NUKE THING
nuke.createNode ( 'Read', 'file ' + versionEnt['sg_ path_to_frames' ].replace('', '/') + ' first %(sg_first_fram e)s last %(sg_last_frame )s' % versionEnt )
 
 
# Christian Kauppert 2011-02-21 13:35
oh, this comment form doesn't like backslashes, too ^^ but i think you know how to change your code anyway
 
 
# Sean Mertiens 2011-04-12 09:42
if anyone has problems with the shotgun api under linux, this link might be helpful :

https://support.shotgunsoftware.com/entries/48110-shotgun-and-nuke
 
 
# Frank Rueter 2011-04-12 15:05
thanks for pointing that out, it is indeed a very annoying bug on linux. there is actually a section about this in the docs as well ("known issues")
 
 
# Joshua LaCross 2011-07-15 19:16
The company where I uses "spaces" in their naming conventions. That seems to break the file path when its dragged. The Read node has the file path for everything up until the first space is introduced. Anyway around this?
 
 
# Frank Rueter 2011-07-16 01:44
right, I keep forgetting to catch this, as I personally consider white spaces in file names a big no-no. Will have a look next week and upload the update.
 
 
# Joshua LaCross 2011-07-18 15:39
I'm running MacOSX. I'm having an issue where I've lost my "paste" function. I can copy and then paste into a text editor but I can't paste in Nuke. Any thoughts? as soon I get rid of the code from my menu.py the paste function returns... weird
 
 
# Sean Mertiens 2011-07-18 16:39
In this case, the script most probably won't return false if it does not handle the DropEvent. In this case nuke won't iterate thru the rest of the DropDataCallbac ks - at least it was like that when i experienced the problem you described :-)
 
 
# Daniel Thuresson 2012-10-12 06:19
So I just tried this, and was so happy :-). until someone told me that we lost all copy paste function :sad:.
And as soon as I removed the import ShotGunDropper, it came back..
Anyone know why this would happen and how to work around it.
 
 
# Frank Rueter 2012-10-12 18:06
I will have a look when I get time
 
 
# Frank Rueter 2012-10-14 23:33
The problem was that when I wrote this version, Nuke didn't have the ability to register drop callbacks yet. It does now and this file is updated accordingly. Check the new instructions to get it to work (playlists and shots should also work now and create a Read node for each version they contain).
 
 
# Daniel Thuresson 2012-10-17 01:05
Thanks Frank!
 
 
# Addison Petrie 2017-12-17 21:29
Hey Frank,

When I drop a link in the read name's file path goes to 'None' and displays no file. Any idea why this is happening?

Thanks
 
 
# Frank Rueter 2017-12-18 00:01
What kind of link are you dragging into Nuke? What doe the lik look like when you drag it into a text editor (or email in plan text mode)?
 
 
# Addison Petrie 2017-12-18 07:10
I am dragging the link from the Shot version from nuke it looks like this - https://'studio'.shotgunstudio.com/detail/Version/15336

I have replaced site link with 'studio'. When copied in to a text editor it is identical to the link in the browser
 
 
# Frank Rueter 2017-12-18 07:59
Ah yup, happening here as well. I haven't used this in a while myself. I will have a look tomorrow.
 
 
# Frank Rueter 2017-12-18 08:03
Hm, is the "path_to_frames ' field empty by any chance? It works just fine for me. This scripts needs correct values in sg_path_to_fram es, sg_first_frame and sg_last_frame.
 
 
# Addison Petrie 2017-12-18 08:24
Yes Path to frames is empty as we’re not working on centralised server for files. I’m guessing this is needed?
 
 
# Frank Rueter 2017-12-18 08:33
How does Shotgun know where the clip is on the server then?
Or did you expect this to download the quicktime from Shotgun and pull that into Nuke? That can be done as well if it's helpful.
 
 
# Addison Petrie 2017-12-18 10:47
Yeah even pulling the QuickTime down from Shotgun and posting it in to Nuke would be helpful. Without having to manually find it all the time
 
 
# Frank Rueter 2017-12-18 22:58
Try the new version (1.4). I added quick and dirty code to download the "sg_uploaded_mo vie" if the "sg_path_to_fra mes" field is empty.
This doesn't work for playlists or shots yet and will probably need a progress/busy bar during the download.
Let me know if this works for you. I'm a bit busy so I just threw this together quickly.
 
 
# Frank Rueter 2017-12-18 23:00
I forgot, there is a function in there to get the desired local directory. At the moment it just download to Nuke's temp path, but you can update the function to do whatever works for you.
 
 
# Addison Petrie 2017-12-18 23:03
Hey Frank, thanks for trying to solve this so quickly but this seems to have broken the script...

I'm now just getting a clipboard error.. Or is that just me?
 
 
+1 # Frank Rueter 2017-12-18 23:19
I will check...
 
 
# Frank Rueter 2017-12-19 20:27
There were a few typos that caused syntax errors and triggered the error, sorry.
v1.5 should work
 
 
# Addison Petrie 2017-12-19 22:30
Sweet, that's working great! So to adjust the directory it downloads to I guess I need to change line 14 - return os.environ['NUK E_TEMP_DIR']

But replacing inside the quotes with a directory doesn't do the job. Do I have to change the environment variable?
 
 
# Frank Rueter 2017-12-19 22:38
That's right. The return value of the getLocalPath() function should be the directory you want to download to.
So you could simply do this:
return '/path/to/folder'
instead of:
return os.environ['NUK E_TEMP_DIR']
 
 
# Addison Petrie 2017-12-19 22:45
Working a treat! Thanks so much for your time :)
 
 
# Carlos Garcia 2018-03-23 18:04
Hi,

This is a good plugin but since I change to Nuke 11 it stops working I took a look on what was the issue and it seems that the callback "addDropDataCal lback" is not working with web browser.

I just wondering if any of you have experience the same?

Thanks,
 
 
# Frank Rueter 2018-03-24 01:02
Ouch, you are indeed right. That is a Nuke11 bug I dare say. I will log a bug report.
 
 
# Ricardo Musch 2019-06-12 17:05
Works great, I did make a change to it though for Windows users, as Nuke will flip out if a path with "\" slahes is pulled in. On windows we need to make sure to replace backward slashes with forwards slashes.

r = nuke.nodes.Read ()
path = v.get("sg_path_ to_frames")
path = path.replace("\ \","/")
#print path
r["file"].setVa lue(path)
r["first"].setV alue(v.get("sg_ first_frame"))
r["last"].setVa lue(v.get("sg_l ast_frame"))
r["origfirst"]. setValue(v.get( "sg_first_frame "))
r["origlast"].s etValue(v.get(" sg_last_frame") )
r["label"].setValue(v.get("sg_version_type"))

instead of creating it all in one line.
 
 
# Francesc Macià 2019-08-07 09:11
Hi Ricardo thanks! The dropping is working to create a Read inside Nuke, but I´m stucked with the windows path.
A couple of quick questions;

-Where need to be added these lines inside ShotGunDropper. py or menu.py?
-Is telling me: NameError: name 'v' is not defined

Many thanks!
 
 
# Ricardo Musch 2019-08-07 14:03
in the ShotgunDropper. py file :)

Instead of the way it creates ReadNodes in the standard version I have changed it around so the paths can be adjusted.
 
 
# Francesc Macià 2019-08-07 16:29
Thanks Ricardo but no luck always the same error, can you paste the script without of course the 64/65/66 lines ? Or some screenshot of the changed lines?
Many thanks!
 

You have no rights to post comments

We have 2205 guests and 29 members online