This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import os | |
from socket import gethostname | |
import datetime | |
import psutil | |
NOTION_API_KEY = 'your notion api key' | |
DATABASE_ID = 'your database id' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = int(nuke.Root().knob('first_frame').getValue()) | |
end = int(nuke.Root().knob('last_frame').getValue()) | |
step = 1 | |
for o in nuke.selectedNodes(): | |
nuke.execute(o, start, end, step) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymel.core import * | |
start = int(playbackOptions(q=True, min=True)) | |
end = int(playbackOptions(q=True, max=True)) | |
fps = 24 | |
tracklength = end-start+1 | |
clipfile = 'path/to/your_clip/scenewarp.clip' | |
time = PyNode('time1') | |
vals = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# transformではなくshapeにアトリビュートを持たせないとHoudiniに持っていけないところがミソ | |
from pymel.core import * | |
sgs = ls(type='shadingEngine') | |
for sg in sgs: | |
shapes = listConnections(sg.dagSetMembers, s=True, d=False, p=False) | |
for sh in shapes: | |
shs = sh.getShapes() if objectType(sh, i='transform') else [sh] | |
for o in shs: | |
attrname = 'sg' | |
addAttr(o, ln=attrname, dt='string') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 任意のノードのパラメータのキーフレームの打たれたフレームを取得する | |
hou.node('/obj/work/mynode').parm("parm").keyframes()[index].frame() | |
# 例: switchノードのinput1の任意のパラメータの一番最初のフレーム以上の場合、switchのinputを1にするExpression | |
hou.frame()>=pwd().inputs()[1].parm('parm').keyframes()[index].frame() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NukeでWrite.fileによく使うエクスプレッション | |
# 作業中のスクリプトが C:/work/nuke/nuke_test_v01.nk だった場合、 | |
# 以下のExpressionをWrite.fileに記述しておくことで、 | |
# C:/work/nuke/render/nuke_test_v01/nuke_test_v01.####.tif に出力される。 | |
# [lindex [split [lindex [split [knob [topnode].file] .] 0] /] end] の部分で | |
# 現在のnukeスクリプトの名前を取得しているのでファイル名やパスが変わっても自動で出力可能。 | |
# 毎回記述を忘れるのでメモまで。 | |
[file dirname [value root.name]]/render/[lindex [split [lindex [split [value root.name] .] 0] /] end]/[lindex [split [lindex [split [value root.name] .] 0] /] end].%04d.tif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import acv | |
import struct | |
filepath = 'C:/users/hoge/curve.acv' | |
luts = [] | |
with open(filepath, 'rb') as f: | |
header = f.read(4) | |
for i in range(len('mrgba')): | |
ncvs = struct.unpack('>BB', f.read(2))[1] | |
ipairs = [struct.unpack('>BBBB', f.read(4))[1::2] for k in range(ncvs)] | |
pairs = [(ix/255., iy/255.) for iy, ix in ipairs] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AEの.acvファイルをNukeに持っていく用にリサーチ | |
# 冒頭4バイトはヘッダ?処理に必要そうなものではなかったので一旦無視 | |
# その後はマスター, R, G, B, Aと全5チャンネル分の情報が、 | |
# 制御点の個数, (制御点の位置(x), 制御点の値(y)) x 個数分 という感じで全チャンネル分記載されていた | |
### 注意 ### | |
# Jupyterで書いてたためPython3.xなのでそのままだとDCCでは使えないかもしれない、、 | |
filepath = 'C:/users/hoge/curve.acv' | |
with open(filepath, 'rb') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reference: | |
# https://blender.stackexchange.com/questions/23433/how-to-assign-a-new-material-to-an-object-in-the-scene-from-python | |
import bpy | |
mat = bpy.data.materials.get('my_material') | |
for o in bpy.context.selected_objects: | |
if o.data.materials: | |
ob.data.materials[0] = mat | |
else: | |
o.data.materials.append(mat) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// carveする値。ここにバラバラの値を入れればバラバラにcarveも可能。 | |
float carve = fit(f@Frame, 1, 24, 1, 0); | |
int pts[] = primpoints(0, i@primnum); | |
// carve後のcurveのポイントを保持する配列 | |
int newpts[] = {}; | |
foreach (int pt; pts) { | |
float u = point(0, "curveu", pt); | |
// carveの向きはここの条件やcarveの変化を変えればOK | |
if (u<carve) | |
removepoint(0, pt); |
NewerOlder