nuke的可组合上下文管理器库

nukecontexts的Python项目详细描述


https://img.shields.io/pypi/l/nukecontexts.svghttps://img.shields.io/pypi/pyversions/nukecontexts.svghttps://img.shields.io/pypi/v/nukecontexts.svghttps://img.shields.io/pypi/wheel/nukecontexts.svghttps://readthedocs.org/projects/nukecontexts/badge/?version=latest

nukecontexts是一个可组合上下文管理器库,用于nuke管理代码中复杂合成脚本的状态。

Full Documentation

安装

要安装nukecontexts,请键入:

$ pip install nukecontexts

打开nuke的init.py文件并添加:

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

开始

nukecontexts最常见的用例是自动呈现合成脚本的多个状态。例如两种不同的输出格式,jpg和png。

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

nukecontexts的威力来自于使用multiple_contexts()的可组合上下文。可以定义任意复杂、变化的合成脚本状态,并用于自动生成不同的结果。

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)withctx.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)withctx.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)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
相对于框架java窗口的鼠标位置错误   Java 8流peek api   java将数据附加到文件中   java使用ExoPlayer 2.8播放播放列表中的特定文件   JavaSpring国际化:如何动态设置语言环境值   java如何在mysql中实现两个表之间的两个关联   java在gradle可执行jar文件中包含运行时参数   surefire插件中的java maven多套测试套件   java试图理解堆分析以确定内存泄漏或所需的大量内存   java识别字符串有数字   数组如何解决错误“java.lang.ArrayIndexOutOfBoundsException:5”   java Swt文件对话框选择的文件太多?   java此登录代码易受SQL注入攻击吗?   Java[3]中的文件<identifier>预期编译错误   java如何在spring webflux中发送列表   jar中未找到java文件异常   如何在java中合并2D数组?   java如何评测本机JNI库