PDA

View Full Version : descriptive labels for mi declaration files



bart
February 3rd, 2006, 19:53
This is for phenomena developers or shader writers, or folks who might want prettier UI for custom shaders without having to write a mel AETemplate script.

Consider this an addition to the Maya Help section entitled:
"mental ray Shader Language Extensions"

The syntax for enum-like integer-to-label presentation is

#: enum <string>

<string> is the same as for addAttr's "-enumName" parameter, details in
the Maya documentation.

#: enum can only appear after integer parameters and turns these integers into descriptive labels in the AE UI.

Example:

integer "int2" default 2, #: enum "one=1:two=2:five=5:eight=8:null"

dlanier
February 4th, 2006, 08:46
Thanks for the information Bart !

ctrl_studio
February 4th, 2006, 18:33
bart !! no one on the earth really knows about this.
great tip !!!


to complete the post here the mel counterpart
to get a combo labels from integers params..




global proc AEbufferw_ufbexr&#40; string $attrName &#41;
&#123;
setUITemplate -pst attributeEditorTemplate;

attrEnumOptionMenuGrp
-l "exr&#46;compress"
-at $attrName
-ei 0 "-> none"
-ei 1 "-> Rle"
-ei 2 "-> Zips"
-ei 3 "-> Zip"
-ei 4 "-> Piz"
-ei 5 "-> Pxr24 &#40;lossy&#41;"
bw_uexrGrp;
setUITemplate -ppt;

AEbufferw_ufbexrReplace&#40; $attrName &#41;;
&#125;
global proc AEbufferw_ufbexrReplace&#40; string $attrName &#41;
&#123;
string $tmp&#91;&#93;;
tokenize&#40;$attrName, "&#46;", $tmp&#41;;
string $nodeName = $tmp&#91;0&#93;;

attrEnumOptionMenuGrp -e -at $attrName bw_uexrGrp;
&#125;


// main procedure for our shader
global proc AEbuffer_writeTemplate&#40; string $nodeName &#41;
&#123;

editorTemplate -s "exrcompress";
editorTemplate -callCustom "AEbufferw_ufbexr"
"AEbufferw_ufbexrReplace" "exrcompress";

&#125;


here we have only one parameter from the buffer_write shader.
the param is 'exrcompress'. we first suppress it. so it will not be
displayed directly.
then we use a callCustom stat to let that param having a rollout label
combo list in the AE template. the first call to "AEbufferw_ufbexr"
establish the label list by using the mel 'attrEnumOptionMenuGrp ' .
the second call "AEbufferw_ufbexrReplace" will effectively pass the
item choosed to our parameter.

max

Puppet
February 4th, 2006, 21:38
It's great!
But is it wotk in 3dsmax?...
I suppose no. Because enum menu it's really problem for 3dsmax.
Does anyone know how to make enum menu in 3dsmax without coding on max api?

dlanier
February 4th, 2006, 22:45
No it doesnt work for Max, only Maya.
For Max, there is an enum control but I don't think you can set strings values...
In the GUi section of the .mi file there are sometimes :



control "type" "enum" &#40;
"uiName" "Type",
"value" 0,
"range" 0 2
&#41;

This is in 3dsmax8.mi for example.
Regards,