Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
toggle key .....

toggle key .....

2004-07-06       - By kim aldis

 Back
Reply:     1     2     3     4     5  

risky. True is any non-zero value. If it comes back as 3 - unlikely, but
possible,  you'll end up with a true value after the subtraction. Use:-

bSwitch = NOT oDisp '  VBscript (spit)

or

bSwithch = ! oDisp // jscript

it's also clearer in terms of code legibility to use a boolean expression
rather than a mathematical one.




 __ __  

From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of
Rafe Sacks
Sent: 06 July 2004 00:47
To: XSI@(protected)
Subject: Re: toggle key .....


Boolean values can always be switched using 1 - value. For example....



oDisp = GetValue ("Views.ViewD.TopCamera.camdisp.statsel")

bSwitch = 1 - oDisp;

SetValue "*.camdisp.statsel"          , bSwitch
SetValue "*.camdisp.statsel"          , bSwitch
SetValue "*.camdisp.intsel"           , bSwitch
SetValue "*.camdisp.playbacksel"      , bSwitch
SetValue "*.camdisp.statunselnear"    , bSwitch
SetValue "*.camdisp.intunselnear"     , bSwitch
SetValue "*.camdisp.playbackunselnear", bSwitch


if bSwitch then
   SetDisplayMode "Views.*.*", "shaded"
Else
   SetDisplayMode "Views.*.*", "wireframe"
End if





These means alot less double code. It works like this...

true  = 1
false = 0

1 - 0 = 1
1 - 1 = 0

P.S. Been a while since I have used VBS, hope this is right. There are
probably better ways to do this.. object model etc, I am just illustrating
the boolean point here.




__ ____ ____ ____ ____ ____ _____

R A F E   S A C K S

C h a r a c t e r   D e p a r t m e n t

A n i m a l   L o g i c



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004>risky. True is any non-zero value. If it comes back as
3 - unlikely, but possible,&nbsp; you'll end up with a true value after the
subtraction. Use:-</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004>bSwitch = NOT oDisp '&nbsp; VBscript
(spit)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004>or </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004>bSwithch = ! oDisp // jscript</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004>it's also clearer in terms of code legibility to use a
boolean expression rather than a mathematical one.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN
class=501365806-06072004></SPAN></FONT>&nbsp;</DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #008080 2px solid;
MARGIN-RIGHT: 0px">
 <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
 <HR tabIndex=-1>
 <FONT face=Tahoma size=2><B>From:</B> owner-xsi@(protected)
 [mailto:owner-xsi@(protected)] <B>On Behalf Of </B>Rafe
 Sacks<BR><B>Sent:</B> 06 July 2004 00:47<BR><B>To:</B>
 XSI@(protected)<BR><B>Subject:</B> Re: toggle key .....<BR></FONT><BR></DIV>
 <DIV></DIV><SMALL><FONT face="Helvetica, Arial, sans-serif"
 color=#000099>Boolean values can always be switched using 1 - value. For
 example....</FONT></SMALL><BR><BR>
 <BLOCKQUOTE>
   <P class=MsoNormal><SPAN class=SpellE><SPAN class=GramE><FONT color=black
   size=2><SPAN
   style="FONT-SIZE: 10pt; COLOR: windowtext; FONT-FAMILY: Courier"></SPAN><
/FONT></SPAN></SPAN><FONT
   color=black size=2><SPAN
   style="FONT-SIZE: 10pt; COLOR: windowtext; FONT-FAMILY: Courier"></SPAN><
/FONT><TT>oDisp
   = GetValue ("Views.ViewD.TopCamera.camdisp.statsel")<BR><BR>bSwitch = 1 -
   oDisp;<BR><BR>SetValue "*.camdisp.statsel"&nbsp;&nbsp;&nbsp;
   &nbsp;&nbsp;&nbsp; &nbsp; , </TT><TT>bSwitch </TT><BR><TT>SetValue
   "*.camdisp.statsel"&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ,
   </TT><TT>bSwitch </TT><BR><TT>SetValue "*.camdisp.intsel"&nbsp;&nbsp;&nbsp;
   &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; , </TT><TT>bSwitch </TT><BR><TT>SetValue
   "*.camdisp.playbacksel"&nbsp;&nbsp;&nbsp; &nbsp; , </TT><TT>bSwitch
   </TT><BR><TT>SetValue "*.camdisp.statunselnear"&nbsp;&nbsp;&nbsp; ,
   </TT><TT>bSwitch </TT><BR><TT>SetValue
   "*.camdisp.intunselnear"&nbsp;&nbsp;&nbsp;&nbsp; , </TT><TT>bSwitch
   </TT><BR><TT>SetValue "*.camdisp.playbackunselnear", </TT><TT>bSwitch
   </TT><BR><TT><BR><BR>if </TT><TT>bSwitch </TT><TT>then<BR>&nbsp;&nbsp;&nbsp
;
   SetDisplayMode "Views.*.*", "shaded"<BR>Else<BR>&nbsp;&nbsp;&nbsp;
   SetDisplayMode "Views.*.*", "wireframe"<BR>End
 if</TT><BR></P></BLOCKQUOTE><BR><BR><BR><SMALL><FONT
 face="Helvetica, Arial, sans-serif" color=#000099>These means alot less
double
 code. It works like this...<BR><BR></FONT><BIG><FONT
 color=#000099><TT>true&nbsp; = 1<BR>false = 0<BR><BR>1 - 0 = 1<BR>1 - 1 =
 0<BR><BR>P.S. Been a while since I have used VBS, hope this is right. There
 are probably better ways to do this.. object model etc, I am just
illustrating
 the boolean point here.<BR><BR><BR><BR></TT></FONT></BIG></SMALL><PRE wrap=""
><SMALL><B><FONT face="Century Gothic"><FONT color=#000066><FONT color=#000066>
<FONT color=#c0c0c0>__ ____ ____ ____ ____ ____ _____</FONT>
</FONT></FONT></FONT></B><FONT face="Century Gothic"><FONT color=#000066><SMALL
><SMALL><FONT color=#666666><BIG><FONT color=#000066><BIG><BIG>R</BIG></BIG>
<BIG>A F E </BIG>  <BIG><BIG>S</BIG></BIG> <BIG>A C K S</BIG></FONT></BIG></FONT
></SMALL></SMALL></FONT></FONT></SMALL><B><SMALL><FONT face="Century Gothic">
<SMALL><FONT color=#999999>
</FONT></SMALL></FONT></SMALL></B><FONT color=#999999><SMALL><FONT face=
"Century Gothic"><SMALL>C h a r a c t e r   D e p a r t m e n t
</SMALL></FONT></SMALL></FONT><SMALL><FONT color=#000066><BIG><SMALL><FONT face
="Century Gothic"><SMALL>A n i m a l   L o g i c</SMALL></FONT></SMALL></BIG><
/FONT></SMALL></PRE><BR></BLOCKQUOTE></BODY></HTML>