No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exploreThis.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ## written by michael vorberg (mv@empty98.de)
  2. ## edited for pixelpuff by stefan ihringer (stefan@bildfehler.de)
  3. ##
  4. ## version 1.1 (2010-06-14): tries to open parent directory if desired path does not exist
  5. import nuke
  6. import os
  7. def _get_directory(rawpath):
  8. """
  9. Make a path cross-platform by replacing network shares
  10. """
  11. path = rawpath
  12. if (nuke.env["WIN32"]):
  13. path = path.replace("/Volumes/O/", "//calculon/o/")
  14. path = path.replace("/","\\")
  15. else:
  16. path = path.replace("//calculon/o/", "/Volumes/O/")
  17. path = os.path.dirname(path)
  18. # check if directory exists and try parent directories in case
  19. while (not os.path.exists(path)) and (len(path) > 2):
  20. # print "path not found: ", path
  21. # print "trying parent directory"
  22. path = os.path.dirname(path)
  23. return path
  24. def exploreThis():
  25. """
  26. Shows the location of a footage element (Read or Write nodes) or an
  27. FBX/OBJ file (ReadGeo node) in an Explorer or Finder window.
  28. """
  29. if (nuke.env["WIN32"]):
  30. command = "explorer /e,"
  31. else:
  32. command = "open "
  33. m = nuke.selectedNode()
  34. if m.Class() in ('Read', 'Write', 'ReadGeo2'):
  35. path = _get_directory(m.knob("file").value())
  36. os.system(command + path)
  37. else:
  38. nuke.ask ('please select a Read, Write or a ReadGeo')