【发布时间】:2016-06-06 09:19:55
【问题描述】:
我正在尝试创建接收MFnMesh 指针并在其上执行操作的函数。
问题是我无法将我的MFnMesh 转换为指针,我认为问题不仅在这个类上,而且在MFnBaseClass 上,因为我收到了这个错误。
/usr/autodesk/maya2015-x64/include/maya/MFnBase.h:168:14: error: ‘MFnMesh* MFnMesh::operator&() const’ is private
MFnClass * operator& () const
^
/usr/autodesk/maya2015-x64/include/maya/MFnDagNode.h:237:2: note: in expansion of macro ‘declareMinimalMFn’
declareMinimalMFn( MFnClass ); \
^
/usr/autodesk/maya2015-x64/include/maya/MFnMesh.h:243:2: note: in expansion of macro ‘declareDagMFn’
declareDagMFn(MFnMesh, MFnDagNode);
^
/home/k.masson/Documents/maya/km_extendedColorSet/src/km_particlesToColorSet.cpp:159:9: error: within this context
test(&meshFn);
^
这是somefile.h中的函数测试,包含在调用函数的文件中。
void test(MFnMesh * meshFn){
MStatus status = MS::kSuccess;
MString csName("YOLOSWAQDAZD");
status = meshFn->createColorSetDataMesh(csName);
MCheckStatus(status,"Error creating new color set");
}
这是我在调用test 函数之前所做的。
// Get the out mesh data
MDataHandle outMeshHandle = data.outputValue(aOutGeometry, &status);
MCheckStatus(status,"ERROR getting aOutGeometry");
// Copy the in mesh to the output
outMeshHandle.copy(inMeshData);
// Create a function set for the out mesh
MFnMesh meshFn(outMeshHandle.asMesh());
test(&meshFn);
我没有找到任何方法将我的MFnMesh 转换为指针,因此我尝试直接将其作为对象调用,而不是像这样的指针。
test(meshFn);
void test(MFnMesh meshFn){
MStatus status = MS::kSuccess;
MString csName("YOLOSWAQDAZD");
status = meshFn.createColorSetDataMesh(csName);
MCheckStatus(status,"Error creating new color set");
}
我明白了:
/usr/autodesk/maya2015-x64/include/maya/MFnMesh.h:243:16: error: ‘MFnMesh::MFnMesh(const MFnMesh&)’ is private
declareDagMFn(MFnMesh, MFnDagNode);
^
/usr/autodesk/maya2015-x64/include/maya/MFnBase.h:166:9: note: in definition of macro ‘declareMinimalMFn’
MFnClass( const MFnClass &rhs ); \
^
/usr/autodesk/maya2015-x64/include/maya/MFnMesh.h:243:2: note: in expansion of macro ‘declareDagMFn’
declareDagMFn(MFnMesh, MFnDagNode);
^
/home/k.masson/Documents/maya/km_extendedColorSet/src/km_particlesToColorSet.cpp:159:14: error: within this context
test(meshFn);
^
In file included from /home/k.masson/Documents/maya/km_extendedColorSet/src/km_particlesToColorSet.cpp:29:0:
/home/k.masson/Documents/maya/km_extendedColorSet/src/kmColorSetTool.h:29:6: error: initializing argument 1 of ‘void test(MFnMesh)’
void test(MFnMesh meshFn){
那么你知道是否有办法以时尚的方式创建一个作用于MFnBase 类的函数,甚至是一个具有MFnBase 属性的类?我不知道我们不能做这种真正流行的过程..
我是 C++ 新手,所以我可能犯了一个愚蠢的错误。
【问题讨论】:
-
好的,我找到了解决方案,但我不知道这是什么意思,我将签名更改为
MFnMesh& mesh,它可以工作
标签: c++ pointers maya maya-api