This file contains 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
node_names = [] | |
alts = [] | |
for i in nuke.selectedNodes(): | |
name = i['name'].value() | |
alt = i.ypos() | |
node_names.append(name) | |
alts.append(alt) | |
i.knob('selected').setValue(False) # Deselects nodes as it goes through. |
This file contains 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 PySide2 import QtWidgets, QtGui, QtCore | |
def snap_value(value, snap_points, snap_threshold, verbose=False): | |
""" | |
Given a value and a list of "snapping points" it can snap to, | |
snap it to the closest value if it's within the snapping threshold. | |
""" | |
if not snap_points: return value |
This file contains 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 abc | |
import json | |
import inspect | |
from collections import defaultdict | |
from typing import Type, Iterable | |
from functools import partial | |
from PySide2 import QtWidgets, QtGui, QtCore | |
This file contains 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
set cut_paste_input [stack 0] | |
version 11.3 v4 | |
push $cut_paste_input | |
NoOp { | |
name DeNodal1 | |
knobChanged "def main():\n import re\n node = nuke.thisNode()\n \n fixedLetters = node\[\"fixedLetters\"].getValue().strip().lower()\n floatingLetters = node\[\"floatingLetters\"].getValue().strip().lower()\n antiLetters = node\[\"antiLetters\"].getValue().strip().lower()\n wordList = node\[\"wordList\"].getValue().split(\",\")\n \n if not any((char.isalpha() for char in fixedLetters)) \\\n and not floatingLetters \\\n and not antiLetters:\n node\[\"solutions\"].setValue(\"no input\")\n return\n \n fixedPattern = fixedLetters.replace(\"_\", r\"\\w\")\n candidateWords = \[]\n for word in wordList:\n if re.match(fixedPattern, word) \\\n and all((char in word for char in floatingLetters)) \\\n and not any((char in word for char in antiLetters)):\n candidateWords.append(word)\n \n if candidateWords:\n solution |
This file contains 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 PySide2 import QtGui, QtSvg | |
import os | |
FOLDER = r"C:\Users\mkehn\Desktop\test_theme\theme\primary" | |
def convertPngToSvg(filepath, size): | |
folder, filename = os.path.split(filepath) | |
basename, ext = os.path.splitext(filename) | |
image = QtGui.QImage(size, size, QtGui.QImage.Format_ARGB32) | |
image.fill(0) |
This file contains 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 sqlalchemy.ext.declarative import declarative_base | |
Base = declarative_base() | |
# monkey-patch a nice __repr__ method onto the Base class. | |
def _niceRepr(self): | |
""" | |
Nicely format class name and column values. | |
Looks up the inheritance hierarchy for inherited columns and displays those too. | |
""" |
This file contains 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
NoOp { | |
name NoOp1 | |
selected true | |
xpos 352 | |
ypos 1985 | |
addUserKnob {20 Foo l "" n -2} | |
addUserKnob {20 Bar l Settings} | |
addUserKnob {7 float} | |
addUserKnob {20 Baz l Fun} | |
addUserKnob {7 float} |
This file contains 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 random | |
rp = nuke.selectedNode() | |
for element in rp['curves'].rootLayer: | |
if isinstance(element, nuke.rotopaint.Stroke) or isinstance(element, nuke.rotopaint.Shape): | |
attrs = element.getAttributes() | |
attrs.set("r", random.random()) | |
attrs.set("g", random.random()) | |
attrs.set("b", random.random()) |
This file contains 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 altpipe.shotgun.api import getShotgunConnection | |
from pprint import pprint | |
sg = getShotgunConnection() | |
user = sg.find_one("HumanUser", [["login", "is", "jtrudgian"]]) | |
versions = sg.find("Version", [["user", "is", user]], ["description"], limit=1000) | |
descriptions = [] | |
for version in versions: |
This file contains 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
""" | |
Smooth Camera | |
Creates a new camera linked to the selected one, with a weighted average of the position/rotation curves. | |
""" | |
import nuke | |
def deselectAll(): | |
for node in nuke.selectedNodes(): | |
node.setSelected(False) |
NewerOlder