def Wirecolor(r,g,b): return r+(g<<8)+(b<<16) On Mon, Apr 23, 2012 at 10:03 PM, Matt Lind <ml...@carbinestudios.com>wrote:
> ** ** > > http://docs.python.org/library/stdtypes.html**** > > ** ** > > see section 5.4.1 for bit-shifting.**** > > ** ** > > ** ** > > ** ** > > ** ** > > *From:* softimage-boun...@listproc.autodesk.com [mailto: > softimage-boun...@listproc.autodesk.com] *On Behalf Of *Bradley Gabe > *Sent:* Monday, April 23, 2012 6:53 PM > *To:* softimage@listproc.autodesk.com > *Subject:* Scripting: RGBToWireframeColor() in Python?**** > > ** ** > > I need to convert from RGB to wireframe color in a script, and I found the > following sample function in the SI docs in jscript. Any chance someone has > converted this to Python?**** > > function RGBToWireframeColor(dR,dG,dB) > > **** > > ** ** > > { > // Convert RGB to wirecolor > var wirecolR, wirecolG, wirecolB; > wirecolR = (Math.round(dR * 7)) << 1 > wirecolG = (Math.round(dG * 7)) << 4 > wirecolB = (Math.round(dB * 7)) << 7 > > **** > > ** ** > > return wirecolR | wirecolG | wirecolB; > }**** > > ** ** > -- --------------------------------------- Vladimir Jankijevic Technical Direction Elefant Studios AG Lessingstrasse 15 CH-8002 Zürich +41 44 500 48 20 www.elefantstudios.ch ---------------------------------------