I was trying to make a script to activate the Paint Select mode while turning on ignoreBackfacing so that I don't select faces from the other side when painting.
To make this compatible with both EditablePoly and EditPoly, my thought process was to make a tryCatch function so that if it failed to the first clause because it's an EditPoly, it'd do the catch clause containing the code for that modifier.
(
try(
$.ignoreBackfacing = on
actionMan.executeAction 0 "59236" -- Selection: Paint Selection Region
)
catch(
$.modifiers[#Edit_Poly].ignoreBackfacing = on
actionMan.executeAction 0 "59236" -- Selection: Paint Selection Region
)
)
It works fine for the Editable Poly, however with the Edit Poly the ignoreBackfacing command seems to be ignored. Why is that? Any comments on how to improve this are welcome; I always feel like a caveman when it comes to Maxscript.
Replies
https://davewortley.wordpress.com/2012/06/21/classes-superclassof-and-classof/
sorry no idea whats up with the problem itself..
Also try to avoid "actionMan", that is usually garbage commands that the command recorder spits out.
It's worth looking up the actual MaxScript commands which are much more robust and have a lot more hooks for what you're working with and will do what want instead of doing exactly the one thing you did, once upon a time.
I made it work! Thank you. I didn't know I could use the if and else like other languages just like that either.
In this case there's no value you can set to tell max to switch to paint select region directly.
The only command which allows you to cycle through the different selection options is "max cycle select", but there's no function/value exposed to maxscript which tells you what the current selection mode is.
So, actionMan is the best you can do in this case.
Still, am I right in saying that your solution is only working because the property in Edit_Poly and Editable_Poly are named the same by coincidence? If I wanted to work with the SelectByVertex property for example, I wouldn't be able to use just that for both, since Editable Poly's function is called "SelByVertex"......right?