Code Monkey home page Code Monkey logo

pyblish-nuke's Introduction

Build Status

Pyblish integration for The Foundry Nuke 8-15.




What is included?

A set of common plug-ins and functions shared across other integrations - such as getting the current working file. It also visually integrates Pyblish into the File-menu for easy access.




Installation

pyblish-nuke depends on pyblish-base and is available via PyPI.

$ pip install pyblish-nuke

You may also want to consider a graphical user interface, such as pyblish-qml or pyblish-lite.




Usage

To get started using pyblish-nuke, run setup() at startup of your application.

# 1. Register your favourite GUI
import pyblish.api
pyblish.api.register_gui("pyblish_lite")

# 2. Set-up Pyblish for Nuke
import pyblish_nuke
pyblish_nuke.setup()

Publishing

There are two options in the file menu to publishing with:

  • Publish: Publishing with a silent non-GUI publish, which is fast but does not show the registered GUI. oct 31 2017 3-49 pm
  • Publish...: Publishing with the registered GUI.



Persistence

It is recommended that you allow Pyblish to load upon launching Nuke. For this, you have two options.

  1. Add the above snippet to your .nuke/menu.py in your home directory.
  2. Add the pyblish_nuke/nuke_path directory to your NUKE_PATH environment variable

As you will find, this directory contains a menu.py with the same command. Nuke will run this upon startup, along with any other menu.py available.




Documentation




Under the hood

The setup() command will:

  1. Register Nuke related "hosts", allowing plug-ins to be filtered accordingly.
  2. Register a minimal set of plug-ins that are common across all integrations.



Manually show GUI

The menu-button is set to run show(), which you may also manually call yourself, such as from a shelf-button.

import pyblish_nuke
pyblish_nuke.show()



No menu-item

Should you not want a menu-item, pass menu=False.

import pyblish_nuke
pyblish_nuke.show(menu=False)



Dockable GUI

Should you want to dock the pyblish UI, there is a convenience function to help.

import pyblish_nuke
window = pyblish_nuke.show()
pyblish_nuke.dock(window)



Teardown pyblish-nuke

To get rid of the menu, and completely remove any trace of pyblish-nuke from your Nuke session, run teardown().

import pyblish_nuke
pyblish_nuke.teardown()

This will do the opposite of setup() and clean things up for you.




No GUI

In the event that no GUI is registered upon running setup(), the button will provide the user with this information on how they can get up and running on their own.

image

image

image

Environment Variables

You can customize the integration with these environment variables:

Environment Variable Description Examples
PYBLISH_HOTKEY Hotkey for executing File > Publish. The hotkey is not case-sensitive. You can read more about it here. ctrl+p, Ctrl+Alt+P, CTRL+SHIFT+P

pyblish-nuke's People

Contributors

darkvertex avatar mottosso avatar mruegenberg avatar tokejepsen avatar yanshil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyblish-nuke's Issues

error with the silent non-GUI publish

I see an error when I try to run File --> Publish
But the UI launches fine (File --> Publish...)

Nuke 14

Is anyone else facing the issue? Looks like the issue is with the callback

Traceback (most recent call last):
  File "D:\<>\pipe-20\.venv\Lib\site-packages\pyblish\lib.py", line 273, in emit
    callback(**kwargs)
  File "D:\<>\pipe-20\.venv\Lib\site-packages\pyblish_nuke\lib.py", line 195, in on_published
    for r in context.data["results"]:
AttributeError: 'NoneType' object has no attribute 'data'

TypeError: _show_no_gui() takes 0 positional arguments but 1 was given

Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\user.folder\packages\nuke_pyblish\999.0.0.dev\site-packages\pyblish_nuke\lib.py", line 70, in show window = (_discover_gui() or _show_no_gui)(parent) TypeError: _show_no_gui() takes 0 positional arguments but 1 was given

I am having the error above with the latest version, Nuke 13.0v8

Images missing in distribution

When installing via pip the images (splash.png etc) seem to be missing...

I don't know much about Python package distribution, but would assume the fix would be to change, in setup.py:

package_data={"pyblish_nuke": ["plugins/*.py", "nuke_path/*.py"]},

to

package_data={"pyblish_nuke": ["plugins/*.py", "nuke_path/*.py", "*.png"]},

No module named PyQt5

When launching the GUI from within Nuke, I get this error.

