I hereby claim:
- I am jaforsgren on github.
- I am jaforsgrengmailc (https://keybase.io/jaforsgrengmailc) on keybase.
- I have a public key ASDtfIihdpjnwJVF_HrsYzYsUXf1YLEpvXn3e6_C7RngZgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
@pytest.hookimpl(tryfirst=True, hookwrapper=True) | |
def pytest_runtest_makereport(item, call): | |
# execute all other hooks to obtain the report object | |
outcome = yield | |
rep = outcome.get_result() | |
# set a report attribute for each phase of a call, which can | |
# be "setup", "call", "teardown" | |
setattr(item, "rep_" + rep.when, rep) |
old_primitive = { 'material': '2.mat', 'verts': [1, 4, 7, 7, 8, 9, 9, 0, 0]} | |
tris = [old_primitive['verts'][i:i+3] for i in range(0, len(old_primitive['verts']), 3)] | |
new_primitives = {} | |
primitive_id = 0 | |
new_element = {'triangles':[]} | |
for i, tri in enumerate(tris): | |
prev = [item for sublist in tris[:i] for item in sublist] | |
if any(v in prev for v in tri): | |
new_primitives[primitive_id] = new_element |
fn traverseMaterials materialList fix_func = ( | |
/*traverses materials, applies fix_func on vraymtl materials */ | |
for mat in materialList do( | |
if mat != undefined then( | |
if (classof mat) == vraymtl then( | |
fix_func(mat) | |
) | |
else if (classof mat) == multimaterial then( | |
traverseMaterials mat.materialList fix_func | |
) |
import re | |
s = "MAT00001V1_materialName" | |
result = re.search('MAT\d+V\d+', s) | |
if result is not None: | |
l = result.group(0) | |
print(l) |
-- swiped from https://forums.cgsociety.org/t/getting-a-list-of-scene-bitmap-paths/1545447/8 | |
gc() -- just for this example, to make sure everything is nice and clean | |
-- find the scene root. The rootnode, medit, etc are references off this scene root | |
sceneroot = (for r in (refs.dependents rootnode) where (classof r == Scene) collect r)[1] | |
-- collect all the assets | |
origAssets = for i = 1 to AssetManager.GetNumAssets() collect (AssetManager.GetAssetByIndex i) |
def getKeyValues(dictionary, key, entryList=[]): | |
pList = [] | |
for entry in dictionary: | |
if isinstance(dictionary[entry],list): | |
for i in dictionary[entry]: | |
pList += getKeyValues(i,key) | |
else: | |
if isinstance(dictionary[entry],list): | |
pList += getKeyValues(dictionary[entry],key) | |
if isinstance(dictionary[entry],dict): |
def createLayerShuffles(node): | |
# thanks to Peter Hartwig for this code | |
channels = node.channels() | |
layers = list( set([c.split('.')[0] for c in channels]) ) | |
for layer in layers: | |
if not "Obj" in layer: | |
if not "MtlID" in layer: | |
if "Raw" in layer or "DiffuseFilter" in layer: |
fn findhead obj = | |
( | |
if (isGroupHead obj) | |
then (return obj) | |
else (if (isGroupMember obj) then (findhead (obj.parent)) else (return undefined)) | |
) |
import os | |
renderDir = r"//DISKSTATION/Projects/Vikingbad/Komponentbibliotek/PreviewStudio/RenderOuput/20170927/20171002_Renders_pre/" | |
outputDir = r"//DISKSTATION/Projects/Vikingbad/Komponentbibliotek/PreviewStudio/RenderOuput/20170927/jpg/" | |
readNode = nuke.toNode('Read2') | |
writeNode = nuke.toNode('Write1') | |
for render in os.listdir(renderDir): | |
readNode.knob('file').setValue(renderDir+render) | |
print readNode.knob('file').value() |