Skip to main content
https://img.shields.io/pypi/l/nukecontexts.svg https://img.shields.io/pypi/pyversions/nukecontexts.svg https://img.shields.io/pypi/v/nukecontexts.svg https://img.shields.io/pypi/wheel/nukecontexts.svg https://readthedocs.org/projects/nukecontexts/badge/?version=latest

nukecontexts is a library of composable context managers for Nuke to manage the state of complex compositing scripts in code.

Full Documentation

Installation

To install nukecontexts, type:

$ pip install nukecontexts

Open Nuke’s init.py file and add:

nuke.pluginAddPath('/path/to/your/local/python/site-packages')

Getting Started

The most common use case for nukecontexts is automated rendering of multiple states of a compositing script. For example two different output formats, jpg and png.

import nuke
from nukecontexts import ctx

render_node = nuke.toNode('Write1')
with ctx.set_attr(render_node, 'file_type', 'jpeg'):
    nuke.execute(render_node.name(), 1, 1, 1)
with ctx.set_attr(render_node, 'file_type', 'png'):
    nuke.execute(render_node.name(), 1, 1, 1)

The power of nukecontexts comes with composable contexts, using multiple_contexts(). Arbitrarily complex, varying states of the compositing script can be defined and used to automatically generate different results.

merge_node = nuke.toNode('Merge1')
grade_node = nuke.toNode('Grade1')
switch_node = nuke.toNode('Switch1')

ctx1 = ctx.enable([merge_node, grade_node])
ctx2 = ctx.set_attr(grade_node, 'white', 2.0)
ctx3 = ctx.set_attr(switch_node, 'which', 0)
ctx4 = ctx.disable(merge_node)

with ctx.multiple_contexts([ctx1, ctx2, ctx3]):
    """Render with the merge_node and grade_node enabled, the
    grade_node's white attribute set to 2.0 and the switch_node's switch
    position set to 0."""
    nuke.execute(render_node.name(), 1, 1, 1)

with ctx.multiple_contexts([ctx3, ctx4]):
    """Render with the switch_node's switch position set to 0 and the
    merge node disabled; the grade_node's gain value remains at the
    original value."""
    nuke.execute(render_node.name(), 1, 1, 1)

Metadata

Release files for nukecontexts 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nukecontexts 0.2.0
File Size Uploaded Provenance Actions
nukecontexts-0.2.0.tar.gz 14.0 kB Without provenance Details for nukecontexts-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nukecontexts 0.2.0
File Interpreter ABI Platform Actions
nukecontexts-0.2.0-py2-none-any.whl Python 2 none any Details for nukecontexts-0.2.0-py2-none-any.whl

Total release size: 21.4 kB

Release files / nukecontexts-0.2.0.tar.gz

Download URL nukecontexts-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7a39e32bd3d8a94861e294dc09e0e28ef4cbc8a2d11e400d05713b3ddb8345ed
BLAKE2b-256 checksum
How to use checksums
68a7b1e6c0865bb53f36b896ebe7ac63e1e0d858190f9a056b0260bf8ae84b42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nukecontexts-0.2.0-py2-none-any.whl

Download URL nukecontexts-0.2.0-py2-none-any.whl
Size 7.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
202c5b858401300a31f2cfadb89bb6e6f1ad278a1aa9673b477dfeae8740b750
BLAKE2b-256 checksum
How to use checksums
33a0a1b4680700ec0a1b4255267bcec976bd83c3973d5accdbdbde93616c3f67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nukecontexts 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page