[Closed] How to add an "input" rollout?
Hello,
I am pulling in XYZ and time (T) data for multiple objects and using MAXscript to quickly animate the different objects.
The problem is that sometime the XYZ data comes in a different scales (sometimes it’s 1:1, sometimes 1.87:1, etc.) and the time (T) sometime comes in hours and sometimes in minutes.
Until now, I’ve just gone into my script and manually changed the formulas to account for the different scene and time scales.
I am hoping I can add a rollouts at the beginning of the script where I can simply enter the measurement scaling (say “2.13”) and it multiples all the XYZ information by that number. Followed by a rollout that asks if the scene is in Hours or Minutes (similar to a querybox).
I’ve spent the last couple of hours on MAXscript Help Menu, which has been frustrating. I can make some basic rollouts, but my script continues to run and doesn’t wait for my numeric entry. I don’t have a ton of MAXscript experience, so any help anyone could offer would be nice. Thanks.
i’m not sure you do everything right. you should be OK using a generic time units because all controllers use the generic time.
i don’t know what your tools does do but it might be reasonable to make a little interface for some settings (like a time format).
so please give us more details about your issue.
i’m pretty sure there is a solution, and it’s simple.
Hi, thanks for getting back to me.
For the time issue:
Let’s say I get two datasets, A and B, and I need to bring them into the same scene. They both have random numbers in the time (T) column but A’s numbers represent minutes and B’s numbers represent hours. So I would like a rollout (not sure if that is the correct term) that pops up when I run my script and asks if the dataset is in minutes or hours.
If the dataset is in minutes, the script uses:
frameNumber = T
If the dataset is in hours, the script uses:
frameNumber = (T * 60)
This way I can combine datasets A and B into one scene.
For the scene scaling issue:
The people who give me the datasets scale their scenes a random sizes. So one unit may be 1.67 feet or 2.13 feet or 4.12 feet, etc. Currently, I simply ask that person what they sized their scene at and then go into my script and manually change a variable (sceneScale) at the beginning of the script.
So I go into the script and make sceneScale = 1.67 and then in my script I have:
XsceneScale
YsceneScale
Z*sceneScale
I would like to have a rollout at the beginning that asks what the scale of the dataset is and sets the sceneScale variable to that number.
Basically, I want to stop opening up my script and manually entering in these variables each time I import a dataset. I would simple like a couple rollouts that ask for this information.
the generic max’s time unit is FRAME
there is a system global:
frameRate
Lets you get and set an Integer value that defines the current scene frame rate in frames-per-second.
using it you can convert to any time system. but if you want to return data in a specific format: mi per hour, km per sec, etc. you need a UI for input
ok. i’ve got. it sounds like you have some data in the exactly same format but the format tells nothing about units (which means the bad format).
so you have to ask what units are used on load(import) the data. correct?
you need a modal dialog… i don’t have MAX around and can’t write a ‘really-working’ code now.
Exactly.
Every time I import data, I manually go into my script and multiple the time by either 1 or 60 and the XYZ coordinates by some scaling number. It seems to me that I should be able to build in a simple rollout that prompts me for that information asking:
A) Is this data in minutes or hours?
and B) what is the unit scale?
I’m sure this is probably quite simple for most people on this website so I’m hoping someone could shed some light on this for me.
but i can try
(
rollout rol "How much?" width:200
(
local amount = 0
local confirmed = false
spinner howmuch_sp "Amount: " range:[0,1e9,amount] type:#integer fieldwidth:54
button ok_bt "OK" width:40
on howmuch_sp changed val do amount = val
on ok_bt pressed do
(
confirmed = true
destroydialog rol
)
)
createdialog rol modal:on
format "the amount of % was confirmed: %
" rol.amount rol.confirmed
)
Wonderful. This is exactly the template I was hoping for. I just changed “Type” to float and it was perfect.
I’m going to toy with Radio Buttons for the “Time” rollout.
Question: I noticed
createdialog rol modal:on
so is modal:on how you get the script to stop and wait for input?
Cheers.
it’s exactly the ‘modal’ is about: stop everything except in the dialog activity since the dialog is opened.
take a look into the mxs help. there are some setting to create a dialog without minimize and maximize buttons. which makes sense in your (any modal) case.
[style:<array>] – default:#(#style_titlebar, #style_border, #style_sysmenu)
Array of style flags, can be one or more of the following:
#style_border: Creates a window with a double border but no title.
#style_titlebar: Creates a dialog with a title bar.
#style_toolwindow: Creates a tool window, which has a title bar and is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font.
#style_resizing: Creates a window with a thick frame that can be used to size the window.
#style_minimizebox: Creates a window that has a minimize button.
#style_maximizebox: Creates a window that has a maximize button.
#style_sysmenu: Creates a window that has a window menu in its title bar.
#style_sunkenedge: Specifies that a window has a 3D look, in the form of a border with a sunken edge.