PDA

View Full Version : Maxscript Dynamic UI items


Ravenslayer
02-27-2010, 01:41 PM
Hey guys

I was wondering how you can change rollout UI items positions inside maxscript.

So lets say i created a button and later on by pressing another button i want to set the position of the first button to another location

SyncViewS
02-27-2010, 02:22 PM
Hi. This is kinda weird, but nonetheless, here it is:

rollout rolTest "Test"
(
local p2PosTop = [10,10]
local p2PosBottom = [10,40]

button btButton_1 "Push Me!" width:60 height:30 pos:p2PosTop

on btButton_1 pressed do
(
if (btButton_1.pos == p2PosTop) then
btButton_1.pos = p2PosBottom
else if (btButton_1.pos == p2PosBottom) then
btButton_1.pos = p2PosTop
)
)

createDialog rolTest 80 80 100 100 style:#(#style_toolwindow, #style_sysmenu, #style_resizing)

Remember to use absolute position, like the example, or by moving a single element you'd mess the whole rollout. I guess you can modify every element property, like position, size, text, visibility and so on.

Ravenslayer
02-27-2010, 02:37 PM
ah great tnx for the example syncview :)

i was trying to adress the pos function that way from my on Execute do but it wouldn't work that way.
But there is no need to do that anyway ^^

Ravenslayer
02-27-2010, 02:54 PM
got another question, would it be possible to create a button from within your code

something like this (but working) :p

rollout rolTest "Test"
(
local p2PosTop = [10,10]
local p2PosBottom = [10,40]

button btButton_1 "Push Me!" width:60 height:30 pos:p2PosTop

on btButton_1 pressed do
(
button btButton_2 "I Got Created!" width:60 height:30 pos:p2PosBottom
)
)

createDialog rolTest 80 80 100 100 style:#(#style_toolwindow, #style_sysmenu, #style_resizing)error: >> MAXScript Rollout Handler Exception: -- Type error: Call needs function or class, got: undefined <<

SyncViewS
02-27-2010, 03:10 PM
Unfortunately that's not possible. You must create every element with the rollout itself. The workaround to do something like that could be to create hidden buttons and unhide and position them whenever needed.

There is a chance that something like that could be done with DotNet, but I cannot be of help on that matter.

If you want to create a whole rollout by MaxScript, not adding elements though, take a look at "RolloutCreator Functions" in the Reference.

You can take a peek at these threads about Dynamic UI
http://forums.cgsociety.org/showthread.php?f=98&t=782510
http://forums.cgsociety.org/showthread.php?f=98&t=789655

Ravenslayer
02-27-2010, 03:25 PM
hmm shame it can't be done that way , i'm still used to the flexibility of c++ :D

the thing i want to do is make some sort of layer system were i can add and delete layers (UIitems are created in code / positions are relative to other changing parameters)

i'm going to check out those links you gave me :)
tnx again

SyncViewS
02-27-2010, 03:33 PM
If that's your goal, you may want to look into TheOnion (http://www.hyperent.com/Hyp-TheOnion.php), a layer manager system for 3ds Max rewritten in DotNet and Pier Janssen's Outliner (http://forums.cgsociety.org/showthread.php?f=6&t=843266) which should be written in C#.

Or... you can venture into the wonderful world of 3ds Max SDK and experience the full power and the pain.

Ravenslayer
02-27-2010, 03:50 PM
haha the onion is exactly what i was going to try and make.

Guess i'll find another scripting idea for my maxscript schoolproject :P

second time i need to change my idea

first time i was planning on making a 3d painting tool so i made a mockup and two days later they announced the new 2011 painting feature

http://i45.tinypic.com/2wn9169.jpg

SyncViewS
02-27-2010, 04:08 PM
It means they are good ideas :)

You can try something on retopologization.
Skinning is still an open field. I wanted to do something on this.
A script for baking that explodes the mesh, bakes and rebuild it.
A script that automatically build a good cage starting from a low poly overlapped to a high poly model.

Just think about the whole creation workflow, than pick a tedious/dumb step and think about a way to make it automatic/faster/better. Think about all those steps where you have to do something that doesn't require any intelligence, only repeated actions, like exporting/importing separated meshes and so on.

Ravenslayer
02-27-2010, 04:38 PM
tnx for the ideas!