PDA

View Full Version : Query hidden status?


EightBit
05-18-2009, 11:35 PM
Hi all:
How do I query the "hidden" status of an object (ie, a light)? I assume it something like this:
attributeQuery -n "directionalLight1" -h xxx
but I'm unable to figure out the xxx part.
The explanation in the manual is confusing....
Thanks.

strarup
05-19-2009, 12:14 AM
hi,

e.g. use attributeInfo to get hidden attributes...
attributeInfo -h on directionalLight1; //getting hidden attributes
// Result: message isHistoricallyInteresting binMembership specifiedManipLocation

e.g. isHistoricallyInteresting is hidden... so if using isHistoricallyInteresting as xxx...

attributeQuery -node directionalLight1 -h isHistoricallyInteresting; //returns a 1 since it's hidden...
it will return a 1 since it's hidden...

e.g. nodeState which is not hidden... using that as xxx
attributeQuery -node directionalLight1 -h nodeState;
will return a 0 since it's not hidden...

so apparently it doesn't has anything to do with if the attribute is hidden from the attribut editor or channelbox...
what the difference between those 2 hidden thingies are... I don't know... :D

so attributeQuery -node directionalLight1 -h xxx;
is just a way to query if xxx is hidden or not...

hope that helps a bit... quite tired... and should have been to bed a couple of hours ago... :D

kind regards

Strarup

EightBit
05-19-2009, 02:21 AM
Thanks, that's not what I'm referring to.
What I'm trying to query is if the display of the object is hidden - ie the result of Display/Hide/Hide Selection (Cntrl - h).

BPorter
05-19-2009, 02:33 AM
Ctl + h just makes the visibility attribute in the channel box "off".

getAttr spotLight1.visibility;

visible will return 1
hidden will return 0

rxgeez
05-19-2009, 02:40 AM
You could do something like this to chek the visibility of a bunch of selected objects....

$sel = `ls -sl`;
for ($each in $sel) {
$visibility = `getAttr ($each +".visibility")`;
if ($visibility){
print ($each + " -- is visible\n");
}
else {
print ($each + " -- is NOT visible\n");
}
}


-K

EightBit
05-19-2009, 04:25 AM
Thanks for the replies.
I was on the wrong track.
Visibility turns off the lites as well as making them invisible.
I want to have a simple way to toggle display the lites (and other objects) in the viewports.
This is what I came up with:
// General purpose lite display toggle, based on display state of lights in modelPanel1.
string $modlPanels[] = `getPanel -typ modelPanel`;
// Store the display state in an outside var in case they panels are not all the same
// else modelPanel 1 could be changed to a different state than some of the others.
int $liteDisplStatus = (!`modelEditor -q -lights $modlPanels[0]`);
for ($panl in $modlPanels)
{
modelEditor -e -lights $liteDisplStatus $panl;
}
Thanks again.

strarup
05-20-2009, 12:11 AM
hi...

hehe... oki doki... wasn't easy to know that was what you were after... :)

you could also have all the lights stored in a layer and toggle that on/off...
and query if the visibility of the layer is turned on or off...

btw. changed a line in your code... hope you don't mind... :)

// General purpose lite display toggle, based on display state of lights in modelPanel1.
string $modlPanels[] = `getPanel -typ modelPanel`;
// Store the display state in an outside var in case they panels are not all the same
// else modelPanel 1 could be changed to a different state than some of the others.
for ($panl in $modlPanels)
{
modelEditor -e -lights (!`modelEditor -q -lights $panl`) $panl;
}


and a more generic way if you want to toggle something else... without to have to write almost the same toggle code again... :)

proc doDaToggleMyStuffInDaModelPanels(string $daThing)
{
string $modlPanels[] = `getPanel -typ modelPanel`;
for ($panl in $modlPanels)
{
eval("modelEditor -e -"+$daThing+" (!`modelEditor -q -"+$daThing+" "+$panl+"`) "+$panl+"");
}
}
doDaToggleMyStuffInDaModelPanels("lights");



kind regards

Strarup

EightBit
05-20-2009, 02:12 PM
Thanks a lot.
I was wondering if the evaluation of commands could be nested. I had tried using nested `, but Maya didn't like that...
Thanks again.

CGTalk Moderation
05-20-2009, 02:12 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.