Skip to content

Instantly share code, notes, and snippets.

View UnaiM's full-sized avatar
🤖
Beep boop

Unai Martínez Barredo UnaiM

🤖
Beep boop
View GitHub Profile
class Item(object):
def __init__(self, name):
self.name = name
self.links = []
def __repr__(self):
return self.name
a, b, c, d, e, f, g, h = (Item(x) for x in 'abcdefgh')
@UnaiM
UnaiM / del_corrupted_refs.py
Created November 28, 2019 17:37
Script for Maya that deletes reference nodes that have been mysteriously corrupted (not showing anywhere, not pointing anywhere).
import maya.cmds as mc
refs = []
message = 'No corrupted references to delete.'
for ref in mc.ls(references=True):
try:
mc.referenceQuery(ref, filename=True)
except RuntimeError:
mc.lockNode(ref, lock=False)
refs.append(ref)
import re
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from shiboken2 import wrapInstance
import maya.cmds as mc
from maya.OpenMayaUI import MQtUtil
@UnaiM
UnaiM / ZBrush_ExternalPlugins_Win.txt
Last active September 4, 2023 05:48
ZScript for Windows that loads any ZScript inside the folders defined in the ZBRUSH_PLUGIN_PATH environment variable.
[VarDef, crlf, [StrMerge, [StrFromAsc, 13], [StrFromAsc, 10]]]
[VarDef, quot, [StrFromAsc, 34]]
[VarDef, temp, [FileNameResolvePath, "_deleteme"]]
[VarDef, bat, [StrMerge, temp, ".bat"]]
[VarDef, txt, [StrMerge, temp, ".txt"]]
[VarSet, offset, 0]
[RoutineDef, write,
[VarAdd, offset, [MemWriteString, externalPlugins,
[StrMerge, text, crlf], offset, 0]
@UnaiM
UnaiM / retimestab.py
Last active September 24, 2018 19:33 — forked from lcrs/retimestab.py
# Retime a tracked object to better fit a target curve
# Select two Transform nodes: the first with a jerky tracked curve, the
# second with a smooth target curve
# Group effort by Lewis Saunders, Unai Martínez Barredo, Erwan Leroy
# Make a function to calculate the distance between two points
def distance(a, b):
return pow((a[0]-b[0])**2 + (a[1]-b[1])**2, 0.5)
# Find the closest point to p on the line ab