转换器
转换器是用来将其它类型的picker节点、文件转换成mgpicker节点或文件的mel脚本。
转换器非常多地使用了由MG-Picker工作室提供的MEL API命令,主要是这三个命令:MGPicker, MGPickerItem and MGPickerLink. 请参考这些命令的文档来了解它们的用法。
这些转换器MEL脚本放在哪里
对于工具自带的转换器,是放在Maya的脚本文件夹/ MG-PickerStudio/MGPicker_Program/Converters里,这些转换器由MG-Picker工作室维护所以最好不要去动它。
对于用户编写的转换器,请放在这里:Maya的脚本文件夹/MG-PickerStudio/MGPicker_UserConfig/Converters。
如何编写转换器
要学习如何编写一个转换器,请参考自带的两个mel转换器作为例子参考:Converter_abxPicker.mel, Converter_nickPicker.mel
例子
假设您的转换器是为了转换其它Picker类型的picker节点或文件,则转换器mel脚本就叫做Converter_otherPicker.mel, 然后这个mel脚本里必须用global proc编写下面的接口函数:
// Other picker node converter API:
// Return 0~1 value, indicate if MG-Picker should invoke this converter to autoload
// your in-scene picker node.
global proc int Converter_otherPicker_autoReadNode();
// Return string value, the type string of picker node.
global proc string Converter_otherPicker_nodeType();
// Return 0~1 value, indicating the node is of the picker node.
global proc int Converter_otherPicker_isPickerNode(string $node);
// Return the namespace from a picker node.
// The proc is used in find&Load feature of MG-Picker studio.
global proc string Converter_otherPicker_getNamespace(string $node);
// List all the picker nodes in the scene.
global proc string[] Converter_otherPicker_nodeLister();
// The actual reader for each picker node.
global proc int Converter_otherPicker_readNode(string $node);
//other picker file converter API:
//Return 1 if the file is the picker file, 0 if not.
global proc int Converter_otherPicker_isPickerFile(string $fileFullPath);
// The actual reader for each picker file.
global proc int Converter_otherPicker_readFile(string $fileFullPath);