LoginSignup
6
3

More than 5 years have passed since last update.

Load時にsceneに追加されたノードの取得方法

Posted at

日々低下する記憶力への明日への自分メモとして

pipelineのツールを作ってたりすると
import時やload時に追加されたノードをすぐに取得し処理をかけたいことが多々あります。
今までであれば、既存のノードのリストを事前に作って比較したりして非常にパワープレイなことを
していましたが(--;;

ふとドキュメントを眺めていると


returnNewNodes(rnn)

開く、読み込み、loadReference、とリファレンス操作の戻り値を制御するために使用します。現在のシーンに追加された新規ノードのリストを返す file コマンドを強制的に発行させます。

!?
まさかこんな便利なフラグが。。
ってかfileのフラグ多すぎてまともに見てすらいな。。
すみません

maya
import maya.cmds as cmds

file = "C:/user/test.mb"
print cmds.file(file,o=True,rnn=True,f=True)
[u'TurtleBakeLayerManager', u'TurtleDefaultBakeLayer', u'TurtleRenderOptions', u'TurtleUIOptions', u'bindPose1', u'groupId2', u'groupParts2', u'polySphere1', u'sceneConfigurationScriptNode', u'skinCluster1', u'skinCluster1GroupId', u'skinCluster1GroupParts', u'skinCluster1Set', u'tweak1', u'tweakSet1', u'uiConfigurationScriptNode', u'|joint1', u'|joint1|joint2', u'|joint1|joint2|joint3', u'|pSphere1', u'|pSphere1|pSphereShape1', u'|pSphere1|pSphereShape1Orig']

あぁー感動し過ぎて鼻水が出てしまいます。
ただ返されるノードは階層もくそもないので
ひと手間加える必要があるかと思いますが
大分処理の軽減化がされるかと思います。

6
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3