【发布时间】:2017-01-13 17:07:32
【问题描述】:
我正在编写一个 Maya C++ 插件,该插件需要访问当前 imagePlane 中加载的 imageFile。我已经编写了插件,并且能够成功地遍历 imagePlanes,但我不知道如何获取加载在 imagePlane 上的 imageFile。我已经编写了一个插件,该插件具有正在加载的场景的回调,并且我成功地遍历了 imagePlanes,但是我如何从那里继续获取加载到 imagePlane 中的图像的文件名?这是我的场景加载回调代码的一部分:
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,我不知道如何获取加载到其中的 imageFile。提前感谢您提供的任何帮助!
【问题讨论】:
-
听起来您正试图将 MObject 投射回 imagePlane? imagePlane 的数据类型是什么?
-
这是我的问题,我找不到 imagePlane 的数据类型。在 Python API 中,Maya 有一个 imagePlane 类。这正是我所需要的,而且我确信他们的 C++ API 中有一些等价的东西,但我在文档中找不到它。我一定是错过了什么......