Skip to content

Instantly share code, notes, and snippets.

View UnaiM's full-sized avatar
🤓
Learning

Unai Martínez Barredo UnaiM

🤓
Learning
View GitHub Profile
@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
@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]
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 / 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)
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 / obs_props_update.lua
Created April 7, 2021 22:38
Example of a question in the OBS Discord community
local elapsed = 0
function script_properties()
local props = obslua.obs_properties_create()
obslua.obs_properties_add_bool(props, 'foo', 'Foo')
return props
end
function script_tick(seconds)
if elapsed then
@UnaiM
UnaiM / on_dispatch.py
Last active August 22, 2023 21:04
Gaffer: trying to add the ability to modify the graph on dispatch
import os
import Gaffer
import GafferDispatch
# Add an 'onDispatch' task input to all task nodes.
tasknode_init_orig = GafferDispatch.TaskNode.__init__
@UnaiM
UnaiM / plot_lut
Last active August 22, 2023 21:09
Given a LUT file, plot its luma EOTF to a tiny image
#! /usr/bin/env python
import argparse
import OpenImageIO as oiio
LUMA = (0.2126, 0.7152, 0.0722)
@UnaiM
UnaiM / support_etiquette.md
Last active August 22, 2023 21:11
Sometimes I wish this was in every company’s Wiki

Support Etiquette

# In this situation Don’t say this Because…
1 On a ticket whose status is New and with 0 comments Has anyone started looking into this? You can already see that the answer is ‘no’— this comment really is a rhetorical tactic to jump the queue, which is very disrespectful to everyone affected by other ongoing issues.
2 On an active ticket Can we bump the priority on this? The answer is always ‘no’— you’re talking to people, not the render farm; an issue is either active or it isn’t, and you can see its status. By saying this, you’re implying that the people working on it aren’t giving their 100% at work, which is disrespectful.
3 When a problem occurs This is really inconvenient / This isn’t an optimal situation to be in Comments like these are demoralising for everyone and don’t provide any helpful information.
4 When a problem occurs This shouldn’t take long for you to fix You’re implying that you know better about a technic
@UnaiM
UnaiM / rollingshutter-never-left-us.md
Created November 7, 2023 09:10
How to correct rolling shutter in NukeX without plugins

RollingShutter never left us

(AKA How to Correct Rolling Shutter in NukeX Without Plugins) – 11th December 2014

As you may know, The Foundry had a really good plugin for Nuke and After Effects called RollingShutter, used to try and remove the so-called effect that most of current cameras’ sensors introduce in the footage.

YouTube video by The Foundry titled ‘RollingShutter - an introduction’.
(VIDEO) RollingShutter - an introduction

Every other popular rolling shutter fix uses the “global skew” method mentioned in the video, even After Effects’ Warp Stabilizer and Rolling Shutter Repair in its default setting (the Pixel Motion mode suggests a more accurate approach). This method is fundamentally wrong unless the camera is just panning and nothing moves in the shot.