void MG_vectorGL::draw( M3dView & view, const MDagPath & path, M3dView::DisplayStyle dispStyle, M3dView::DisplayStatus status ) { MPlug drawItP (thisMObject(),drawIt); bool drawItV; drawItP.getValue(drawItV); MPlug arrowSizeP (thisMObject(),arrowSize); double arrowSizeV; arrowSizeP.getValue(arrowSizeV); MPlug upVecP (thisMObject(),upVec); MVector upVecV; upVecP.child(0).getValue(upVecV.x); upVecP.child(1).getValue(upVecV.y); upVecP.child(2).getValue(upVecV.z); MPlug vecsP (thisMObject(),vecs); MPlug startPointP (thisMObject(),startPoint); int elemVecs = vecsP.numElements(); int elemPoints = startPointP.numElements(); if ( drawItV == 0 ) { return ; } if (elemVecs != elemPoints ) { return; } // Draw it view.beginGL(); glPushAttrib( GL_ALL_ATTRIB_BITS ); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glLineWidth(2); if(status == M3dView::kLead) glColor4f(0.0,1.0,0.0,1.0f); else glColor4f(1.0,1.0,0.0,1.0f); for ( unsigned int i = 0 ; i < elemVecs ; i++ ) { vecsP.selectAncestorLogicalIndex( i , vecs); startPointP.selectAncestorLogicalIndex( i , startPoint); MVector currentVec ; MPoint currentPoint; vecsP.child(0).getValue(currentVec.x); vecsP.child(1).getValue(currentVec.y); vecsP.child(2).getValue(currentVec.z); startPointP.child(0).getValue(currentPoint.x); startPointP.child(1).getValue(currentPoint.y); startPointP.child(2).getValue(currentPoint.z); drawArrow(currentVec , upVecV , arrowSizeV , currentPoint); } glDisable(GL_BLEND); glPopAttrib(); }