Traceback (most recent call last):
  File "C:\Program Files\Nuke8.0v1\lib\runpy.py", line 162, in _run_module_as_ma
in
    "__main__", fname, loader, pkg_name)
  File "C:\Program Files\Nuke8.0v1\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\pythonpath\pyblish_qml\app.py", line 17, in <module>
    from PyQt5 import QtGui, QtCore, QtQml
ImportError: No module named PyQt5

Even though I've got PyQt5 installed.

Qt5: AttributeError: 'module' object has no attribute 'QProgressBar'

Hi I am getting the error

'module' object has no attribute 'QProgressBar'

import pyblish.api
import pyblish_qml.api as api
import pyblish_qml
os.environ["PYTHONPATH"] = os.sep.join(pyblish_qml.file.rsplit(os.sep)[:-2])
os.environ["QML2_IMPORT_PATH"] = 'C:/Python27/Lib/site-packages/PyQt5/qml'
pyblish.api.register_gui("pyblish_qml")
api.register_python_executable("C:/python27/python.exe")
api.register_pyqt5('C:/Python27/Lib/site-packages/PyQt5')
pyblish.api.register_gui("pyblish_qml")

# 2. Set-up Pyblish for Nuke
import pyblish_nuke
pyblish_nuke.setup()

Support for Linux and OSX

It struck me the that this integration is probably only supported on Windows, due to the use of where().

We need where, because Nuke has an executable called python in it's own directory, and where bypasses this by only considering those on the PATH.

How can we solve this for other platforms?

Publish submenu

Since Nuke doesn't have the GUI button next to a menu item, I was thinking of modifying the "Publish" item to a submenu when a frontend is available.

nuke_integration on OSX

When I try pyblish_nuke.setup() on OSX, I get this.

# Result: pyblish_nuke.setup()
# Result: Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Volumes/Repository/python_globals/sitepackages_pyblish_1.3.2_osx/pyblish/pythonpath/pyblish_nuke/lib.py", line 40, in setup
    pyblish_integration.setup(console=console, port=port)
  File "/Volumes/Repository/python_globals/sitepackages_pyblish_1.3.2_osx/pyblish/pythonpath/pyblish_integration/lib.py", line 99, in setup
    self.port = self.proxy.find_available_port(*args)
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1578, in __request
    verbose=self.__verbose
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1473, in parse_response
    return u.close()
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 793, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<type 'exceptions.IOError'>:[Errno 32] Broken pipe">
Exception in thread server:
Traceback (most recent call last):
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Volumes/Repository/python_globals/sitepackages_pyblish_1.3.2_osx/pyblish/pythonpath/pyblish_integration/lib.py", line 136, in server
    self.server = pyblish_rpc.server.start_production_server(port)
  File "/Volumes/Repository/python_globals/sitepackages_pyblish_1.3.2_osx/pyblish/pythonpath/pyblish_rpc/server.py", line 122, in start_production_server
    return _serve(port, service)
  File "/Volumes/Repository/python_globals/sitepackages_pyblish_1.3.2_osx/pyblish/pythonpath/pyblish_rpc/server.py", line 108, in _serve
    server = _server(port, service)
  File "/Volumes/Repository/python_globals/sitepackages_pyblish_1.3.2_osx/pyblish/pythonpath/pyblish_rpc/server.py", line 93, in _server
    logRequests=False)
  File "/Volumes/Repository/python_globals/sitepackages_pyblish_1.3.2_osx/pyblish/pythonpath/pyblish_rpc/server.py", line 65, in __init__
    **kwargs)
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SimpleXMLRPCServer.py", line 593, in __init__
    SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 408, in __init__
    self.server_bind()
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 419, in server_bind
    self.socket.bind(self.server_address)
  File "/Applications/Nuke9.0v8/Nuke9.0v8.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
TypeError: an integer is required

Terminal logging

Found that nuke has a nuke.tprint option that prints to the terminal.

This might be a better option to print with for any outputs (if you aren't using the fronend), as it persists better. Currently the output from Pyblish goes into a script editor (if open), and gets lost when you close the script editor.

Vendor Qt.py

Hello,
I seem to have a similar issue to this one described in #pyblish-lite/103.

The solution described there (replacing .vendor.Qt by Qt so the install of Qt.py 1.3.8 from my local environment is used) also works for me with pyblish-nuke. (Note I'm also using pyblish-lite but didn't have to replace the vendor.Qt import there)

This is with Nuke 13.2v8.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.