Passing parameters to rollouts

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  1 Week Ago
Passing parameters to rollouts

Hi,
I'm using Max Script. I'd like to pass some parameters to a rollout, just like you would normally specify in a class' constructor. Rollouts do not seem to have such an ability. Or do they?

I know I could access locals in a rollout directly, but their values get reset upon initialization, which is not good for what I need.

Currently what I do is I created a struct available globally, with the members, to which I assign values before I call 'createDialog'. This way
my rollout will read the data from that struct.
But that seems a bit cumbersome...

Is there any more elegant way to do it?
__________________
my portfolio: www.juliuszk.com

Last edited by Juliusz : 1 Week Ago at 10:36 PM.
 
  1 Week Ago
I usually access local variables because in my case I don't need to save their values outside rollout's screen life.

Global struct is not that bad.
 
  1 Week Ago
you could do it as a Custom Attribute with local variables and/or parameter blocks, right?
 
  1 Week Ago
Originally Posted by Juliusz: I know I could access locals in a rollout directly, but their values get reset upon initialization, which is not good for what I need.

They get set to whatever value is assigned to them in the rollout, you can reassign them to itself and they will hold the same value:

rollout varTest ""
(
	local str = if isKindOf str String then str else "Default"
	button btnStr str
)

varTest.str = "Override"
createDialog varTest
__________________
Scripts :: linkedin
 
  1 Week Ago
And of course you can use an '*.ini' file to load values in the 'on open' event and save them in the 'on close' one.
__________________
Andrés FC.
P3D_PathScripts
Proin3D YouTube Channel
 
  6 Days Ago
Thanks everyone for your answsers. All are good ideas, however I probably will go for this one, for what I need:

Originally Posted by Swordslayer: They get set to whatever value is assigned to them in the rollout, you can reassign them to itself and they will hold the same value:

I'd never think about assigning variable to itself, based on type etc.. Really cunning idea.
Thanks again!
__________________
my portfolio: www.juliuszk.com
 
  6 Days Ago
Originally Posted by Juliusz: I'd never think about assigning variable to itself, based on type etc.. Really cunning idea.
Thanks again!

Like most of the other brilliant ideas, I first saw this one used by denisT, and didn't look back ever since
__________________
Scripts :: linkedin
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:08 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.