Here’s a script that I wrote to quickly switch between display modes for VRay Proxies. I’m not experienced with writing maxscript, but I’ve been using it for about a month and its been very helpful. Works with groups and mixed selections. Any improvements are certainly welcome.
The functions you are calling are being defined in the global scope, this means that you can access the functions outside of the tool, this may be what you want to happen but the best practice is to keep the functions in the scope of the tool when possible, this stops peoples global names mixing with other tools.
The other thing you need to be aware of is if someone adds a modifier onto a vraymesh it changes the class from Vray_proxy to say Editable_mesh or editable_Poly, so the way around this is to query the baseObject property of each object (kind of like the shape node in maya).
Adjusted below.
-- vrpDisplay v0.61
-- VRay Proxy Display Changer
-- Quickly switch between preview modes
-- This short script is considered open source; if you improve upon it, please share
-- Written by Caleb Dermyer
-- caleb@cdermyer.com
macroScript vrpDisplay
category:"Caleb"
toolTip:"vrpDisplay"
(
rollout vrpDisplay_roll "VRay Proxy Display Changer v0.61" (
group "Change Proxy Display in Selection" (
button btn_faces "Preview Faces" across:2 width:140
button btn_mesh "Show Whole Mesh" width:140
progressbar prg
)
group "About" (
label lbl1 "Quickly switch between previewing Faces or Full Mesh " align:#left
label lbl2 "for VRay Proxies in selection " align:#left
label lbl3 "C Dermyer" align:#left
)
function vrpDispFaces =
(
for o in selection where classOf o.baseObject == VRayProxy do (
o.display= 3
)
)
function vrpDispMesh =
(
for o in selection where classOf o.o.baseObject == VRayProxy do (
o.display= 4
)
)
on btn_faces pressed do vrpDispFaces()
on btn_mesh pressed do vrpDispMesh()
)
try (DestroyDialog vrpDisplay_roll) catch()
createDialog vrpDisplay_roll 300 220
)
out of curiosity: Say that, after you press one button to turn all objects to Preview Faces - you press the button to turn them all back to whatever they were.
Would a feature like this be doable?
If yes, where/how would all those object’s previews be temporary stored.
Or maybe, this could work only as long you dont unselect, ie once you unselect it forgets.
You can store it into either files, temporarily in memory, and so on.
It’s generally a true PITA to keep track though, because people will delete or rename the proxy after the list was compiled, or some other such thing, so the amount of checks to be done tendentially become far more code than the actual functions to store and retrieve the previous visibility state.
It can surely be done, though.