Accessing Translucency Parameter from Maxscript

As some of you are probably aware, I am currently writing a material lister maxscript function that allows comparison of multiple material parameters within the same rollout.

I am trying to add a spinner to control the Translucency Thickness Paramater. The problem is that I can’t assign this parameter a controller, so I am unable to link the spinner value with the T.Thickness parameter.

How do I link the spinner value with a vray material parameter that is ‘not animatable’ ? I appreciate the fact we don’t need the thickness value to be animatable, but I need it to be animatable to be able to assign a spinner to control its value.

Thanks for any advice :slight_smile:

For the latest version of the script go here :- http://www.chaosgroup.com/forum/phpBB2/viewtopic.php?t=14540&start=25

I’m not sure how to do this myself, but maybe you can ask on the Autodesk support forum, I’m sure some of the MaxScript guys there would know the answer.

Best regards,
Vlado

Thanks vlado, I’ll check that out.

“link” is a bit of a generic term…
I managed to control any vray material parameter through scripting,and withouth any use of controllers,in a project hopefully to be released sometimes soon…
An example of the code, and issue, would help…

Lele

Sure, here you go.


-- Create Controller (this isnt possible as the vray parameter isnt animateable)

if (MLister.matIndex[mlister.count].translucency_thickness.controller == undefined) do MLister.matIndex[mlister.count].translucency_thickness.controller = bezier_float ()

-- Define spinner controller to adjust transclucency thickness

MLister.vrayMatRC.addControl #spinner (("MatTransThSlide" + MLister.count as string) as name) "" paramStr:(" range:[0,10000," + MLister.Matindex[MLister.count].translucency_thickness as string + "] height:" + MLister.mly as string + " offset:[190," + MLister.mlyo as string + "] width:45 scale:1 type:#integer tooltip:\"Translucency Thickness Amount\" controller:MLister.matIndex[" + MLister.count as string + "].translucency_thickness.controller")

I’m not a very experienced maxscript coder, so if you can tell me how to map a spinner to a non-animateable parameter, I’d be grateful :slight_smile:

--edit -- I just realised how unintelligable that line of code is… here’s a stripped down version :-

MLister.vrayMatRC.addControl #spinner spinnerName "" paramStr:(" range:[0,10000,curMatTransThickness] height:15 offset:[190,curOffset] width:45 scale:1 type:#integer controller:curMat.translucency_thickness.controller")

mmmh, i wrote a plugin material, hence extending the original Vray one, and had only to declare aliases to the original vray parameters, as such:


parameters main rollout:params
(
     col type:#color default:(color 5 5 5) ui:col
     on col set val do delegate.Diffuse = val
)

where col is the name of the new UI colorpicker item, and delegate is a pointer to the underlying vray material.

I am not at all familiar (even if i see what you’re doing) with the way you are linking things, especially as you have to generate them on the fly, and that isn’t what i was doing.
Even if slower, can’t you just add something like
on MLister.Matindex[MLister.count].translucency_thickness changed do "update my spinner" ?

I may be a zillion years off the mark, so an answer ain’t needed in ALL cases :lol:

Lele

Thanks for the suggestion Lele, I’ll try that out, although I have a suspicion that was what I tried initially only to find that the spinner didn’t like being created without being tied to an animatable parameter… I could be wrong though.

I should get a chance to check it out tomorrow.

Cheers.
pat.