栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Nuke python添加自定义工具架

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Nuke python添加自定义工具架

在C:UsersAdministrator.nuke路径下建一个__init.py的文件
再添加一个menu.py的文件

下边是menu.py的文件,并包含一个可以把当前文件中的单帧切换为序列的插件

# coding:utf-8
import nuke
import os


def frame_to_sequence():
    print 'frame_to_sequence'
    all_read = nuke.allNodes('Read')
    for node_ in all_read:
        file_path = node_['file'].value()
        num_list = []
        for file_name in os.listdir(os.path.dirname(file_path)):
            num_list.append(file_name.split(".")[-2])
        if len(num_list) > 1:
            num_list.sort()
            first = str(int(num_list[0]))
            end = str(int(num_list[-1]))
            print first, end
            new_path = file_path.replace(file_path.split(".")[-2], "%04d")
            node_['file'].setValue(new_path)
            node_['first'].setValue(int(first))
            node_['last'].setValue(int(end))
    nuke.message('Done!')

# 添加自定义工具架,并且调用函数
nuke.menu('Nuke').addCommand('Pipeline/frame_to_sequence', lambda: frame_to_sequence())

重启nuke之后,会有一个新的工具栏

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/354962.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号