funny magic numbers

31 views
Skip to first unread message

Stefan Andersson

unread,
Oct 2, 2009, 2:47:48 PM10/2/09
to soft...@listproc.autodesk.com
One number is green, one is gray.

#python script
current = Application.Preferences.GetPreferenceValue("Scenecolors.backgroundcol")
if current == 16711935:
Application.Preferences.SetPreferenceValue("Scenecolors.backgroundcol",
2139062271)
Application.LogMessage("Viewport Color will be gray")
else:
Application.Preferences.SetPreferenceValue("Scenecolors.backgroundcol",
16711935)
Application.LogMessage("Viewport Color will be green")
Application.SceneRefresh()
# end python script

--
[ protector of penguins - abuser of pixels ]
http://sanders3d.blogspot.com/

Luc-Eric Rousseau

unread,
Oct 2, 2009, 6:01:27 PM10/2/09
to soft...@listproc.autodesk.com
These are 8-bit RGB color put in an integer.
I don't have python installed on this machine.. but here is the code in JScript

var value = 16711935;

// this already tells you everything...
LogMessage( "Hexadecimal Value:" + value.toString( 16 ) );

LogMessage( "Red:" + ((value>>24) & 0xff));
LogMessage( "Green:" + ((value>>16) & 0xff));
LogMessage( "Blue:" + ((value>>8) & 0xff));
LogMessage( "Alpha:" + ((value>>0) & 0xff));

--
Luc-Eric Rousseau
Autodesk Softimage Team Leader

Matt Lind

unread,
Oct 2, 2009, 7:43:35 PM10/2/09
to soft...@listproc.autodesk.com
And if you want to make people really ill, create an OnPlayBack event to modify the values every frame ;-)


Matt

Graham D Clark

unread,
Oct 3, 2009, 7:36:27 PM10/3/09
to soft...@listproc.autodesk.com
ah the xsi pranks we've played :)
bad Matt
cheers

Hey Stefan, view source on this to see an example of setting it:
http://www.grahamdclark.com/Studentresources/tutorials/XSIGUI/gdcXSIGUInetEg.html
part of the script before that doesnt work anymore in newer versions of xsi, but hey maybe something useful to gank out
--
Graham D Clark, telephone: fad-take-two,
http://www.linkedin.com/in/grahamclark | http://www.xsibase.com/articles.php?detail=117
Reply all
Reply to author
Forward
0 new messages