executing code from a custom attribute

Hi

I have added Custom Attributes to a Camera. One of the attributes is a dropdown box containing a list of prime lenses. ie(50mm f1.8, 100mm f2 etc). What I cant figure out is how you can code this so that when you select one of the the options from the list then it automatically changes the value on the camera. I also want to add zoom lenses so that it will allow you to adjust the value manually between a set range.

Any help would be gratfully recieved.

Thanks

Gram

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gramx's picture

Thanks again

Cheers, Its all a lot clearer now!

g

br0t's picture

You can add event handlers in

You can add event handlers in your rollout, just like in any other script. For example if you have a dropdownlist inside your rollout, a possible event handler could be:

on ddl_lenses selected myLensPreset do
(
  --change camera here, e.g.:
  if myLensPreset == "Fisheye" do
  (
    $Camera01.fov = 112
  )
)

That event would occur every time you select something in the dropdownlist.

The event handlers are always listed in the MAXScript help files on the same page as the description of their interface item, so easy to find, just search for e.g. "checkbutton" in the index and you will find everything there.

You also have the possibility to use the parameters in you custom attribute to change things without event handlers. IF you add any parameters in your ca, you can assign a ui item from the rollout to them. If the ui item changes, the parameter will do as well. If you then wire this parameter (all parameters are created as an animatable track) with the Wire Parameter feature to any other parameter e.g. of your camera, changes in the ui will have an effect on the camera. But event handlers will give you more possibilities.

Cheers

Never get low & slow & out of ideas

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.