[Closed] Adjusting the viewport clipping
I mentioned this in another thread of mine, but I thought it deserved it’s own thread.
I know that you can enable this with the command NitrousGraphicsManager.GetActiveViewportSetting()ViewportClippingEnabled = true, but there doesn’t seem to be a way to actually adjust it, is this even possible? I would love to set the lower bar to the bottom.
If you click on the title where it says which view you’re on (i.e. “Perspective”) then you have the option in the drop-down menu to select Viewport Clipping which enables those controls onscreen. Then you just click and drag the arrows to adjust the clipping.
Yeah I know how do do it manually, but the entire point is to be able to do it with maxscript. The reason why I want to do it with a script is that I normally adjust it very often, so it would have been better to just run a script every time I start 3ds max etc.
the hardest part is to locate where these triangle manipulators are.
then you just send mousedown, mousemove, mouseup to the viewport and thats all
(
fn makeparam w l = bit.or (bit.and w 0xFFFF) (bit.shift l 16)
hwnd = (dotNetClass "Autodesk.Max.GlobalInterface").Instance.CoreInterface7.ActiveViewExp.hwnd
view_size = [ gw.getWinSizeX(), gw.getWinSizeY() ]
lower_manipulator_coord = [ view_size.x - 10, view_size.y * 0.9 ]
start_coord = makeparam lower_manipulator_coord.x lower_manipulator_coord.y
end_coord = makeparam lower_manipulator_coord.x (lower_manipulator_coord.y + 100)
windows.sendMessage hwnd 0x201 0x1 start_coord
windows.sendMessage hwnd 0x200 0x1 end_coord
windows.sendMessage hwnd 0x202 0x0 end_coord
upper_manipulator_coord = [ lower_manipulator_coord.x, view_size.y * 0.1 ]
start_coord = makeparam upper_manipulator_coord.x upper_manipulator_coord.y
end_coord = makeparam upper_manipulator_coord.x (upper_manipulator_coord.y - 100)
windows.sendMessage hwnd 0x201 0x1 start_coord
windows.sendMessage hwnd 0x200 0x1 end_coord
windows.sendMessage hwnd 0x202 0x0 end_coord
)
I gotta say, I’m extremely impressed by your attempt dude! Sucks though that there’s no way to do it “under the hood”
I guess these values can be read and set using IPrimitiveRenderer interface from Autodesk.Max.MaxSDK.Graphics.
<Point2>
GetDepthRange ()=0
This method gets current depth range.
SetScreenSpace (const Rect &r, const Point2 &depth)=0
This method sets current viewport rectangle and depth range.
Thanks again Serejah, I think I’ll let it be for now (because I irrationally want to do everything with maxscript)