NukeStudio常用命令参考
发表于更新于
字数总计:604阅读时长:2分钟阅读量: 长沙
获取项目
关于preject类的用法,在下面的链接查看
https://learn.foundry.com/hiero/developers/11.1/HieroPythonDevGuide/api/api_core.html#hiero.core.Project
1 2 3 4 5 6 7 8 9 10
| import hiero.core as hc all_projects = hc.projects()
for p in all_projects: print p.name()
name = 'test_project' p = hc.project(name)
|
创建Clip,放到对应的Sequence或者Bin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import hiero.core as hc file_path = r'D:\demo\shot001\shot001_v001.1001.exr'
m = hc.MediaSource(file_path)
c = hc.Clip(m)
bin_item = hc.BinItem(c)
p = hc.project('test_project') bin1 = p.bins('Bin 1')[0] bin1.addItem(bin_item)
|
关于Clip,MediaSource,binItem对象的方法:
https://learn.foundry.com/hiero/developers/11.1/HieroPythonDevGuide/api/api_core.html#hiero.core.Clip
https://learn.foundry.com/hiero/developers/11.1/HieroPythonDevGuide/api/api_core.html#hiero.core.MediaSource
https://learn.foundry.com/hiero/developers/11.1/HieroPythonDevGuide/api/api_core.html#hiero.core.BinItem
1 2 3 4 5 6
| import hiero.core as hc
file_path = r'D:\demo\shot001\shot001_v001.1001.exr' m = hc.MediaSource(file_path) m_infos = m.fileinfos() print m_infos[0].filename()
|
在项目顶层文件夹创建Bin
1 2 3 4 5
| import hiero.core as hc
p = hc.project('test_project') bin1 = hc.Bin('test') p.clipsBin().addItem(bin1)
|
将clip放置到时间线
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| """ 设置源文件出入点 TrackItem.setSourceIn() TrackItem.setSourceOut()
设置时间线出入点 TrackItem.setTimelineIn() TrackItem.setTimelineOut() """
import hiero.core as hc
file_path = r'D:\demo\shot001\shot001_v001.1001.exr'
p = hc.project('test_project') bin1 = p.bins('Bin 1')[0] s = bin1.sequences()[0]
m = hc.MediaSource(file_path) c = hc.Clip(m)
vt = s.activeItem().videoTrack(0) t = s.activeItem().videoTrack(0).createTrackItem('shot001')
t.setSource(c) t.setTimelineIn(1) t.setTimelineOut(22) vt.addItem(t)
|
添加在时间线右键触发事件
1 2 3 4 5 6 7 8
| import hiero.core as hc
def add_print(event): event.menu.addAction('print selected') selection = event.sender.selection() print selection
hc.events.registerInterest("kShowContextMenu/kTimeline", add_print)
|
获取选中的clip对象
1 2 3 4 5 6 7 8 9 10
| from hiero.core import TrackItem
seq = hiero.ui.activeSequence()
te = hiero.ui.getTimelineEditor(seq)
print te.selection()
|
直接在sequence添加clip
1 2 3 4 5 6 7 8 9 10 11 12 13
| import hiero.core as hc
file_path = r'D:\demo\shot006\BEN_0230_V001.1001.exr'
p = hc.project('test')
s = p.sequences('seq01')[0]
m = hc.MediaSource(file_path) c = hc.Clip(m) s.addClip(c, time=1001)
|
获取clip的matadata信息
1 2 3 4 5
| c.metadata().value('foundry.timeline.duration')
""" hasKey, keys, setValue, value """
|