Hi All,
I have a custom MPxSurfaceShape node for which I want to implement intereactive selection. I referred to the devkit example and implemented it almost asis :
bool apiMeshUI::select( MSelectInfo &selectInfo, MSelectionList &selectionList,
MPointArray &worldSpaceSelectPts ) const
//
// Description:
//
// Main selection routine
//
// Arguments:
//
// selectInfo - the selection state information
// selectionList - the list of selected items to add to
// worldSpaceSelectPts -
//
{
bool selected = false;
if ( !selected ) {
apiMesh* meshNode = (apiMesh*)surfaceShape();
selected = true;
MSelectionMask priorityMask( MSelectionMask::kSelectObjectsMask);
MSelectionList item;
item.add( selectInfo.selectPath() );
MPoint xformedPt;
if ( selectInfo.singleSelection() ) {
MPoint center = meshNode->boundingBox().center();
xformedPt = center;
xformedPt *= selectInfo.selectPath().inclusiveMatrix();
}
selectInfo.addSelection( item, xformedPt, selectionList,
worldSpaceSelectPts, priorityMask, false );
}
return selected;
}
So, I only need object selection as you noticed. However, the problem I am facing is that maya is not selecting the correct object based on the depth order. For e.g. If there is a native maya mesh object in front of the custom shape, single-click selecting the mesh object still selects the custom shape that is behind it. Also, marquee selecting a custom shape and a mesh object results in only the custom shape getting selected. The custom shape gets selected correctly, this problem happens only when Maya needs to sort the custom shape with a native maya mesh.
It looks like the GL selection buffer always gives priority to the custom shape. I want know if any of you have faced this issue and if so has any of you figured out a solution for this?? Any thoughts or suggestion are welcome.
thanks in advance
Roko