Topic: version 4 MAXScript New Features/Scripted Plug-In/Scripted Cameras
Scripted camera plug-ins can now be written in MAXScript. At present, you can write either extending camera plug-ins that extend existing MAX cameras or temporary camera plug-ins that can be used to host create tools for a custom camera system.
The plug-in superclass for cameras is 'camera'.
An event handler is available to scripted cameras that gives access to the CameraObject::renderApertureChanged callbacks made by the rendering dialog to a camera when the user adjusts parameters that affect render aperture. The new handler is optional.
on renderApertureChanged val do ....
The 'val' parameter contains the new render aperture value. This typically gets called when you select a new apeture in the Output Size dropdown in the render dialog or adjust a spinner when in Custom mode.
There are several cases where this handler is called:
In the Render Scene dialog, if Image Aspect is unlocked and you change Width, Height, or Pixel Aspect
In the Render Scene dialog, if you click on one of the output size preset buttons
In the Render Scene dialog, if Image Aspect is locked and you change Width, Height, or Pixel Aspect, or if you change Aperture Width, and then click on either Render or Close
The value being passed into handler is the aperture width. You can get the remaining values via: renderWidth, renderHeight, and RenderPixelAspect global variables. However, what you get for these values are typically the old value, with the exception of the Aperture Width value. The call to the handler is coming from a "InvalidateCameras" method, which is called right before setting the new values. Doesn't look like any broadcasts are made after the new values are set, and if safe frames isn't turned on in any viewport, none of the viewports are redrawn.
We recommend that if a scripted camera uses this handler, it should cache the old Aperture Width value and test the incoming value against the cached value before proceeding.
Example:
plug-in Camera CamTest
name:"CamTest"
classID:#(0x47db14ff, 0x4e9b5f90)
category:"Standard"
( on renderApertureChanged val do format "renderApertureChanged: %\n" val
tool create
( on mousePoint click do #stop
)
)
See also
type:#integer Parameters in Scripted Plug-in Parameter Blocks