Change Viewport Statistic

4 votes
Version: 
2
Date Updated: 
10/24/2016

With this script you can change the Viewport Statistic fast and easy without going to the Viewport Configuration Dialog.

Script idea: Eric Chadwick

Version Requirement: 
2009 and up
Video URL: 
AttachmentSize
miauuchangeviewportstatistic.mcr4.39 KB
miauuchangeviewportstatistic_v2.mcr4.5 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
3dwannab's picture

I've made a little edit if you don't mind Miauu

I've edited your great code to turn on all stats with "Total + Selection" radio button enabled.
This has no UI, just run to show all stats and 'Total + Selection'.

--******************************************************************************************************
-- Created: 		22-03-2014   21:21h
-- Last Updated:	24-10-2016
-- Version:			2.00
--
-- Author :  Kostadin Kotev / [email protected] / http://miauumaxscript.blogspot.com/
-- Version:  3ds max 2009 (10) (should work in older versions too!)
--
/*
EDIT:  09-03-2018 3dwannab edit to turn on all stats and 'Total + Selection'.
Full credit goes to scripting master miauu (Kostadin Kotev) for the original code.
 
This has no UI, just run to show all stats and 'Total + Selection'.
*/
--
-- Discription: Changes the Viewport Statistics.
-- Usage: RUN IT
--
-- Idea: EricChadwick /http://ericchadwick.com//
--
--******************************************************************************************************
-- MODIFY THIS AT YOUR OWN RISK
 
(
	local curMaxVersion = ((maxversion())[1] / 1000)
 
	function ChangeStatistic =
	(
		dialogMonitorOPS.UnRegisterNotification id:#miauuChangeStatisticsSettingsID
		dialogMonitorOps.enabled = true
		function miauuChangeStatisticsSettings =
		(
			local BM_SETCHECK = 241
			local BN_CLICKED = 0
			local WM_COMMAND = 273
			local TCM_SETCURFOCUS = 0x1330
			--	""
			--	"max 2017"
			local statisticsTabIndex = if curMaxVersion < 19 and curMaxVersion > 14 then 6 else 5
			local hwnd = DialogMonitorOPS.GetWindowHandle()
			local hwnd_title = UIAccessor.GetWindowText hwnd
			if (hwnd_title == "Viewport Configuration") then
			(
				for kidHWND in (UIAccessor.GetChildWindows hWND) where ((UIAccessor.GetWindowClassName kidHWND) == "SysTabControl32") do
				(
					UIAccessor.SendMessage kidHWND TCM_SETCURFOCUS statisticsTabIndex 0
				)
				controls = windows.getChildrenHWND hwnd
				show = undefined
				for child in controls do
				(
					if (child[5] == type) do
					(
						show = child
					)
					-- for below 3 (radio btns) BM_SETCHECK must be set for each, change accordingly
					-- In this case "Total + Selection" is set to BM_SETCHECK 1 0
					if (child[5] == "Total") do (UIAccessor.SendMessage child[1] BM_SETCHECK 0 0)
					if (child[5] == "Selection") do (UIAccessor.SendMessage child[1] BM_SETCHECK 0 0)
					if (child[5] == "Total + Selection") do (UIAccessor.SendMessage child[1] BM_SETCHECK 1 0)
 
					if (child[5] == "Polygon Count") do (UIAccessor.SendMessage child[1] BM_SETCHECK 1 0)
					if (child[5] == "Triangle Count") do (UIAccessor.SendMessage child[1] BM_SETCHECK 1 0)
					if (child[5] == "Edge Count") do (UIAccessor.SendMessage child[1] BM_SETCHECK 1 0)
					if (child[5] == "Vertex Count") do (UIAccessor.SendMessage child[1] BM_SETCHECK 1 0)
					if (child[5] == "Frames Per Second") do (UIAccessor.SendMessage child[1] BM_SETCHECK 1 0)
				)
				if show != undefined do
				(
					UIAccessor.SendMessage show[1] BM_SETCHECK 1 0
					windows.sendMessage (UIAccessor.getParentWindow show[1]) WM_COMMAND ((bit.shift BN_CLICKED 16) + (UIAccessor.getWindowResourceID hwnd)) show[1]
					uiAccessor.sendMessageID hwnd #IDOK
				)
				UIAccessor.PressButtonByName hwnd "OK"
			)
			true
		)
		dialogMonitorOPS.RegisterNotification miauuChangeStatisticsSettings id:#miauuChangeStatisticsSettingsID
		max vptconfig
		dialogMonitorOPS.UnRegisterNotification id:#miauuChangeStatisticsSettingsID
		dialogMonitorOps.enabled = false
	)
	ChangeStatistic()
)
kmerino's picture

Thanks!

This helped me greatly in getting the viewports configured the way I needed them on batch routine that I am running!

Best Regards,
Kevin

miauu's picture

.

Thank you. :)

nnq2603's picture

Very nice little tool

Thanks for sharing this. Easy to customize startup default preset for each user. Great.

miauu's picture

.

In version 2.0 the support for 3dsMax 2017 is added.

miauu's picture

.

Yes. For some reason only the TOTAL and TOTAL+SELECTION works correctly.

fedemas1969's picture

Thanks for the script. In max

Thanks for the script. In max 2016 seems that the "selection" buttton don't works, the others perfect.
thanks again.

miauu's picture
EricChadwick's picture

This is fantastic, works very

This is fantastic, works very well. Thanks miauu!

3D Game Artist - http://ericchadwick.com
Admin for the Polycount wiki - http://wiki.polycount.com

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.