what's wrong with this simple code?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 09 September 2010   #1
what's wrong with this simple code?

I get this error for my script when I am certain that the returned value is just 1 or 0:

//Error: Cannot convert data of type int[] to type int.

the portion of my script:

global proc toggleMyBorders()
{

int $myBorderValue = `polyOptions -q -dmb`;

if ($myBorderValue == 0)
{
polyOptions -dmb 1 -sb 6;
}

else
{
polyOptions -dmb 0 -sb 6;
}
}
 
Old 09 September 2010   #2
Make that

global proc toggleMyBorders()
{
    int $myBorderValue[] = `polyOptions -q -dmb`;
    if ($myBorderValue[0] == 0)
    {
        polyOptions -dmb 1 -sb 6;
    }
    else
    {
        polyOptions -dmb 0 -sb 6;
    }
}
__________________
Michiel
http://thnkr.com
 
Old 09 September 2010   #3
shorter...


int $myBorderValue[] = `polyOptions -q -dmb`;
polyOptions -dmb (!$myBorderValue[0]) -sb 6;
 
Old 10 October 2010   #4
oneliner!
mc.polyOptions(dmb=(not mc.polyOptions(q=1,dmb=1)[0]))
  

btw: why the hell does that return an int array?!?! "Changes the global display polygonal attributes." Are there multiple globals?!? Different realities?!?
__________________
goodsoul.de

Last edited by ewerybody : 10 October 2010 at 09:30 AM.
 
Old 10 October 2010   #5
because

select -r pPlane1 pCube1 ;
polyOptions -q -dmb;
// Result: 0 1 //
__________________
Michiel
http://thnkr.com
 
Old 10 October 2010   #6
yes. But there are actually other commands that can return single OR array values (getAttr or optionVar for instance)

furthermore this is obviously not a global one! darn docs..

But apropos docs: always overread the -r flag
polyOptions -r -dmb 1;
Quote: When this flag is used with flags dealing with a boolean value, the boolean value is toggled
__________________
goodsoul.de
 
Old 10 October 2010   #7
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:08 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.