玛雅C++;插件访问当前imagePlane上加载的imageFile 我正在编写一个玛雅C++插件,需要访问当前映像平面中加载的图像文件。我已经编写了插件,并且能够成功地遍历imagePlanes,但是我不知道如何获取加载到imagePlane上的imageFile。我已经编写了一个插件,它为正在加载的场景提供了一个回调,我正在成功地迭代imagePlanes,但是如何从那里开始将图像的文件名加载到imagePlane中呢?下面是我为sceneLoaded回调编写的部分代码: 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); ... } } }

玛雅C++;插件访问当前imagePlane上加载的imageFile 我正在编写一个玛雅C++插件,需要访问当前映像平面中加载的图像文件。我已经编写了插件,并且能够成功地遍历imagePlanes,但是我不知道如何获取加载到imagePlane上的imageFile。我已经编写了一个插件,它为正在加载的场景提供了一个回调,我正在成功地迭代imagePlanes,但是如何从那里开始将图像的文件名加载到imagePlane中呢?下面是我为sceneLoaded回调编写的部分代码: 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); ... } } },c++,plugins,maya,C++,Plugins,Maya,但是,现在我有了MObject,我知道它是一个imagePlane,我不知道如何获取加载到其中的imageFile。提前感谢您提供的任何帮助 我想出来了!我只需要在上述代码之后添加以下语句,就可以访问所有imagePlane方法和属性: // attach a dependency node to the file node MFnDependencyNode fn(object); // get the attribute for the im

但是,现在我有了MObject,我知道它是一个imagePlane,我不知道如何获取加载到其中的imageFile。提前感谢您提供的任何帮助

我想出来了!我只需要在上述代码之后添加以下语句,就可以访问所有imagePlane方法和属性:

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

        // get the attribute for the imageName path
        MPlug imagePath = fn.findPlug("imageName");

听起来你想把这个移动对象投射回一个图像平面?imagePlane的数据类型是什么?这是我的问题,我找不到imagePlane的数据类型。在Python API中,Maya有一个imagePlane类。这正是我所需要的,我确信在C++的API中有一些等价的东西,但是我在文档中找不到。我一定错过了什么。。。