2017-01-13 32 views
0

現在のimagePlaneに読み込まれたimageFileにアクセスする必要があるMaya C++プラグインを作成しています。私はプラグインを書きましたが、imagePlanesを使って正常に反復することができましたが、imagePlaneに読み込まれたimageFileを取得する方法はわかりません。ロード中のシーンのコールバックを持つプラグインを作成しましたが、imagePlanesを繰り返し処理していますが、imagePlaneにロードされたイメージのファイル名を取得するにはどうすればいいですか?現在のimagePlaneに読み込まれたimageFileへのMaya C++プラグインのアクセス

void MayaExtractCalDataPlugin::sceneLoaded(void* clientData) 
{ 
    // Store the pointer to the current class 
    MayaExtractCalDataPlugin* crntPlugin = (MayaExtractCalDataPlugin*)clientData; 

    // We only enter the callback when isReadingFile() is false, as this indicates that all 
    // loading is complete. otherwise we would enter a whole series of callbacks when loading a scene 
    // with lots of references in. 
    if(!MFileIO::isReadingFile()) 
    { 
     // Traverse the scene and find image planes 
     // First we need to create an iterator to go through all image planes 
     MItDependencyNodes it(MFn::kImagePlane); 

     //iterate through all image planes 
     while(!it.isDone()) 
     { 

      // Get the imagePlane object 
      MStatus status; 
      MObject object = it.thisNode(&status); 

      ... 
     } 
    } 
} 

しかし、今、私はMObjectを持っていると私はそのimagePlaneを知っていることを、私はそれにロードされる画像ファイルを取得する方法がわからない:ここではsceneLoadedコールバックのための私のコードの一部です。あなたが提供することができる任意のヘルプの事前に感謝!

+0

MObjectをimagePlaneにキャストしようとしているようですね。 imagePlaneのデータ型は? – akousmata

+0

それは私の問題です、私はimagePlaneのデータ型を見つけることができません。 Python APIでは、MayaにはimagePlaneクラスがあります。それは私が必要とするものであり、C++ APIには何か同等のものがあると確信していますが、ドキュメントで見つけることはできません。私は何かが欠けているに違いない... – Muench

答えて

0

私はそれを理解しました!上記のコードの後に​​次の文を追加するだけで、すべてのimagePlaneメソッドと属性にアクセスできます。

 // attach a dependency node to the file node 
     MFnDependencyNode fn(object); 

     // get the attribute for the imageName path 
     MPlug imagePath = fn.findPlug("imageName"); 
関連する問題