Just had the chance to revisit this, there are already two options.
A)Toggle script (toggles "showInviewport" property like the button in the material editor) I wish it was a way to add a keyboard shortcut to turn it on/off on the selected material
macroScript Toggle_material_viewport_display
category:"DragAndDrop"
toolTip:"Toggle material viewport display on/off"
(
on execute do (
printInf=true
mats=#()
for obj in $selection do (
if printInf then format "%" obj.name
if (obj.material !=undefined) then (
if printInf do format "\t%\t%\n" obj.material.name (classOf(obj.material) as string)
if (classOf(obj.material)==Multimaterial) then (
for msmat in obj.material do (
if (msmat!=undefined) do (appendIfUnique mats msmat)
)
)
else (
appendIfUnique mats obj.material
)
)
else (
if printInf then format "\n"
)
)
for i in (mats) do (
i.showInViewport=not i.showInViewport
)
)
)
This is the replacement for that somehow provoking script from the previous post. It prints some info (object | material name | material class) into the listener for testing purpose. I found that quite useful. Set printInf=false to disable prints. In multisub materials every submaterial just gets toggled without recursion. I'm not sure about the best option here - depends on taste also...
B) Call CoronaConverter functions externallyexcept in the Corona Converter script, its possible to turn on/off for the selected objects....which is better than what Max has to offer. But this option is so useful IMO that I wish it was a button or shortcut available instantly.
Since Martin has his precious
Converter well
documented, we can use those mentioned CoronaConverter buttons directly in any keyboard shortcut or custom button:
Using Corona Converter: Show maps in VP (selected obj.) on:
macroScript CoronaConverterShowMapsInViewportOn
category:"DragAndDrop"
toolTip:"ShowMapsInViewport on (selection)"
(
::CoronaConverterSuppressGui = true
::CoronaConverter
if (CoronaConverter==undefined) do (
local scriptDirectory = (GetDir #scripts) + "\\CoronaRenderer"
local scriptFiles = getfiles (scriptDirectory + "\\CoronaConverter_v*.ms")
if scriptFiles.count > 0 then (
sort scriptFiles
local latestFile = scriptFiles[scriptFiles.count]
filein latestFile
) else (
messageBox (@"No CoronaConverter script file found in " + scriptDirectory) title:"Error"
)
)
CoronaConverter.converterTools.showMapsInVP true selected:true
::CoronaConverterSuppressGui = false
)
Using Corona Converter: Show maps in VP (selected obj.) off:
macroScript CoronaConverterShowMapsInViewportOff
category:"DragAndDrop"
toolTip:"ShowMapsInViewport off (selection)"
(
::CoronaConverterSuppressGui = true
::CoronaConverter
if (CoronaConverter==undefined) do (
local scriptDirectory = (GetDir #scripts) + "\\CoronaRenderer"
local scriptFiles = getfiles (scriptDirectory + "\\CoronaConverter_v*.ms")
if scriptFiles.count > 0 then (
sort scriptFiles
local latestFile = scriptFiles[scriptFiles.count]
filein latestFile
) else (
messageBox (@"No CoronaConverter script file found in " + scriptDirectory) title:"Error"
)
)
CoronaConverter.converterTools.showMapsInVP false selected:true
::CoronaConverterSuppressGui = false
)
Drawback is that you need to create two buttons/shortcuts - but you will get 1:1 the functionality of the lastest installed CoronaConverter (used the code from the Corona init script to file it in).
Good Luck