Hello, I made this thread to learn a few things about max script. I'm still very new to this and I don't expect to be pro at this anytime, but I just want to make scripts that just makes things easier for me. that includes Clean, and easy UI for the most part.
Here is what my UI looks like.
most of the toolbars are things like primitives, and the most common actions I use from the graphite toolbar(the Ribbon is redundant UI and hogs screenspace, but there are some functions that I use from it). then I also have buttons that toggle the timeslider, trackbar, and status bar independently. My command Panel is on my second monitor.
but the thing that actually required scripting are the transform spinners on the bottom. I just started getting in to maxscripting a couple days ago, and these spinners are what I have working so far to some extent.
here is my code for the spinners.
rollout Tformspinners "TformSpinners" width:640
(
label Movelabel "Move" pos:[0,0] width:32
spinner MoveX "X" range: [-1000000,1000000,0] pos:[40,0] width:70
spinner MoveY "Y" range: [-1000000,1000000,0] pos:[120,0] width:70
spinner MoveZ "Z" range: [-1000000,1000000,0] pos:[200,0] width:70
label Rotlabel "Rotate" pos:[285,0] width:32
spinner RotX "X" range: [-1000000,1000000,0] pos:[330,0] width:70
spinner RotY "Y" range: [-1000000,1000000,0] pos:[410,0] width:70
spinner RotZ "Z" range: [-1000000,1000000,0] pos:[490,0] width:70
)
createdialog Tformspinners
cui.RegisterDialogBar Tformspinners
cui.DockDialogBar Tformspinners #cui_dock_bottom
fn Refresh_controllers =
(
meshes = $
if meshes != undefined and meshes != $selection do
(
Tformspinners.MoveX.controller = ($.pos.controller.x_position.controller)
Tformspinners.MoveY.controller = ($.pos.controller.y_position.controller)
Tformspinners.MoveZ.controller = ($.pos.controller.z_position.controller)
Tformspinners.RotX.controller = ($.rotation.controller.x_rotation.controller)
Tformspinners.RotY.controller = ($.rotation.controller.y_rotation.controller)
Tformspinners.RotZ.controller = ($.rotation.controller.z_rotation.controller)
)
)
callbacks.addscript #selectionSetChanged "Refresh_controllers()" id:#callbackIDs
on Tformspinners close do
(
callbacks.removescripts #selectionSetChanged id:#callbackIDs
)
Like I said, I'm still new to this so anyone more intermediate with maxscript, let me know if I'm doing things efficiently or not.
I would like to point out that I have this script as a startup, for the most part it works fine for me, but I do get the error "--Type error: Call needs function or class, got: true" I guess it's not reading my callback function at first, but after that message, everything is fine. I would still like to know how to prevent this popup. on startup.
as for now, my spinner don't work with groups or multiple selections (I if'd those out for now) but later on, I would like to be able to use the spinners on multiple selections based on pivot modes.
Replies
:thumbup: