ジャンプ先: 概要. 戻り値. フラグ. MEL 例.

概要

ls [-allPaths] [-assemblies] [-cameras] [-containerType string] [-containers] [-dagObjects] [-dependencyNodes] [-exactType string] [-flatten] [-geometry] [-ghost] [-head int] [-hilite] [-intermediateObjects] [-invisible] [-leaf] [-lights] [-live] [-lockedNodes] [-long] [-materials] [-noIntermediate] [-nodeTypes] [-objectsOnly] [-orderedSelection] [-partitions] [-persistentNodes] [-planes] [-preSelectHilite] [-readOnly] [-recursive boolean] [-referencedNodes] [-references] [-renderGlobals] [-renderQualities] [-renderResolutions] [-renderSetups] [-selection] [-sets] [-shapes] [-shortNames] [-showType] [-tail int] [-templated] [-textures] [-transforms] [-type string] [-undeletable] [-untemplated] [-visible] [object [object...]]

ls は 「元に戻す」が可能、「照会」が不可能「編集」が不可能 です。

ls コマンドでは、シーン内のオブジェクトの名前(およびオプションでタイプ名)が返されます。 ls は一般的に、名前(ワイルドカードを含む)またはタイプに基づいて、オブジェクトのフィルタ処理または突き合せを行うのに使用します。 デフォルトでは ls コマンドはシーン内のすべてのオブジェクトと突き合せを行いますが、-selection フラグを一緒に使用すると、選択したオブジェクトをフィルタリングまたはリスト表示することができます。-showType フラグを使用してタイプ名を要求すると、結果はオブジェクト名を挟んだ <オブジェクト, タイプ> の組み合わせで返されます。 内部ノード(例: itemFilter ノード)は、通常、シーン オブジェクトのみを返すようにフィルタリングされます。 ただし、ワイルドカードを使用すると、ワイルドカードに一致するすべてのノードが内部ノードも含めて表示されてしまいます。 たとえば、ls * の場合、内部ノードかどうかに関係なくすべてのノードがリスト表示されます。 Maya が relativeNames モードにある場合、ls コマンドはカレントのネームスペースに関連する名前を返し、ls * はカレントのネームスペースからリスト表示します。 詳細については、namespace コマンドの -relativeNames フラグを参照してください。

戻り値

string[]

フラグ

allPaths, assemblies, cameras, containerType, containers, dagObjects, dependencyNodes, exactType, flatten, geometry, ghost, head, hilite, intermediateObjects, invisible, leaf, lights, live, lockedNodes, long, materials, noIntermediate, nodeTypes, objectsOnly, orderedSelection, partitions, persistentNodes, planes, preSelectHilite, readOnly, recursive, referencedNodes, references, renderGlobals, renderQualities, renderResolutions, renderSetups, selection, sets, shapes, shortNames, showType, tail, templated, textures, transforms, type, undeletable, untemplated, visible
ロング ネーム(ショート ネーム) 引数型 プロパティ
-long(-l) create
DAG オブジェクトのフル パス名が返されます。デフォルトでは、最も短い固有の名前を返します。
-shortNames(-sn) create
アトリビュートのショート ネームが返されます。デフォルトでは、アトリビュートのロング ネームが返されます。
-head(-hd) int create
項目のリストの先頭から返されるエレメントの最大数を指定します。 注: それぞれの type フラグでは、最大でこの数の項目が返されます。複数の type フラグを指定すると、返される項目の数は、指定した値より多くなります。
-tail(-tl) int create
項目のリストの末尾から返されるエレメントの最大数を指定します。 注: それぞれの type フラグでは、最大でこの数の項目が返されます。複数の type フラグを指定すると、返される項目の数は、指定した値より多くなります。
-type(-typ) string createmultiuse
指定したタイプのすべてのオブジェクトがリストされます。このフラグは、コマンド ラインで複数回使用できます。注: このフラグに渡すタイプは、-showType フラグで返されるタイプ名と同じになります。注: Maya での一部の選択項目は、特定オブジェクト/データ タイプが関連しないので、このフラグでリストすると「untyped」が返されます。
このフラグは、-exactType フラグと一緒に使用できません。
-exactType(-et) string createmultiuse
指定したタイプのオブジェクトをすべてリストします。ただし、そのタイプの下層にあるオブジェクトはリストしません。このフラグは、コマンド ラインで複数回使用できます。注: このフラグに渡すタイプは、-showType フラグで返されるタイプ名と同じになります。
このフラグは、-type フラグと一緒に使用できません。
-containerType(-ct) string createmultiuse
指定のユーザ定義タイプを伴うリスト コンテナです。
このフラグは、-type または -exactType フラグと一緒に使用できません。
-showType(-st) create
オブジェクト名の後にタイプがリストされます。
-objectsOnly(-o) create
設定すると、オブジェクト名のみが返され、コンポーネントやアトリビュートは無視されます。
-selection(-sl) create
現在選択しているオブジェクトがリストされます。
-orderedSelection(-os) create
オブジェクトとコンポーネントを現在の選択順でリスト表示します。このフラグは、selectPref コマンドの -tso/trackSelectionOrder フラグの値に依存します。そのフラグが有効になっていなければ、このフラグは -sl/selection フラグと同じものを返します。
-live(-lv) create
現在ライブにしているオブジェクトがリストされます。
-hilite(-hl) create
コンポーネント選択で現在ハイライトされているオブジェクトがリストされます。
-preSelectHilite(-psh) create
プリ選択で現在ハイライトされているコンポーネントがリストされます。
-geometry(-g) create
ジオメトリ DAG オブジェクトがリストされます。
-dependencyNodes(-dep) create
ディペンデンシー ノードがリストされます(DAG オブジェクトを含む)。
-dagObjects(-dag) create
すべてのタイプの DAG オブジェクトがリストされます。オブジェクト名引数をコマンドに渡した場合、このフラグでは、指定したオブジェクトの下にすべての DAG オブジェクトがリストされます。
-leaf(-lf) create
DAG のすべてのリーフ ノードがリストされます。このフラグはモディファイアなので、-dag フラグと一緒に使用する必要があります。
-assemblies(-as) create
最上位レベルのトランスフォーム DAG オブジェクトがリストされます。
-allPaths(-ap) create
DAG 内にあるノードのすべてのパスがリストされます。このフラグは、-dag も指定した場合、またはオブジェクト名を指定した場合に限って動作します。
-transforms(-tr) create
トランスフォーム オブジェクトがリストされます。
-shapes(-s) create
シェイプ オブジェクトがリストされます。
-lights(-lt) create
ライトのシェイプがリストされます。
-cameras(-ca) create
カメラのシェイプがリストされます。
-planes(-pl) create
コンストラクション プレーンのシェイプがリストされます。
-partitions(-pr) create
パーティションがリストされます。
-sets(-set) create
セットがリストされます。
-textures(-tex) create
テクスチャがリストされます。
-materials(-mat) create
マテリアルまたはシェーディング グループがリストされます。
-renderQualities(-rq) create
指定したレンダー画質がリストされます。
-renderResolutions(-rr) create
レンダー解像度がリストされます。
-renderGlobals(-rg) create
レンダー グローバルがリストされます。
-renderSetups(-rs) create
-renderGlobals のエイリアス。
-nodeTypes(-nt) create
登録されているすべてのノード タイプがリストされます。
-readOnly(-ro) create
参照されたノードを返します。参照されたノードは読み取り専用です。 注: 廃止されました。「-referencedNodes」を使用してください。
-referencedNodes(-rn) create
参照されたノードを返します。参照されたノードは読み取り専用です。
-undeletable(-ud) create
削除できないノード(ロックされたノードを含む)を返します。削除できないノードは名前の変更もできません。
-lockedNodes(-ln) create
ロックされたノードを返します。これらのノードは削除も名前の変更もできません。ただし、ステータスは変更できます。
-persistentNodes(-pn) create
永続ノードを返します。これは「file」 > 「new」の後の Maya セッションでも存続するノードです。
-flatten(-fl) create
返されるオブジェクトのリストを平らにし、それぞれのコンポーネントを個別に識別できるようにします。
-visible(-v) create
可視 DAG ノードのみがリストされます。
-invisible(-iv) create
表示されない DAG ノードのみがリストされます。
-intermediateObjects(-io) create
中間 DAG ノードのみがリストされます。
-noIntermediate(-ni) create
中間以外の DAG ノードのみがリストされます。
-templated(-tm) create
テンプレート化 DAG ノードのみがリストされます。
-untemplated(-ut) create
テンプレート化が解除された DAG ノードのみがリストされます。
-ghost(-gh) create
ゴースト化オブジェクトがリストされます。
-recursive(-r) boolean create
true に設定すると、このコマンドはすべてのネームスペースから合致する名前を探します。false に設定すると、要求されたネームスペースだけから探します(たとえば「:」を含む名前を指定すると 、「ns1:pSphere1」) 。
-references(-rf) create
ファイルに関連するリファレンスをリストします。sharedReferenceNode や不明リファレンス ノードなどの特別なリファレンス ノードは除外します。
-containers(-con) create
コンテナをリストします。標準コンテナと dagContainers などの別のコンテナ タイプの 両方を含みます。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : 1 つのコマンドで複数回使用可能なフラグ

MEL 例

// create some objects to operate on and select them all.
// Note that there are two objects named circle1;
circle -n circle1; group; circle -n circle1;
sphere -n sphere1; group; instance;
select -ado;

// list all objects
ls;

// List all selected objects
ls -selection;

// List all hilited objects
ls -hilite;

// List last selected object
ls -selection -tail 1;

// List all objects named "sphere1". Note that since sphere1 is
// instanced, the command below lists only the first instance.
ls sphere1;

// To list all instances of sphere1, use the -ap/allPaths flag.
ls -ap sphere1;

// List all selected objects named "group*"
ls -sl "group*";

// List all geometry, lights and cameras in the DAG.
ls -geometry -lights -cameras;

// List all shapes in the dag.
ls -shapes;

// One thing to note is that it is better to always use the
// -l/long flag when listing nodes without any filter. This is
// because there may be two nodes with the same name (in this
// example, circle1). 'ls' will list the names of all the objects
// in the scene. Objects with the same name need a qualified
// path name which uniquely identifies the object. A command
// to select all objects such as "select `ls`" will fail because
// the object lookup can't resolve which "circle1" object is
// intended. To select all objects, you need the following:
// select `ls -l`;

// When trying to find a list of all objects of a specific
// type, one approach might be to list all objects and then
// use the nodeType command to then filter the list. As in:
// string  $allObjects[];
// string  $obj;
// $allObjects = `ls -l`;
// for ( $obj in $allObjects ) {
//     if ( `nodeType $obj` == "surfaceShape" ) {
//         print ($obj + "\n");
//     }
// }
//
// The problem with this is that 'nodeType' returns the
// most derived type of the node. In this example, "surfaceShape"
// is a base type for nurbsSurface so nothing will be printed.
// To do this properly, the -typ/type flag should be used
// to list objects of a specific type as in:
// $allObjects = `ls -type surfaceShape`;
// for ( $obj in $allObjects ) {
//     print ($obj + "\n");
// }

// List all geometry shapes and their types
ls -type geometryShape -showType;

// List all paths to all leaf nodes in the DAG
ls -dag -lf -ap;

// List all nodes below the selected node
ls -dag -ap -sl;

// List all dag nodes that are read-only (i.e. referenced nodes)
ls -dag -ro;

// List all ghosting objects
ls -ghost;

// List reference nodes associated with specific files
ls -references;

// List all reference nodes, including unknown and shared reference
// nodes
ls -type reference;

// Select some components and then get the list in both selected and numeric order
string $obj1[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
select -clear;
selectPref -trackSelectionOrder 1;

select ($obj1[0]+".f[100]");
select -add ($obj1[0]+".f[50:55]");
select -add ($obj1[0]+".f[0]");
select -add ($obj1[0]+".f[56:60]");

// regular -selection flag returns the components in compacted numeric order.
ls -selection;
// Result: pSphere1.f[0] pSphere1.f[50:60] pSphere1.f[100] //
// -orderedSelection flag returns the components in the order that we selected them.
ls -orderedSelection;
// Result: pSphere1.f[100] pSphere1.f[50:55] pSphere1.f[0] pSphere1.f[56:60] //

// turn off tracking when we are done
selectPref -trackSelectionOrder 0;