-- Viewport Stats Copyright © 2011 Jiovanie Velazquez -- v1.0 9/2/2011 -- Shows the total triangle count of selected meshes whether or not "viewport statistics" is active. -- "QuoteWare" license (idea stolen from Martin Breidt): -- If you use one of my scripts in a production environment with a group of more than two people, -- then you are obliged to tell me about it and allow me to list that project title and your -- company name as a reference on my website. This tool will remain free and opensource, so this -- really is a very small thing to ask in exchange for using them. I hope you all agree. -- Thanks, and looking forward to hearing from your project! -- If the callback already exists, get rid of it before doing anything else unregisterRedrawViewsCallback GW_drawTriangleCount fn GW_drawTriangleCount = ( fn getTriCount obj = ( local triCount = 0 local totalCount = 0 if selection.count != 0 then ( -- Count triangles in selected objects and keep a running total count for i in selection do ( triCount = (getTrimeshFaceCount i)[1] totalCount += triCount ) return (totalCount as string) + " Triangles" ) else return "Nothing selected" ) -- get the center of the window's width local winWidth = (gw.getWinSizeX() / 2 - 20) -- run the function and display the triangle count in the ~upper center of the viewport gw.wtext [winWidth, 19, 10] (getTriCount selection) ) registerRedrawViewsCallback GW_drawTriangleCount