Skip to content

Instantly share code, notes, and snippets.

@hmasato
hmasato / PY_numToAlphaSeq.py
Last active May 16, 2016 15:03
[Python] numToAlphaSeq: int value to str sequence
#hmasato
#https://gist.github.com/hmasato/8979ff25e9d2c5d44883
def numToAlphaSeq(intValue, upperCase = True, baseStr = 'abcdefghijklmnopqrstuvwxyz'):
ret = ''
if not str(intValue).isdigit(): return(ret)
baseDecimal = len(baseStr)
while intValue >= 0:
remainder = int(intValue % baseDecimal) #remainder
intValue = (intValue - 1 - remainder) / baseDecimal
@hmasato
hmasato / MAYA_grabFrameBufferToQImage.py
Last active August 17, 2018 01:36
[Maya, python, PyQt, PySide] grabFrameBufferToQImage (MImage and QPixmap) #screenshot
#hmasato
#https://gist.github.com/hmasato/b72a95fbadf1c63b56ec
#------------------------------
#grab frame buffer to QImage
#------------------------------
import ctypes
import maya.OpenMaya as om
import maya.OpenMayaUI as omui
@hmasato
hmasato / MAYA_scriptEditor_replaceSelected.mel
Last active May 16, 2016 15:06
[Maya, mel] _scriptEditor_replaceSelected
//hmasato
//https://gist.github.com/hmasato/64427eb43ad89742b811
//
//_scriptEditor_replaceSelected
//
proc _scriptEditor_replaceSelected(string $src, string $dst)
{
global string $gLastFocusedCommandExecuter;
@hmasato
hmasato / my_pasteParamsAsStamp.py
Last active May 16, 2016 15:08
[houdini, python] Paste Copied (Rel/Abs) References for stamp()
#hmasato
#https://gist.github.com/hmasato/996e5d40542937b1f5e4
#PARMmenu.xml
"""
<?xml version="1.0" encoding="UTF-8"?>
<menuDocument>
<menu>
<scriptItem id="my_pasteRefAsStamp">
@hmasato
hmasato / PARMmenu.xml
Last active September 29, 2015 09:09
[houdini, xml] custom PARMmenu for stamp
<?xml version="1.0" encoding="UTF-8"?>
<menuDocument>
<menu>
<scriptItem id="my_pasteRefAsStamp">
<label>* Paste References [stamp]</label>
<insertBefore>paste_channels</insertBefore>
<scriptPath>$HOME/houdini14.0/scripts/my_pasteParamsAsStamp.py</scriptPath>
<scriptArgs>absolute</scriptArgs>
</scriptItem>
@hmasato
hmasato / MAYA_findFlippedUVs.py
Last active January 26, 2021 01:56
[Maya, python] _findFlippedUVs
# -*- coding: utf-8 -*-
import maya.OpenMaya as om
import maya.cmds as cmds
def _findFlippedUVs(nodesOnly=True):
ret = []
selList = om.MSelectionList()
@hmasato
hmasato / MAYA_ovrAttr.mel
Last active August 29, 2015 13:56
[Maya, mel] _ovrAttr
//override & set
proc _ovrAttr(string $node, string $attr, string $v)
{
string $plg = $node + "." + $attr;
if(!objExists($plg)) return;
editRenderLayerAdjustment($plg);
string $cmd = "setAttr \""+$plg+"\"";
string $typ = `getAttr -type $plg`;
switch($typ){
case "string": $cmd += " -type \"string\" \"" + $v + "\""; break;
@hmasato
hmasato / JS_seqParser.js
Created December 3, 2013 05:36
[Javascript] _seqParser
//--------------------------------
// zero padding
//--------------------------------
function _padding(val,n)
{
n -= (''+val).length-1;
return((n>0?(new Array(n)).join('0'):'')+val);
}
//--------------------------------
// examples:
@hmasato
hmasato / JS_padding.js
Created November 25, 2013 15:29
[Javascript] _padding
function _padding(val,n)
{
n -= (''+val).length-1;
return((n>0?(new Array(n)).join('0'):'')+val);
}
@hmasato
hmasato / MAYA_qset2obj.mel
Created November 22, 2013 13:27
[Maya, mel] _qset2obj
proc string[] _qs2obj(string $qs[])
{
string $q[]=`ls -type "objectSet" $qs`;
if(size($q)<1) return($qs);
return(stringArrayCatenate(stringArrayRemove($qs, $q), _qs2obj(`sets -q $q`)));
}