I am after a script that will allow you to make a Selection when in Polygon sub-object mode, and it will ONLY select the visible polygons. There does not seem to be any function, or script, ever made for 3DSMax to do that.
Below is a script that can select ALL visible polygons only. I assume it could be edited to take a Selection as the range to select from?
It would also be good if it could select either forward facing polygons, or backward facing ones - maybe two scripts at worst?
And there would likely be numerous other sub-function selection modes that would be very useful too.
I wonder why this has never been done before??? Some 3D programs have it as standard.
I do not know enough about scripting to alter this to work, but maybe someone could help out with it?
Thanks.
========
--Get the viewport TMatrix, invert to get the equivalent of a camera transformation
theTM = inverse (viewport.getTM())
--Loop through all geometry objects that have EPoly Base Object
for theObj in Geometry where classof theObj.baseobject == Editable_Poly do
(
theFacesToSelect = #{} --ini. a bitArray to collect faces to select
numFaces = polyOp.getNumFaces theObj --get the number of polygons in the EPoly
--loop from 1 to the number of polygons and set the corresponding bit in the bitArray
--to true if the normal of the polygon as seen in camera space has a positive Z,
--and false if it is negative or zero (facing away from the camera)
for f = 1 to numFaces do
theFacesToSelect[f] = (in coordsys theTM polyOp.getFaceNormal theObj f).z > 0
--finally, set the selection in the object
polyOp.setFaceSelection theObj theFacesToSelect
)
--when done with all, redraw the views - if a Poly SO level is selected,
--the selection will be updated in the viewport...
redrawViews()
================
miauu · 2018-11-01