Files
Nexus/2023/scripts/animation_tools/mgpicker/MGPicker_Help/English/converters.htm
2025-11-23 23:31:18 +08:00

79 lines
10 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Converters</title>
<meta name="generator" content="Help &amp; Manual" />
<meta name="keywords" content="converters,picker converters" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
body { margin: 0px; background: #F8F8F8; }
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="helpman_settings.js"></script>
<script type="text/javascript" src="helpman_topicinit.js"></script>
<script type="text/javascript">
HMSyncTOC("index.html", "converters.htm");
</script>
<script type="text/javascript" src="highlight.js"></script>
<script type="text/javascript">
$(document).ready(function(){highlight();});
</script>
</head>
<body>
<table style="width:100%; border:none; border-spacing:0px; padding:0px; background:#D0D0D0">
<tr style="vertical-align:middle">
<td style="text-align:right">
<a href="welcome.htm"><img border="0" src="../common/images/MGtoolsHelp_Home.gif" width="34" height="22" alt="Home" /></a>&nbsp;
<a href="commandbuttonpresets.htm"><img border="0" src="../common/images/MGtoolsHelp_previous.gif" width="34" height="22" alt="Previous" /></a>
<a href="codesnippets.htm"><img border="0" src="../common/images/MGtoolsHelp_next.gif" width="34" height="22" alt="Next" /></a>
</td>
</tr>
</table>
<!-- Placeholder for topic body. -->
<table style="width:100%;border:none;border-spacing:0px"><tr style="vertical-align:top"><td style="text-align:left;padding:5px">
<p class="p_Normal" style="text-indent: 0; line-height: 1.80; padding-left: 13px; margin-left: 0;"><span class="f_Heading1" style="font-size:10pt; font-family: Arial,'Lucida Sans Unicode','Lucida Grande','Lucida Sans';display:inline-block;width:13px;margin-left:-13px">&#9642;</span><span class="f_Heading1" style="font-size: 10pt;">Converters are a MEL script that converts other types of picker nodes/files into MG-Picker files/nodes.</span></p><p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">The converters utilize the MEL API commands provided by MG-Picker Studio heavily, especially these 3 commands:</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;"><a href="mgpicker.htm" class="topiclink">MGPicker</a>, <a href="mgpickeritem.htm" class="topiclink">MGPickerItem</a>, <a href="mgpickerlink.htm" class="topiclink">MGPickerLink</a>.</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Refer to the command reference for those commands to know more about these commands.</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;">&nbsp;</p>
<p class="p_Normal" style="text-indent: 0; line-height: 1.80; padding-left: 13px; margin-left: 0;"><span class="f_Heading1" style="font-size:10pt; font-family: Arial,'Lucida Sans Unicode','Lucida Grande','Lucida Sans';display:inline-block;width:13px;margin-left:-13px">&#9642;</span><span class="f_Heading1" style="font-size: 10pt;">Where should these converter scripts be placed?</span></p><p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">For factory default converters, they are in the Maya's user script folder/ MG-PickerStudio/MGPicker_Program/Converters,</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">the factory default converters are maintained by the developer of MG-Picker Studio so better keep them intact.</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">For user converters, please put them here: Maya's user script folder/MG-PickerStudio/MGPicker_UserConfig/Converters.</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;">&nbsp;</p>
<p class="p_Normal" style="text-indent: 0; line-height: 1.80; padding-left: 13px; margin-left: 0;"><span class="f_Heading1" style="font-size:10pt; font-family: Arial,'Lucida Sans Unicode','Lucida Grande','Lucida Sans';display:inline-block;width:13px;margin-left:-13px">&#9642;</span><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">To learn how to write a converter, check out the existing converters from the factory default converters folder:</span></p><p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Converter_abxPicker.mel, &nbsp;Converter_nickPicker.mel</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">&nbsp;</p>
<p class="p_Normal" style="text-indent: 0; line-height: 1.80; padding-left: 13px; margin-left: 0;"><span class="f_Heading1" style="font-size:10pt; font-family: Arial,'Lucida Sans Unicode','Lucida Grande','Lucida Sans';display:inline-block;width:13px;margin-left:-13px">&#9642;</span><span class="f_Heading1" style="font-size: 10pt;">Say your converter is for the </span><span class="f_Heading1" style="font-size: 10pt; font-style: italic;">otherPicker</span><span class="f_Heading1" style="font-size: 10pt;"> nodes, and the converter file is called </span><span class="f_Heading1" style="font-size: 10pt; font-style: italic;">Converter_otherPicker.mel</span><span class="f_Heading1" style="font-size: 10pt;">,</span></p><p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 24px;"><span class="f_Heading1" style="font-size: 10pt;">the interfaces that a converter mel should implement are:</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">//other picker node converter API: &nbsp; &nbsp; &nbsp; &nbsp;</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">global proc int &nbsp;Converter_otherPicke</span><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">r_autoReadNode(); &nbsp; //return 0~1 value, indicate if MG-Picker should invoke this converter to autoload your in-scene picker node.</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;"><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">global proc string Converter_otherPicker_nodeType(); </span><span class="f_Heading1" style="font-size: 10pt; font-weight: normal;"> &nbsp;//return string value, the type string of picker node.</span></p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">global proc int <span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Converter_otherPicker</span>_isPickerNode(string $node); &nbsp; //return 0~1 value, indicating &nbsp;the node is of the picker node.</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">global proc string <span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Converter_otherPicker</span>_getNamespace(string $node); &nbsp; //return the namespace from a picker node. </p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;"><span style="width:48px;display:inline-block">&nbsp;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//The proc is used in find&amp;Load feature of MG-Picker studio.</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">global proc string[] <span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Converter_otherPicker</span>_nodeLister(); //list all the picker nodes in the scene.</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">global proc int <span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Converter_otherPicker</span>_readNode(string $node); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//the actual reader for each picker node.</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">&nbsp;</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">//other picker file converter API: &nbsp; &nbsp; &nbsp; &nbsp;</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">global proc int <span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Converter_otherPicker</span>_isPickerFile(string $fileFullPath); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//Return 1 if the file is the picker file, 0 if not. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;">global proc int <span class="f_Heading1" style="font-size: 10pt; font-weight: normal;">Converter_otherPicker</span>_readFile(string $fileFullPath); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//the actual reader for each picker file.</p>
<p class="p_Normal" style="line-height: 1.80; margin: 0 0 0 48px;"><span style="width:48px;display:inline-block">&nbsp;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p>
</td></tr></table>
<table height="30" width="100%" border="0" cellspacing="" cellpadding="0" bgcolor="#D0D0D0">
<tr valign="bottom" bgcolor="#D0D0D0" >
<td align="left" valign="middle" >
<a href="welcome.htm"><img border="0" src="../common/images/MGtoolsHelp_Home.gif" width="34" height="22" alt="Home" /></a>
<a href="commandbuttonpresets.htm"><img border="0" src="../common/images/MGtoolsHelp_previous.gif" width="34" height="22" alt="Previous" /></a>
<a href="codesnippets.htm"><img border="0" src="../common/images/MGtoolsHelp_next.gif" width="34" height="22" alt="Next" /></a></td>
</tr>
</table>
</body>
</html>