Getting a spinner value to change a value in a script.
Hi guys.
I'd like to know how to use the value of a spinner to change something in a script.
So when a user changes a spinner value, that vale is used to adjut the settings of the rest of the script when a button is pressed.
It's for my Multi/Sub-Object script and i'd like a spinner so that the user can select how many sub materials they want. I've got the spinner in the UI, i just can't figure out how to take the spinner value and put it into the property for the number of materials.......It seems simple but everything i've tried doesn't work.
Cheers.
Comments
haha no need to do so really
haha no need to do so really :P but if you want to, its lowercase "br0t" ;)
the interface is a lot better now! nothing to complain
Never get low & slow & out of ideas
Right you are!
Hopefully I'll have some time soon to try scripting the different colour ideas i have.
Watch this space!
Cheers.
Script_Butler
glad I could help! Its not
glad I could help! Its not that long ago I struggled with these things, this forum is great to learn MXS
Never get low & slow & out of ideas
Big help
It has been a big help to me, and it's users like yourself that are the key. People that don't mind helping out with really simple questions!
I'd like to put a credit for you no my script. See the below code, at the moment it's just a thank-you with a label. Feel free to change it to a link to yourself of change it to whatever you want it to be. Once you've changed it i will upload the latest version to the Scripts part on here!
I've had a slight adjustment this morning putting the seperate material types in their own rollouts, and added the MentalRay code. I think it's a bit more user friendly now. Let me know what you think or if you think it could be tweaked to be more user friendly still
Thanks again for your input.
Cheers.
Cheers.
Script_Butler
You should also change the
You should also change the materials so they do not have the same name.
And.. MentalRay ;)
Arch___Design__mi
/ Raymond
Good point.
I've just changed that, and added in the mental ray presets.
Eventually i want to add a way to specify the main material name and then all the sub materials automatically name the same but incrementally. That's way abouve my scripting capability at the moment, I can't even get the spinner values to translate in to the mat.count
Have a look at my script on here to see what i want to add in, your ideas are already in hand!
I'll get there, perseverance is key! I just need a few pointers freqently!
Cheers.
Script_Butler
I hope you dont mind me
I hope you dont mind me rewriting some stuff. If you have the amount of submaterials you want to create from the spinner, you can loop that often and create a submaterial each time. Diffuse color is generated randomly, and Ive added an edittextfield which text will be used as the base material name. You can add text to strings, in this case the number of the loop/material by simply saying "+".
Cheers
Never get low & slow & out of ideas
No problem
Hi Br0t.
I don't mind at all that you've done that. I will give you a credit on the script in the "about" rollout.
I wanted to do exactly those things but i've only bee teaching myself maxscipt for a couple of weeks. I had an idea about getting the mat.count in using the spinner but couldn't get in in the right order/place.
The random material thing was my next step. I can now see by looking at the script ecatly how you've done it and it makes complete sense.
I'll add in the MentalRay code that i did yesterday.
I will be adding a few more features on the colour side of things. I'd like to have a few presets that people can choose from by picking colour swatches.
Thanks for your help, it's greatly appreciated.
Cheers.
Script_Butler
I'm still none the wiser i'm afriad!
Heres my currect script.
What i want to achieve is :-
When Spinner stdnum_mtl value is put on 15, it changes the mat.count to 15 when btn_1 is pressed and the material is created with 15 sub materials.
Where would I put this event handler? I always get lost and confused as to whether things go inside our ourside of brackets.
Sorry for the simpleness, I'm still learning!
Cheers.
Script_Butler
you can get a spinners value
you can get a spinners value like so:
spn_mySpinner.value
there is also an event handler to change stuff when the spinner value is changed:
on spn_mySpinner changed theVal do myVar = theVal
Cheers
Never get low & slow & out of ideas