Notifications
Clear all

[Closed] Working with the gw. drawing functions

I am currently trying to write a script that will allow me to toggle on/off, in a current viewport, a grid for use with composing my shots.

So a grid that divides the currentview size into thirds, golden sections or even a custom user grid.

I want the script to work in a similar way to the viewport safe frames 12 field grids except obviously with more control, and have minimum screen re-draw overheads

This is a quick attempt at using the gw. functions to divide the view with a simple crosshair that scales correctly with current viewport size


 fn  test =
 (
 	VPsize = #(getviewsize())
 	VPWid = VPsize[1][1]
 	VPHgt = VPsize[1][2]
 		
 	gw.hPolyline #([VPwid/2,VPHgt,0], [VPwid/2,0,0], [VPwid/2,0,0]) true
 	gw.hPolyline #([0,VPHgt/2,0], [VPwid,VPHgt/2,0], [VPwid,VPHgt/2,0]) true	
 	
 	gw.enlargeUpdateRect #whole
 	gw.updateScreen()
 )
 
 registerRedrawViewsCallback test
 

First of all I am having trouble toggling the grid on and off and unregistering the redrawviews callback, so any polylines i create seem to become ‘sticky’.

Secondly is this the most efficient approach to my script as I dont want to be unneccesarily calling too many screen redraws.

If there is anybody with any experience of this your input would be greatly appreciated.

Thanks,

D.

2 Replies

Hey David,
I thought you’d get to pull this script apart https://www.scriptspot.com/3ds-max/scripts/mcam-grid-composition-assistance-tool but it’s encrypted.

There’s this one however https://www.scriptspot.com/3ds-max/scripts/imagecomphelper

Thanks, this is exactly what I was looking for!