ScriptSpot

Script

Change Viewport Statistic

By miauu · 2014-03-22

Version
2
Version requirement
2009 and up
Date updated
2016-10-24
Votes
6
Description

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

Script idea: Eric Chadwick

Videos
Attachments

Tags: viewport, statistic

Comments (14)

3dwannab · 2021-09-02

I was trying to get this to work in max 2020. I've had no luck so far. What happens is the Viewport Config dialog comes up but stays up.

harumscarum · 2019-04-09

it is a button, but it brings me only statistics settings when statistics already ON
I need just simple button to toggle "Show Statistic in the Active View" option

max2020

.

miauu · 2019-04-09

I am not sure if I understand you correctly but the there is a shotrcut to toggle the "Show Statistic in the Active View" - the key "7"(not in NumPad).

cool idea - and have suggestion

harumscarum · 2019-04-08

would it be possible to make this script as button on toolbar to toggle statistics on/off

thanks

.

miauu · 2019-04-08

This is the way I use it. :)
Download and install xxx_v2.mcr. Then you can create a toolbar button.

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

3dwannab · 2018-03-09

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 / miau_u@yahoo.com / 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()
)

Thanks!

kmerino · 2017-08-04

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

Best Regards,
Kevin

Very nice little tool

nnq2603 · 2017-01-23

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

.

miauu · 2017-01-23

Thank you. :)

.

miauu · 2016-10-23

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

fedemas1969 · 2016-10-01

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

.

miauu · 2016-10-01

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

er.cchadw.ck@gmail.com · 2014-03-23

This is fantastic, works very well. Thanks miauu!

miauu · 2014-03-23

Glad to help. :)