PDA

View Full Version : Maxscript - Display rollout


Transform Gizmo
09-12-2002, 06:44 AM
ok im making a little script, that shows the display properties options from the object properties menu. i have ran into a few problems with some things i want to do. first, heres the interface for the script:
rollout disprop "Display Properties"

(
group "Display Properties"(
checkbox hde "Hide"
checkbox frz "Freeze"
checkbox disbox "Display as Box"
checkbox edgonly "Edges Only"
checkbox vertix "Vertex Ticks"
checkbox trajec "Trajectory"
checkbox sthrough "See-Through"
checkbox igtense "Ignore Extense"
checkbox sfreeze "Show Frozen in Gray"
button selname "Select By Name" pos: [10,205]
)
on selname pressed do hitByNameDlg()

)

createDialog disprop width:175 height:235

ok
1:when i run the script, i want the properties that are already on to be checked automatically. for example if the selected object has vertex ticks turned on, i want to make it so that the script will automatically check vertex ticks. but im not sure how to go about this. and also, i have tried to find a way to get the checkboxes to control the display properties, but so far i can only do it if i have to checkboxes for each property, an "on" and "off" checkbox, but i would like to do it with one. so far i havnt figured it out. any help would be appreciated

BrandonD
09-12-2002, 05:35 PM
One way of doing that is to load the object's properties into variables then assign new values to the properties. For example:

global vTicksOld, vTicksNew

vTicksOld = $.vertexTicks
--this stores the current selection's vertexticks property

on vTicks_Checkbox changed state do
(
vTicksNew = state
)
-- this assigns the vertexTicks parameter in your script to a variable


on ApplyButton pressed do $.vertexTicks = vTicksNew
-- this assigns the new vertexTicks value to the object


In a nutshell, if you connect the UI controls to old/new variables, then when you're ready to change the object's properties, all you have to do is assign the values of the new variables to the object. If nothing has changed then it won't do anything.

Transform Gizmo
04-30-2003, 09:31 AM
oh man.....this was a long time ago. but i forgot to say thanks!

Bobo
04-30-2003, 01:08 PM
(
local current_obj = undefined
rollout disprop "Display"
(
group "Display Properties"(
checkbox hde "Hide"
checkbox frz "Freeze"
checkbox disbox "Display as Box"
checkbox edgonly "Edges Only"
checkbox vertix "Vertex Ticks"
checkbox trajec "Trajectory"
checkbox sthrough "See-Through"
checkbox igtense "Ignore Extense"
checkbox sfreeze "Show Frozen in Gray"
button selname "Select By Name" pos: [10,205]
)
on selname pressed do
(
hitByNameDlg()
if selection.count > 0 then
(
current_obj = selection[1]
hde.checked = current_obj.isHidden
frz .checked = current_obj.isFrozen
disbox.checked = current_obj.boxMode
--and so on for all properties...
)
)
on hde changed state do if current_obj != undefined then current_obj.isHidden = state
on frz changed state do if current_obj != undefined then current_obj.isFrozen = state
on disbox changed state do if current_obj != undefined then current_obj.boxMode = state
--and so on for all properties
)
createDialog disprop width:175 height:235

)


You should note that this works with only a single object - the first in the selection.
BUT hitByNameDlg() allows you to select multiple objects!
You could get the whole selection as array of objects, and in Max 5 you can have a greyed-out checkbox for the cases multiple objects have different values for the same property. (see .triState property for "indeterminate" value)

But this is the next level... ;)

Transform Gizmo
05-01-2003, 12:40 PM
thanks some more :)
ill study this a bit after school today.

Equinoxx
05-01-2003, 01:06 PM
what about just using the display floater that's under the tools menu :shrug:

Bobo
05-01-2003, 01:16 PM
Originally posted by Equinoxx
what about just using the display floater that's under the tools menu :shrug:


I assume this thread is about learning MAXScript, not about using the existing tool. After 5 releases of MAX and with the thousands of scripts and plug-ins out there, there is a tool for about anything (mostly from Blur ;)).
Still, people need to write basic scripts to solve simple tasks in order to learn how to write more complex ones. IMHO, the hardest part of learning MAXScript is finding a cool idea to try and flesh out in code.

Equinoxx
05-01-2003, 01:34 PM
ah yeah i thought as much, just wanted to be sure ;) . . .
and it's actually a good idea to learn script by writing things that
allready exist, so you can check if the script functions correctly.

cheers.

Transform Gizmo
05-02-2003, 06:46 AM
it's actually a good idea to learn script by writing things that already exits.
yup, this thread actually started out quite a while ago when i started scripting. i didnt really have any idea how to create a ui for a script so i figured i'd just try and do something simple that im more familiar with. seems to be a pretty good method of learning.

CGTalk Moderation
01-13-2006, 04:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.