创建指向 MFnMesh 的指针
Create a pointer to a MFnMesh
我正在尝试创建 接收 MFnMesh
指针 并对其执行操作的函数。
问题是我无法将我的MFnMesh
转换为指针,我认为问题不仅在于此class,还在于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
class,甚至 =45=] 具有 MFnBase
属性?我不知道我们不能做这种真正最新的过程..
我是 c++ 的新手,所以我可能犯了一个愚蠢的错误。
MFnBaseClass
不允许使用到指针的转换,相反,使用几乎相同的引用。有关详细信息,请参阅 References vs. Pointers。
我函数的正确签名是
void test(MFnMesh& meshFn)
而使用方法是
test(meshFn);
并且要在函数中使用引用,只需将其用作常规对象即可
void test(MFnMesh& meshFn){
MStatus status = MS::kSuccess;
MString csName("YOLOSWAQDAZD");
status = meshFn.createColorSetDataMesh(csName);
MCheckStatus(status,"Error creating new color set");
}
我正在尝试创建 接收 MFnMesh
指针 并对其执行操作的函数。
问题是我无法将我的MFnMesh
转换为指针,我认为问题不仅在于此class,还在于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
class,甚至 =45=] 具有 MFnBase
属性?我不知道我们不能做这种真正最新的过程..
我是 c++ 的新手,所以我可能犯了一个愚蠢的错误。
MFnBaseClass
不允许使用到指针的转换,相反,使用几乎相同的引用。有关详细信息,请参阅 References vs. Pointers。
我函数的正确签名是
void test(MFnMesh& meshFn)
而使用方法是
test(meshFn);
并且要在函数中使用引用,只需将其用作常规对象即可
void test(MFnMesh& meshFn){
MStatus status = MS::kSuccess;
MString csName("YOLOSWAQDAZD");
status = meshFn.createColorSetDataMesh(csName);
MCheckStatus(status,"Error creating new color set");
}