//adds one frame to your animation
float $t = `currentTime -q`;
keyframe -r -time ($t+":") -timeChange 1;
nextOrPreviousFrame "next";
//adds one frame to your animation
float $t = `currentTime -q`;
keyframe -r -time ($t+":") -timeChange -1;
nextOrPreviousFrame "previous";
//Toggle Isolate Selected in Current Panel
$currentPanel = `getPanel -withFocus`;
$state = `isolateSelect -q -state $currentPanel`;
if ($state == "0")
{
if ( `objExists ("LAYOUT")` ) select -add "LAYOUT";
if ( `objExists ("CAMERAS")` ) select -add "CAMERAS";
if ( `objExists ("constraints")` ) select -add "constraints";
//if ( `objExists ("FACES")` ) select -add "FACES";
enableIsolateSelect $currentPanel 1;
}
else
{
enableIsolateSelect $currentPanel 0;
}
//Toggle Isolate Selected in Current Panel
$currentPanel = `getPanel -withFocus`;
global float $switcher;
if ($switcher == 0)
{
isolateSelect -addSelected $currentPanel;
$switcher = 1;
print "added to current pannel";
}
else
{
isolateSelect -removeSelected $currentPanel;
$switcher = 0;
print "removed to current pannel";
}
string $selObjs[] = `ls -sl`;
string $selChannelA[] = `channelBox -q -selectedHistoryAttributes mainChannelBox`;
string $channelCountA = `size($selChannelA)`;
string $selChannelB[] = `channelBox -q -selectedMainAttributes mainChannelBox`;
string $channelCountB = `size($selChannelB)`;
if ($channelCountA!=0)
{
select -cl;
for ($obj in $selObjs)
{
for ($i = 0; $i < size($selChannelA); $i++)
{
select -add ($obj+"."+$selChannelA[$i]);
//print ($selObjs[0]+"."+$selChannelA[$i]+" is isolated"+"\n");
}
}
}
else {
string $animCurves[] = `keyframe -q -name`;
select -clear;
for ($obj in $animCurves)
{
select -add $obj;
}
};
if ($channelCountB!=0)
{
select -cl;
for ($obj in $selObjs)
{
for ($i = 0; $i < size($selChannelB); $i++)
{
select -add ($obj+"."+$selChannelB[$i]);
//print ($selObjs[0]+"."+$selChannelB[$i]+" is isolated"+"\n");
}
}
};
import maya.cmds as cmds
import maya.OpenMayaUI as mui
import shiboken
import maya.mel as mel
from PySide import QtGui
mel.eval('GraphEditor')
def get_graphEditor():
ptr2=mui.MQtUtil.findLayout("graphEditor1Window|TearOffPane")
return shiboken.wrapInstance(long(ptr2), QtGui.QWidget)
graphEditor=get_graphEditor()
graphEditor.setWindowOpacity(0.5)
def ref(value):
graphEditor.setWindowOpacity(value)
## cmds.floatSlider(p="graphEditor1Window|TearOffPane|graphEditor1",min=0.1, max=1.0, v=0.3, dc=lambda x:ref(x))
import shiboken
from PySide import QtGui, QtCore
import maya.OpenMayaUI as apiUI
import maya.mel as mm
mm.eval("GraphEditor")
ptr = apiUI.MQtUtil.findWindow('graphEditor1Window')
widget = shiboken.wrapInstance(long(ptr), QtGui.QWidget)
splitter = widget.children()[1]
subWidget = splitter.children()[0]
subSubWidget = subWidget.children()[2]
subSubWidget.children()[1].hide()
string $selObjs[] = `ls -sl`;
for ($node in $selObjs){
spaceLocator -n ($node+"_Anim");
select $node; select -tgl ($node+"_Anim");
orientConstraint -offset 0 0 0 -weight 1;
pointConstraint -offset 0 0 0 -weight 1;
delete ($node+"_Anim_orientConstraint1");
delete ($node+"_Anim_pointConstraint1");
orientConstraint -offset 0 0 0 -weight 1;
delete ($node+"_Anim_orientConstraint1");
select -cl ;
select -r ($node+"_Anim");
select -tgl $node;
parentConstraint -maintainOffset -weight 1;
}
string $selObjs[] = `ls -sl`;
for ($node in $selObjs){
spaceLocator -n ($node+"_temp");
select $node; select -tgl ($node+"_temp");
orientConstraint -offset 0 0 0 -weight 1;
pointConstraint -offset 0 0 0 -weight 1;
delete ($node+"_temp_orientConstraint1");
delete ($node+"_temp_pointConstraint1");
orientConstraint -offset 0 0 0 -weight 1;
delete ($node+"_temp_orientConstraint1");
select $node; CenterPivot;
spaceLocator -n ($node+"_Anim");
select $node; select -tgl ($node+"_Anim");
orientConstraint -offset 0 0 0 -weight 1;
pointConstraint -offset 0 0 0 -weight 1;
delete ($node+"_Anim_orientConstraint1");
delete ($node+"_Anim_pointConstraint1");
orientConstraint -offset 0 0 0 -weight 1;
delete ($node+"_Anim_orientConstraint1");
select -cl ;
float $position[3] = `xform -worldSpace -query -translation ($node+"_temp")`;
print $position;
move -a $position[0] $position[1] $position[2] ($node+".rotatePivot");
select -r ($node+"_Anim");
select -tgl $node;
parentConstraint -maintainOffset -weight 1;
delete ($node+"_temp");
}
global float $vToggler;
string $panel = `getPanel -wf`;
if ($vToggler==0)
{
modelEditor -e -allObjects 1 $panel;
modelEditor -e -nurbsCurves 1 $panel;
modelEditor -e -nurbsSurfaces 1 $panel;
modelEditor -e -polymeshes 1 $panel;
modelEditor -e -subdivSurfaces 0 $panel;
modelEditor -e -planes 0 $panel;
modelEditor -e -lights 0 $panel;
modelEditor -e -cameras 0 $panel;
modelEditor -e -joints 0 $panel;
modelEditor -e -ikHandles 0 $panel;
modelEditor -e -deformers 0 $panel;
modelEditor -e -dynamics 0 $panel;
modelEditor -e -fluids 0 $panel;
modelEditor -e -hairSystems 0 $panel;
modelEditor -e -follicles 0 $panel;
modelEditor -e -nCloths 0 $panel;
modelEditor -e -nParticles 0 $panel;
modelEditor -e -nRigids 0 $panel;
modelEditor -e -dynamicConstraints 0 $panel;
modelEditor -e -locators 1 $panel;
modelEditor -e -dimensions 0 $panel;
modelEditor -e -pivots 0 $panel;
modelEditor -e -handles 0 $panel;
modelEditor -e -textures 0 $panel;
modelEditor -e -strokes 1 $panel;
modelEditor -e -motionTrails 1 $panel;
modelEditor -e -manipulators 1 $panel;
$vToggler=1;
}
else{
if ($vToggler==1)
{
modelEditor -e -allObjects 1 $panel;
modelEditor -e -nurbsCurves 0 $panel;
modelEditor -e -nurbsSurfaces 1 $panel;
modelEditor -e -polymeshes 1 $panel;
modelEditor -e -subdivSurfaces 0 $panel;
modelEditor -e -planes 0 $panel;
modelEditor -e -lights 0 $panel;
modelEditor -e -cameras 0 $panel;
modelEditor -e -joints 0 $panel;
modelEditor -e -ikHandles 0 $panel;
modelEditor -e -deformers 0 $panel;
modelEditor -e -dynamics 0 $panel;
modelEditor -e -fluids 0 $panel;
modelEditor -e -hairSystems 0 $panel;
modelEditor -e -follicles 0 $panel;
modelEditor -e -nCloths 0 $panel;
modelEditor -e -nParticles 0 $panel;
modelEditor -e -nRigids 0 $panel;
modelEditor -e -dynamicConstraints 0 $panel;
modelEditor -e -locators 0 $panel;
modelEditor -e -dimensions 0 $panel;
modelEditor -e -pivots 0 $panel;
modelEditor -e -handles 0 $panel;
modelEditor -e -textures 0 $panel;
modelEditor -e -strokes 0 $panel;
modelEditor -e -motionTrails 0 $panel;
modelEditor -e -manipulators 1 $panel;
$vToggler=2;
}
else{
if ($vToggler==2)
{
modelEditor -e -allObjects 1 $panel;
modelEditor -e -nurbsCurves 0 $panel;
modelEditor -e -nurbsSurfaces 1 $panel;
modelEditor -e -polymeshes 1 $panel;
modelEditor -e -subdivSurfaces 0 $panel;
modelEditor -e -planes 0 $panel;
modelEditor -e -lights 0 $panel;
modelEditor -e -cameras 0 $panel;
modelEditor -e -joints 0 $panel;
modelEditor -e -ikHandles 0 $panel;
modelEditor -e -deformers 0 $panel;
modelEditor -e -dynamics 0 $panel;
modelEditor -e -fluids 0 $panel;
modelEditor -e -hairSystems 0 $panel;
modelEditor -e -follicles 0 $panel;
modelEditor -e -nCloths 0 $panel;
modelEditor -e -nParticles 0 $panel;
modelEditor -e -nRigids 0 $panel;
modelEditor -e -dynamicConstraints 0 $panel;
modelEditor -e -locators 0 $panel;
modelEditor -e -dimensions 1 $panel;
modelEditor -e -pivots 0 $panel;
modelEditor -e -handles 1 $panel;
modelEditor -e -textures 0 $panel;
modelEditor -e -strokes 1 $panel;
modelEditor -e -motionTrails 0 $panel;
modelEditor -e -manipulators 1 $panel;
$vToggler=0;
}
}
}
global string $altCam;
string $altCam = `lookThru -q`;
print ("--" + $altCam + "-- is now set as alternate cam");
global string $origCam , $altCam;
if ($altCam != "")
{
string $crntCam = `lookThru -q`;
if ($crntCam != $altCam)
$origCam = $crntCam;
string $crntPanel = `getPanel -withFocus`;
string $panelType = `getPanel -typeOf $crntPanel`;
if ($panelType == "modelPanel")
{
if ($origCam == "")
$origCam = $crntCam;
if ($crntCam == $origCam)
lookThroughModelPanel $altCam $crntPanel;
else
lookThroughModelPanel $origCam $crntPanel;
}
}
else print "Camera has not been set yet";
//Multiple NS support
global string $charActv[];
int $selSize = size(`ls -sl`);
if ($selSize==0) for($i = 0; $i < size($charActv); $i++)
{
string $CharNameSpace = `match "^.*:" $charActv[$i]`;
if ( `objExists ($CharNameSpace+"AllAnimControls")`)
{
select -add ($CharNameSpace+"AllAnimControls");
}
else {
select -add $charActv[$i];
}
}
else {
string $selObjs[] = `ls -sl`;
$charActv = $selObjs;
for ( $node in $selObjs )
{
string $CharNameSpace = `match "^.*:" $node`;
if ( `objExists ($CharNameSpace+"AllAnimControls")`)
{
select -add ($CharNameSpace+"AllAnimControls");
}
else {
select -add $node;
}
}
}
float $currentKeys = `currentTime -q`;
float $nextKeys = `findKeyframe -timeSlider -which next`;
float $prevKeys = `findKeyframe -timeSlider -which previous`;
print ("Previous Key is " + ($currentKeys-$prevKeys) + " frames. Next Key is " +($nextKeys-$currentKeys)+".");
string $sel[] = `ls -sl`;
if(size($sel)){
string $connections[] = `listConnections -s true -d false -type "animCurve" -connections true $sel`;
string $plugs[];
for($i=0;$i < size($connections);$i+=2){
$plugs[$i/2] = $connections[$i];
}
setKeyframe $plugs;
}
float $prevKey = `findKeyframe -timeSlider -which previous`;
float $nextKey = `findKeyframe -timeSlider -which next`;
float $currentTime = `currentTime -q`;
copyKey -time $prevKey;
timeSliderPasteKey false;
float $prevKey = `findKeyframe -timeSlider -which previous`;
float $nextKey = `findKeyframe -timeSlider -which next`;
float $currentTime = `currentTime -q`;
copyKey -time $nextKey;
timeSliderPasteKey false;
//min
float $rangeTimeMax = `playbackOptions -q -maxTime`;
float $currentTime = `currentTime -query`;
playbackOptions -min $currentTime -max $rangeTimeMax;
//max
float $rangeTimeMin = `playbackOptions -q -minTime`;
float $currentTime = `currentTime -query`;
playbackOptions -min $rangeTimeMin -max $currentTime;
float $keyT[] = `keyframe -q -sl`;
float $crntTime = `currentTime -q`;
float $offset = ($crntTime-$keyT[0]);
selectKey -clear ;
keyframe -r -time ($keyT[0]+":") -timeChange $offset;
//50
float $currentTime = `currentTime -query`;
playbackOptions -min $currentTime -max ($currentTime+50);
//Exludes visibility and scale
//get selection
string $sel[] = `ls -sl` ;
//zero out loop
for($item in $sel) {
//get attributes
string $attrs[] = `listAttr -v -k -s $item` ;
//zero out - exclude scl and vis
for ($attr in $attrs) {
if($attr != "visibility" && $attr != "scaleX" && $attr != "scaleY" && $attr != "scaleZ" && $attr != "rotateOrder") {
string $path = ($item+"."+$attr) ;
if(!`getAttr -l $path`) setAttr ($item+"."+$attr) 0 ;
}
}
}
global float $xToggler;
string $panel = `getPanel -wf`;
if ($xToggler==0)
{
setXrayOption true $panel;
$xToggler=1;
}
else
{
setXrayOption false $panel;
$xToggler=0;
}
string $selCurve[] = `keyframe -q -n`;
float $selKey[] = `keyframe -q selected`;
float $currentTime = `currentTime -q`;
selectKey -clear;
for ($i in $selCurve){
selectKey -add -k -time ($currentTime+":50000") $i;
}
}
string $selCurve[] = `keyframe -q -n`;
float $selKey[] = `keyframe -q selected`;
float $currentTime = `currentTime -q`;
selectKey -clear;
for ($i in $selCurve){
selectKey -add -k -time ("-50000:"+$currentTime+) $i;
}
}
string $CharNameSpaceTo = "nico_005";
string $selObjs[] = `ls -sl`;
string $CharNameSpace = `match "^[^\:]*" $selObjs[0]`;
namespace -rename $CharNameSpace $CharNameSpaceTo;
file -import -type "mayaBinary" -ignoreVersion -ra true -mergeNamespacesOnClash false
-namespace "cycle" -options "v=0;"
-pr "/Users/naniceto/Desktop/refTest/cycleLayer.mb";
namespace -rename $CharNameSpaceTo $CharNameSpace;