命令 (MEL/Python)
|
MGPickerService
|
跳转到: 概要. MEL例子. Python例子.
概要
MGPickerService (string, [cleanNamespaceMix=[string]],[getViewCoordinate=[string, float, float, float]], [modelEditorSize=string], [namespaceFromSelection=boolean], [namespace=string], [osLanguage=boolean],[resolvePath=string], [translate=string], [translate1=[string, string]], [translate2=[string, string, string]], [unzip=string], [zipFileFolder=string])
备注: Strings在使用zip相关标签时代表zip文件完整路径, 而参数则必须以逗号分隔。这是在概要里没有说明的。
MGPickerService不可撤消, 可以查询且可以编辑。
这个命令用来提供压缩及解压zip包,翻译,坐标转换等服务,主要供工具内部使用。
长名 (短名)
|
参数类型
|
属性
|
-cleanNamespaceMix(-cnm)
|
string
|

|
|
去除dag路径中没有带namespace的开头部分,如:
|path|to|myChar:control|myChar:subControl将变成myChar:control|myChar:subControl
而myChar:control|myChar:subControl|the|control将维持不变
|
|
-getViewCoordinate(-gvc)
|
string float float float
|

|
|
这个标签只能用于查询模式,用来获取指定世界坐标的屏幕坐标。您需要指定modelEditor名称及x,y,z世界坐标。
这个标签将返回一个整数数组,第一个元素是0或1, 代表坐标是否在modelEditor的屏幕范围内,其它两个整数元素分别是屏幕x, y坐标值。
|
|
-modelEditorSize(-mes)
|
string
|

|
|
这个标签只能用于查询模式,来获取指定modelEditor的长宽。
|
|
-namespaceFromSelection(-nfs)
|
boolean
|

|
|
从所选对象中获取其命名空间,指定True代表即使第一个所选物体没有包含命名空间,则往下找第二个,指定False则代表不管第一个有没有都返回.
|
|
-namespace(-ns)
|
string
|

|
|
-osLanguage(-osl)
|
|

|
|
这个标签只能用于查询模式,来获取当前操作系统偏向使用的语言名称。
|
|
-resolvePath(-rp)
|
string
|

|
|
将带环境变量的路径解析成实际的路径。环境变量由$或${}表示。
第一个参数需要指定要解析的路径,第二个参数是要解析的picker节点,这个是可选的,一般指定为空字符窜,只有当路径中含有 ${M_CURRENT_ASSET_DIR} 时需要指定。
|
|
-translate(-tr)
|
|

|
|
仅供内部使用,只能用于查询模式来获取指定字符窜id的翻译结果。
|
|
-translate1(-tr1)
|
string string
|

|
|
仅供内部使用,只能用于查询模式来获取指定字符窜id及替换字符窜的翻译结果。
|
|
-translate2(-tr2)
|
string string string
|

|
|
仅供内部使用,只能用于查询模式来获取指定字符窜id及2个替换字符窜的翻译结果。
|
|
-unzip(-uzp)
|
string
|

|
|
-zipFileFolder(-zip)
|
string
|
 
|
|
在查询模式下这个标签将列出目标zip包里所有的文件及文件夹。
在创建模式下,这个标签用于将指定目录或文件压缩成目标的zip档。
|
|
标签可以在创建模式中使用
|
标签可以在编辑模式中使用
|
标签可以在查询模式中使用
|
标签可以在一条命令中多次使用
|
MEL例子
//zip the folder into a zip package:
MGPickerService -zipFileFolder "D:/test" "D:/test.zip";
//list out the zip package content:
print "The contents in test.zip:\n";
print `MGPickerService -q -zip "D:/test.zip"`;
//unzip to another directory:
MGPickerService -unzip "D:/test/unzipped/" "D:/test.zip";
Python例子
from maya import cmds
cmds.MGPickerService("D:/test.zip", zipFileFolder="D:/test")
#list out the zip package content:
print ("The contents in test.zip:\n")
print (cmds.MGPickerService("D:/test.zip", q=True,zip=True))
#unzip to another directory:
cmds.MGPickerService("D:/test.zip", unzip="D:/test/unzipped/")
|