Skip to content

Instantly share code, notes, and snippets.

View muhammadfredo's full-sized avatar

Muhammad Fredo muhammadfredo

  • Indonesia
View GitHub Profile
@theodox
theodox / MayaPyHost
Created November 2, 2018 23:34
interactive mayapy subprocess
"""
MayaPy.py
Remote control of a mayapy session with a simple proxy interface. This is not intended as a complete RPC server or anything of the sort; the primary use case is as an isolation chamber (since you can manipulate paths and environment variables) for use in testing.
"""
import subprocess
import cPickle as pickle
import os
@kowalcj0
kowalcj0 / .bashrc
Last active August 29, 2024 23:43
Extract all subtitles from a movie using ffprobe & ffmpeg
alias subs=subs
function subs() {
movie="${1}"
filename="${1%.*}"
mappings=`ffprobe -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 "${movie}"`
OLDIFS=$IFS
IFS=,
( while read idx lang
do
@BigRoy
BigRoy / maya_list_file_node_sequence_files.py
Created February 27, 2018 14:46
For maya file paths list all files that match a pattern like UDIM patterns or file sequence patterns
def seq_to_glob(path):
"""Takes an image sequence path and returns it in glob format,
with the frame number replaced by a '*'.
Image sequences may be numerical sequences, e.g. /path/to/file.1001.exr
will return as /path/to/file.*.exr.
Image sequences may also use tokens to denote sequences, e.g.
/path/to/texture.<UDIM>.tif will return as /path/to/texture.*.tif.
@RichardBronosky
RichardBronosky / pep8_cheatsheet.py
Created December 27, 2015 06:25
PEP-8 cheatsheet
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not PEP8-cheatsheet.py
@r4inm4ker
r4inm4ker / extractBlendShape.py
Last active May 13, 2024 09:27
extract blendshape target from blendshape node
import pymel.core as pm
import re
def parseVtxIdx(idxList):
"""convert vertex index list from strings to indexes.
idxList : [u'vtx[1]', u'vtx[3]', u'vtx[6]', u'vtx[8]', u'vtx[12:13]']
return : [1,3,6,8,12,13]
"""
parseIdxList = []
@mclavan
mclavan / rr_wrap.py
Last active September 26, 2023 05:35
Ryan Roberts - Wrap Deformer
'''
Ryan Roberts - Wrap Deformer
rr_wrap.py
Description:
Ryan Robers created a simple function to create a wrap deformer.
The wrap deformer needs a little more than the deform command to get working.
Michael Clavan
I wanted to have the function also return the deformer to the user. So, my contributions are pretty minor.
I converted the wrap deformer into a pynode object type pm.nt.Wrap.
@justinfx
justinfx / repeat.py
Created May 25, 2015 10:40
Example of a repeatable command decorate, for Maya (maya.cmds)
"""
Original example reformatted from:
http://blog.3dkris.com/2011/08/python-in-maya-how-to-make-commands.html
python_inside_maya discussion:
https://groups.google.com/d/topic/python_inside_maya/xfuCYBO6aLg/discussion
"""
import maya.cmds as cmds
@fredrikaverpil
fredrikaverpil / custom_ui_docked.py
Last active December 1, 2022 16:29
Create custom PySide GUI and dock it into Nuke UI
import PySide.QtCore as QtCore
import PySide.QtGui as QtGui
from nukescripts import panels
class PanelTest(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setLayout(QtGui.QVBoxLayout())
self.myTable = QtGui.QTableWidget()
self.myTable.header = ['Date', 'Files', 'Size', 'Path' ]
@mcleonard
mcleonard / vector.py
Last active October 22, 2024 12:31
A vector class in pure python.
import math
class Vector(object):
def __init__(self, *args):
""" Create a vector, example: v = Vector(1,2) """
if len(args)==0: self.values = (0,0)
else: self.values = args
def norm(self):
""" Returns the norm (length, magnitude) of the vector """
@href
href / dict_namedtuple.py
Created October 27, 2011 12:00
Convert any dictionary to a named tuple
from collections import namedtuple
def convert(dictionary):
return namedtuple('GenericDict', dictionary.keys())(**dictionary)
"""
>>> d = dictionary(a=1, b='b', c=[3])
>>> named = convert(d)
>>> named.a == d.a
True
>>> named.b == d.b