/* Lookat is a script for "Aiming" objects at other objects via the look-at controller. it is designed to work with multiple objects and can modify the look-at settings as well as remove the controller, returning it to its original state.
Author: Chris Harvey */
-- 1.7.14 cover day Annotation
Try (Cui. unregisterdialogbar aim) catch () Try (closerolloutfloater aim) catch ()
Rolout look "lookat set-up. Button howto_btn "Instructions" width: 63 Height: 55 pos: [150] groupbox target_grp "target object" width: Height: 62 pos: [] button pick_btn "pick" width: 140 Height: 20 pos: [140] edittext pick_edt "" width: 210 Height: 18 pos: [] button execute_btn "add lookat" width: Height: 25 pos: [210] button remove_btn "Remove lookat" width: 10,103 Height: 25 pos: [103] button off_btn "lookat off" width: Height: 21 pos: [10,130] button on_btn "lookat on" width: 103 Height: 21 pos: [117,130]
On howto_btn pressed do (-- click the rolout fig "Aim instructions" (local htmlpath = getdir # scripts + "\ Harvey \ HELP \ aim_help.html" local size = [700,1140] activexcontrol name_ax "http: \ www.relic.com "width :( size. x-30) height :( size. y-45) Align: # center on Fig open do (name_ax.navigate2 htmlpath) fhowpage = newroloutfloater "Aim instructions" Fig. size. x 800 addrolout fig fhowpage rolledup: false) on pick_btn pressed do (Global targetobj = pickobject () pick_edt.text = targetobj. name) on execute_btn pressed do with undo label: "look-at" on (max motion mode
For foo in $ do (FOO. rotation. controller = rotation_list () For foo in $ do (FOO. rotation. controller. available. controller = lookat_constraint () For foo in $ do (FOO. rotation. controller. lookat_constraint.controller.relative = on foo. rotation. controller. lookat_constraint.controller.viewline_length_abs = off Foo. rotation. controller. lookat_constraint.controller.lookat_vector_length = 0 Foo. rotation. controller. lookat_constraint.appendtarget targetobj 50) For foo in $ do (FOO. rotation. controller. available. controller = euler_xyz () For foo in $ do (listctrl. setname Foo. rotation. controller 1 "base" listctrl. setname Foo. rotation. controller 3 "Manual") undo off For foo in $ do (FOO. rotation. controller. setactive 3)
Max create mode) on remove_btn pressed do with undo label: "Remove lookat" On (For foo in $ do (orig = copy Foo. rotation. controller [1] Foo. rotation. controller = orig) on off_btn pressed do with undo off (For foo in $ do (FOO. rotation. controller. weight [2] = 0) on on_btn pressed do with undo off (For foo in $ do (FOO. rotation. controller. weight [2] = 100 )))
Rolout aimmodifier "Modify lookat. --- This is equivalent to showing the more comments it is. --- drawing a long image on the UI is very beautiful. -- I am also doing this in classification. -- in fact, to keep up with the cards the imgtag control group "modifiy aim" (Button line_btn1 "" width: 2 height: 205 pos: [45, 20] checkbutton rel_chk "" width: 35 Height: 12 pos: [7,175] -- images: # (getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp", getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp ", 3, 1, 3, 1, 3) checkbox relative_chk "keep initial offset" POS: [182] button line_btn2 "" width: Height: 2 pos: [45, 45] checkbutton look_chk "" width: 35 Height: 12 pos: [7, 65] -- images: # (getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp", getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp ", 3, 1, 3, 1, 3) radiobuttons look_rdo "select lookat axis" POS: [70, 55] labels: # ("X", "Y", "Z") default: 3 checkbox flip_chk "flip" POS: [170,70] button line_btn3 "" width: 182 Height: 2 pos: [45, 90] checkbutton ucontrol_chk "" width: 35 Height: 12 pos: [7,110] -- images: # (getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp ", getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp", 3, 1, 3, 1, 3) radiobuttons ucontrol_rdo "upnode control" POS: [70,100] labels: # ("lookat", "axis alignment") Default: 2 button line_btn4 "" width: 182 Height: 2 pos: [45,135]
Checkbutton source_chk "" width: 35 Height: 12 pos: [7,155] -- images: # (getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp ", getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp", 3, 1, 3, 1, 3) radiobuttons source_rdo "Source axis" POS: [70,145] labels: # ("X", "Y", "Z") Default: 2 checkbox flips_chk "flip" POS: [170,160] button line_btn5 "" width: 182 Height: 2 pos: [45,180]
Checkbutton uaxis_chk "" width: 35 Height: 12 pos: [7,200] -- images: # (getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp ", getdir # maxroot + "\ scripts \ Harvey \ icons \ checkicons.bmp", 3, 1, 3, 1, 3) radiobuttons uaxis_rdo "aligned to upnode axis" POS: [70,190] labels: # ("X", "Y", "Z") Default: 3 button line_btn6 "" width: 182 Height: 2 pos: [45,225] button none_btn "Check none" width: 105 Height: 25 pos: [10,235] button all_btn "check all" width: 105 Height: 25 pos: [117,235] button modify_btn "Modify selected" width: 212 Height: 25 pos: [10,265]) on none_btn pressed do with undo off (rel_chk.state = false look_chk.state = false ucontrol_chk.state = false source_chk.state = false uaxis_chk.state = false) on all_btn pressed do with undo off (rel_chk.state = true look_chk.state = true ucontrol_chk.state = true source_chk.state = true success = true) on modify_btn pressed do with undo label: "Modify aim" On (if rel_chk.state = true then For foo in $ do (FOO. rotation. controller. response = relative_chk.state) If look_chk.state = true then For foo in $ do (Response get_axis = (look_rdo.state as integer)-1) response get_axisflip = flip_chk.state) if ucontrol_chk.state = true then For foo in $ do (FOO. rotation. controller. lookat_constraint.controller.upnode_ctrl = (ucontrol_rdo.state as integer)-1) If source_chk.state = true then For foo in $ do (FOO. rotation. controller. lookat_constraint.controller.stoup_axis = (source_rdo.state as integer)-1) Foo. rotation. controller. lookat_constraint.controller.stoup_axisflip = flips_chk.state) If uaxis_chk.state = true then For foo in $ do (FOO. rotation. controller. lookat_constraint.controller.upnode_axis = (uaxis_rdo.state as integer)-1 ))))
Aim = newroloutfloater "aim" 245 515 addrolout look aim addrolout aimmodifier aim