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( string $attrName )
{
setUITemplate -pst attributeEditorTemplate;
attrEnumOptionMenuGrp
-l "exr.compress"
-at $attrName
-ei 0 "-> none"
-ei 1 "-> Rle"
-ei 2 "-> Zips"
-ei 3 "-> Zip"
-ei 4 "-> Piz"
-ei 5 "-> Pxr24 (lossy)"
bw_uexrGrp;
setUITemplate -ppt;
AEbufferw_ufbexrReplace( $attrName );
}
global proc AEbufferw_ufbexrReplace( string $attrName )
{
string $tmp[];
tokenize($attrName, ".", $tmp);
string $nodeName = $tmp[0];
attrEnumOptionMenuGrp -e -at $attrName bw_uexrGrp;
}
// main procedure for our shader
global proc AEbuffer_writeTemplate( string $nodeName )
{
editorTemplate -s "exrcompress";
editorTemplate -callCustom "AEbufferw_ufbexr"
"AEbufferw_ufbexrReplace" "exrcompress";
}
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" (
"uiName" "Type",
"value" 0,
"range" 0 2
)
This is in 3dsmax8.mi for example.
Regards,
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.