Skip to content

Instantly share code, notes, and snippets.

@jm991
Last active November 5, 2017 22:40
Show Gist options
  • Save jm991/7970c43ad919cf3e544a6f32f09153d6 to your computer and use it in GitHub Desktop.
Save jm991/7970c43ad919cf3e544a6f32f09153d6 to your computer and use it in GitHub Desktop.
Toggles visibility of multiple selected transforms
//---------------------------------------------------------------------------------
// Source: https://gist.github.com/jm991/
// Author: John Mac
// Date: 11-05-2017
//
// Description:
// Toggles visibility of multiple selected transforms
// Installation:
// 1. Copy toggleVisible.mel to C:\Users\[USER]\Documents\maya\[MAYAVERSION]\prefs\scripts\jm991
// 2. Restart maya
// Instructions:
// 1. CTRL or SHIFT select the transforms you want to hide or show in the Outliner
// 2. Run this script
// Dependencies:
// printextensions.mel https://gist.github.com/jm991/29cc46b5b8e5fa4709ee4be0a7911095
global proc toggleVisible()
{
string $objs[] = `ls -sl -type "transform"`;
// printarray($objs);
for ($obj in $objs)
{
$attr = $obj + ".visibility";
string $val = `getAttr $attr`;
// println($val);
if ($val == "1")
{
setAttr $attr 0;
}
else
{
setAttr $attr 1;
}
}
}
@jm991
Copy link
Author

jm991 commented Nov 5, 2017

Remove the ".c" from the filename when you download this (git doesn't support .mel syntax highlighting)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment