Skip to content

Instantly share code, notes, and snippets.

@greenvfx
greenvfx / duplicate_selected_node_with_inputs.py
Created January 18, 2018 12:35
Duplication of selectrd nodes with inputs.
def duplicate_selected_node_with_inputs():
sn = nuke.selectedNode()
nuke.nodeCopy(nukescripts.edit.cut_paste_file())
nodes = nuke.allNodes();
for i in nodes:
i.knob("selected").setValue(False)
@michimussato
michimussato / clipboardfix.py
Created April 6, 2016 09:51
Copy/Paste fix (from PyCharm to Maya 2014)
from PySide import QtGui, QtCore
def removeInvalidClipboardData():
oldMimeData = QtGui.qApp.clipboard().mimeData()
newMimeData = QtCore.QMimeData()
for format in oldMimeData.formats():
if 'text/uri-list' in format: #This breaks maya paste
continue
data = oldMimeData.data(format)
newMimeData.setData(format, data)
@nrtkbb
nrtkbb / compile.sh
Last active September 28, 2023 03:51
Hello Cython in Maya
# Install pip
# $ curl -kL https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
#
# Install Cython
# $ pip install cython
#
# compile command
python setup.py build_ext --inplace
@maty974
maty974 / gist:66e29df303d1f1825a53
Last active May 3, 2016 08:32
QSortFilterProxyModel and QListView - indexWidget get deleted when filtering
import PySide.QtGui as QtGui
import PySide.QtCore as QtCore
_DEFAULT_ITEM_SIZE = QtCore.QSize(100, 85)
_USER_ROLE = QtGui.QStandardItem.UserType + 1
class CustomItemWidget(QtGui.QWidget):
def __init__(self, parent=None):
super(CustomItemWidget, self).__init__(parent=parent)
@kissgyorgy
kissgyorgy / remove_punc.py
Created June 8, 2013 08:01
Python: Remove punctuation from string
#http://stackoverflow.com/questions/265960/best-way-to-strip-punctuation-from-a-string-in-python
import re, string
table = string.maketrans("","")
regex = re.compile('[%s]' % re.escape(string.punctuation))
def test_re(s): # From Vinko's solution, with fix.
return regex.sub('', s)
def test_trans(s):