Skip to content

Instantly share code, notes, and snippets.

@hmasato
hmasato / MB_mobuTest01.py
Last active December 26, 2015 20:28
[Motionbuilder, python] _mobuTest01 Re: Looking for animation sandbox solution. http://forums.autodesk.com/t5/MotionBuilder-General/Looking-for-animation-sandbox-solution/m-p/4527329
#------------------------------------------------
# Re: Looking for animation sandbox solution. - Autodesk Discussion Groups
# http://forums.autodesk.com/t5/MotionBuilder-General/Looking-for-animation-sandbox-solution/m-p/4527329
#------------------------------------------------
#------------------------------------------------
# just experiment ;)
# step1: cleanup code
#
# takeName2takeID={"Walking":0, "Idle2Walk":1, "Kicking":2, "Standing":3, "Walk2Idle":4, "Seated":5}
@hmasato
hmasato / MAYA_system.mel
Last active December 27, 2015 18:18
[Maya, MEL, Win] _system
proc string _system(string $cmd)
{
string $tmp = "";
string $dir = `pwd`;
if(match("^//", $dir)!="") $tmp=getenv("TEMP");
if($tmp == "") return( system($cmd) );
chdir($tmp);
string $ret = system($cmd);
chdir($dir);
@hmasato
hmasato / MAYA_getFileTextures.mel
Created November 13, 2013 12:38
[MAYA, Mel] _getFileTextures
proc string[] _getFileTextures(string $node)
{
string $ret[] = {};
if($node=="") return($ret);
if(!objExists($node)) return($ret);
string $sels[]=`ls -sl`; //store config
select -hi -r $node;
@hmasato
hmasato / MAYA_playVLC.mel
Created November 13, 2013 13:22
[Maya, Mel, Win] _playVLC
proc _playVLC(string $files[])
{
if(size($files)<1) return;
string $app="C:/PathToVLC/vlc.exe";
if(!`filetest -x $app`) return;
string $opt = " --one-instance -R";
string $cmd="";
for($f in $files){
@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`)));
}
@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 / 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 / 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 / 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 / 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>