Skip to content

Instantly share code, notes, and snippets.

@L0Lock
Last active October 20, 2021 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save L0Lock/c1330ee50b0775b23b34ec969f73906e to your computer and use it in GitHub Desktop.
Save L0Lock/c1330ee50b0775b23b34ec969f73906e to your computer and use it in GitHub Desktop.
a simple attribute toggle script that you can use as a shelf button or in the script editor
// ***************************************************
// README
// ***************************************************
// ***************************************************
// As the examples show, put your arrtribute IDs in
// the list after line 16 between quotation marks like
// these: "" and with a coma , at the end. EXCEPT for
// the very last element of the list.
// If you don't know your attribute id, open your
// script editor, clear the top-part history, and
// toggle the attribute manually. The script history
// should show something like :
// setAtt "yourObject.attribute"
// Copy what's between the quotes.
string $attrList[] = {
"myObject.holdOut",
"myOtherObject.holdOut"
};
for ($i = 0; $i < `size $myAttr`; $i++){
setAttr $attrList[$i] (!`getAttr $attrList[$i]`);
}
// Written by Loïc "L0Lock" DAUTRY
// Source:
// https://gist.github.com/L0Lock/c1330ee50b0775b23b34ec969f73906e
@L0Lock
Copy link
Author

L0Lock commented Oct 20, 2021

As the examples show, put your attribute IDs in the list after line 8, between quotation marks like these: "" and with a coma , at the end, except for the very last element of the list.
If you don't know your attribute id, open your script editor, clear the top-part history, and toggle the attribute manually. The script history should show something like : setAtt "yourObject.attribute"
Copy what's between the quotes.

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