#include <maya/MPxLocatorNode.h>
#include <maya/MFnPlugin.h>
#include <maya/MFnEnumAttribute.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnTypedAttribute.h>
#include <maya/MFnStringData.h>
#include <maya/MFnPointArrayData.h>
#include <maya/MPointArray.h>
#include <maya/MUintArray.h>
#include <maya/MDrawRegistry.h>
#include <maya/MPxDrawOverride.h>
#include <maya/MUserData.h>
#include <algorithm>
{
public:
enum EuiType {
kText,
kLine,
kPoint,
kRect,
kQuad,
kSphere,
kCircle,
kArc,
kLineList,
kPointList,
kLineStrip,
kIcon,
kCone,
kBox
};
public:
uiDrawManager();
virtual ~uiDrawManager();
static void* creator();
static MObject aPrimitiveTransparency;
static MObject aWorldViewportConverter;
static MObject aTextBoxTransparency;
public:
static MString drawDbClassification;
};
MObject uiDrawManager::aSelectability;
MObject uiDrawManager::aPrimitiveColor;
MObject uiDrawManager::aPrimitiveTransparency;
MObject uiDrawManager::aWorldViewportConverter;
MObject uiDrawManager::aTextAlignment;
MObject uiDrawManager::eTextIncline;
MObject uiDrawManager::aTextWeight;
MObject uiDrawManager::aTextStretch;
MObject uiDrawManager::aTextBoxSize;
MObject uiDrawManager::aTextBoxColor;
MObject uiDrawManager::aTextBoxTransparency;
MObject uiDrawManager::aTextFontSize;
MObject uiDrawManager::aFontFaceName;
MObject uiDrawManager::aLineStartPoint;
MObject uiDrawManager::aLineEndPoint;
MObject uiDrawManager::aRectNormal;
MObject uiDrawManager::aQuadVertex[4];
MObject uiDrawManager::aCircleNormal;
MObject uiDrawManager::aConeDirection;
MObject uiDrawManager::aConeHeight;
MTypeId uiDrawManager::id(0x0008002A);
MString uiDrawManager::drawDbClassification(
"drawdb/geometry/uiDrawManager");
MString uiDrawManager::drawRegistrantId(
"uiDrawManagerPlugin");
uiDrawManager::uiDrawManager() {}
uiDrawManager::~uiDrawManager() {}
void* uiDrawManager::creator()
{
return new uiDrawManager();
}
{
public:
uiDrawManagerData();
virtual ~uiDrawManagerData() {};
uiDrawManager::EuiType fUIType;
float fLineWidth;
bool fIsFilled;
bool fShaded;
bool fXRay;
double fRadius;
bool fDraw2D;
bool fWorldViewportConverter;
unsigned int fTextFontSize;
unsigned int fFontFaceIndex;
int fTextIncline;
int fTextWeight;
int fTextStretch;
int fTextLine;
int fTextBoxWidth;
int fTextBoxHeight;
float fPointSize;
double fRectScaleX;
double fRectScaleY;
float fIconScale;
unsigned int fIconIndex;
double fConeHeight;
};
uiDrawManagerData::uiDrawManagerData() :
MUserData(false)
, fUIType(uiDrawManager::kText)
, fColor(1.0f, 0.0f, 0.0f, 1.0f)
, fLineWidth(2.0f)
, fIsFilled(false)
, fShaded(false)
, fXRay(false)
, fRadius(1.0)
, fDraw2D(false)
, fPosition(0.0, 0.0, 0.001)
, fWorldViewportConverter(false)
, fText("uiDrawManager-Text")
, fFontFaceIndex(0)
, fTextLine(0)
, fTextBoxWidth(0)
, fTextBoxHeight(0)
, fTextBoxColor(0.0f, 1.0f, 1.0f, 1.0f)
, fPointSize(2.0f)
, fLineStartPoint(0.0, 0.0, 0.0)
, fLineEndPoint(1.0, 1.0, 1.0)
, fRectUp(0.0, 1.0, 0.0)
, fRectNormal(0.0, 0.0, 1.0)
, fRectScaleX(1.0)
, fRectScaleY(1.0)
, fCircleNormal(0.0, 0.0, 1.0)
, fArcStart(1.0, 0.0, 0.0)
, fArcEnd(0.0, 1.0, 0.0)
, fArcNormal(0.0, 0.0, 1.0)
, fIconScale(1.0f)
, fConeDirection(0.0, 0.0, 1.0)
, fConeHeight(1.0)
, fBoxUp(0.0, 0.0, 1.0)
, fBoxRight(0.0, 1.0, 0.0)
, fBoxScale(1.0, 1.0, 1.0)
{
fQuadVertex[0] =
MPoint(0.0, 0.0, 0.0);
fQuadVertex[1] =
MPoint(1.0, 0.0, 0.0);
fQuadVertex[2] =
MPoint(1.0, 1.0, 0.0);
fQuadVertex[3] =
MPoint(0.0, 1.0, 0.0);
}
{
public:
{
return new uiDrawManagerDrawOverride(obj);
}
virtual ~uiDrawManagerDrawOverride();
protected:
private:
uiDrawManagerDrawOverride(
const MObject& obj);
};
uiDrawManagerDrawOverride::uiDrawManagerDrawOverride(
const MObject& obj)
{
}
uiDrawManagerDrawOverride::~uiDrawManagerDrawOverride()
{
}
DrawAPI uiDrawManagerDrawOverride::supportedDrawAPIs()
const
{
return (kOpenGL | kDirectX11 | kOpenGLCoreProfile);
}
bool uiDrawManagerDrawOverride::isBounded(
const MDagPath& ,
{
return false;
}
{
}
MUserData* uiDrawManagerDrawOverride::prepareForDraw(
{
uiDrawManagerData* data = dynamic_cast<uiDrawManagerData*>(oldData);
if (!data) {
data = new uiDrawManagerData();
}
if (status) {
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aUIType);
data->fUIType = (uiDrawManager::EuiType)plug.asInt();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aSelectability);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aPrimitiveColor);
nData.getData(data->fColor.r, data->fColor.g, data->fColor.b);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aPrimitiveTransparency);
data->fColor.a = 1.0f - plug.asFloat();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aLineWidth);
data->fLineWidth = plug.asFloat();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aLineStyle);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aIsFilled);
data->fIsFilled = plug.asBool();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aShaded);
data->fShaded = plug.asBool();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aXRay);
data->fXRay = plug.asBool();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aRadius);
data->fRadius = plug.asDouble();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aDraw2D);
data->fDraw2D = plug.asBool();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aWorldViewportConverter);
data->fWorldViewportConverter = plug.asBool();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aPosition);
nData.getData(data->fPosition.x, data->fPosition.y, data->fPosition.z);
data->fPosition.w = 1.0f;
}
switch (data->fUIType)
{
case uiDrawManager::kText:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aText);
data->fText = plug.asString();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextFontSize);
data->fTextFontSize = std::max(plug.asInt(), 0);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aFontFaceName);
data->fFontFaceIndex = (unsigned int)plug.asInt();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextAlignment);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::eTextIncline);
data->fTextIncline = plug.asInt();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextWeight);
data->fTextWeight = plug.asInt();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextStretch);
data->fTextStretch = plug.asInt();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextLine);
data->fTextLine = plug.asInt();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextBoxSize);
nData.getData(data->fTextBoxWidth, data->fTextBoxHeight);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextBoxColor);
nData.getData(data->fTextBoxColor.r, data->fTextBoxColor.g, data->fTextBoxColor.b);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aTextBoxTransparency);
data->fTextBoxColor.a = 1.0f - plug.asFloat();
}
break;
case uiDrawManager::kPoint:
case uiDrawManager::kPointList:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aPointSize);
data->fPointSize = plug.asFloat();
}
if (data->fUIType == uiDrawManager::kPoint)
{
data->fPoints.clear();
data->fPoints.append( data->fPosition );
}
else
{
unsigned int divisionCount = 50;
double ddivisionCount = 100.0 / (double)divisionCount;
data->fPoints.clear();
for (unsigned int i=0; i<=divisionCount; i++)
{
for (unsigned int j=0; j<=divisionCount; j++)
{
for (unsigned int k=0; k<=divisionCount; k++)
{
MPoint delta(
double(i)*ddivisionCount,
double(j)*ddivisionCount,
double(k)*ddivisionCount);
newPoint = data->fPosition + delta;
data->fPoints.append( newPoint );
}
}
}
}
break;
case uiDrawManager::kLine:
case uiDrawManager::kLineList:
case uiDrawManager::kLineStrip:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aLineStartPoint);
nData.getData(data->fLineStartPoint.x, data->fLineStartPoint.y, data->fLineStartPoint.z);
data->fLineStartPoint.w = 1.0f;
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aLineEndPoint);
nData.getData(data->fLineEndPoint.x, data->fLineEndPoint.y, data->fLineEndPoint.z);
data->fLineEndPoint.w = 1.0f;
}
if (data->fUIType == uiDrawManager::kLine)
{
data->fLines.clear();
data->fLines.append( data->fLineStartPoint );
data->fLines.append( data->fLineEndPoint );
}
else
{
unsigned int divisionCount = 50;
double ddivisionCount = 100.0 / (double)divisionCount;
data->fLines.clear();
for (unsigned int i=0; i<=divisionCount; i++)
{
for (unsigned int j=0; j<=divisionCount; j++)
{
for (unsigned int k=0; k<=divisionCount; k++)
{
MPoint delta(
double(i)*ddivisionCount,
double(j)*ddivisionCount,
double(k)*ddivisionCount);
newPoint = data->fLineStartPoint + delta;
data->fLines.append( newPoint );
newPoint = data->fLineEndPoint + delta;
data->fLines.append( newPoint );
}
}
}
}
break;
case uiDrawManager::kRect:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aRectUp);
nData.getData(data->fRectUp.x, data->fRectUp.y, data->fRectUp.z);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aRectNormal);
nData.getData(data->fRectNormal.x, data->fRectNormal.y, data->fRectNormal.z);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aRectScale);
nData.getData(data->fRectScaleX, data->fRectScaleY);
}
break;
case uiDrawManager::kQuad:
{
for (int i = 0; i < 4; ++i)
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aQuadVertex[i]);
nData.getData(data->fQuadVertex[i].x, data->fQuadVertex[i].y, data->fQuadVertex[i].z);
}
}
break;
case uiDrawManager::kCircle:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aCircleNormal);
nData.getData(data->fCircleNormal.x, data->fCircleNormal.y, data->fCircleNormal.z);
}
break;
case uiDrawManager::kArc:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aArcStart);
nData.getData(data->fArcStart.x, data->fArcStart.y, data->fArcStart.z);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aArcEnd);
nData.getData(data->fArcEnd.x, data->fArcEnd.y, data->fArcEnd.z);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aArcNormal);
nData.getData(data->fArcNormal.x, data->fArcNormal.y, data->fArcNormal.z);
}
break;
case uiDrawManager::kSphere:
break;
case uiDrawManager::kIcon:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aIconName);
data->fIconIndex = (unsigned int)plug.asInt();
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aIconScale);
data->fIconScale = std::max(plug.asFloat(), 1.0f);
}
break;
case uiDrawManager::kCone:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aConeDirection);
nData.getData(data->fConeDirection.x, data->fConeDirection.y, data->fConeDirection.z);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aConeHeight);
data->fConeHeight = std::max(plug.asFloat(), 0.0f);
}
break;
case uiDrawManager::kBox:
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aBoxUp);
nData.getData(data->fBoxUp.x, data->fBoxUp.y, data->fBoxUp.z);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aBoxRight);
nData.getData(data->fBoxRight.x, data->fBoxRight.y, data->fBoxRight.z);
}
{
MPlug plug(uiDrawManagerNode, uiDrawManager::aBoxScale);
nData.getData(data->fBoxScale.x, data->fBoxScale.y, data->fBoxScale.z);
}
break;
default:
perror("unhandled ui type.");
break;
}
}
return data;
}
void uiDrawManagerDrawOverride::addUIDrawables(
{
const uiDrawManagerData* thisdata = dynamic_cast<const uiDrawManagerData*>(data);
if (!thisdata) {
return;
}
switch (thisdata->fUIType)
{
case uiDrawManager::kText:
{
MString faceName = uiDrawManagerData::fFontList[thisdata->fFontFaceIndex];
int boxSize[] = { thisdata->fTextBoxWidth, thisdata->fTextBoxHeight };
if (thisdata->fWorldViewportConverter)
{
if (thisdata->fDraw2D)
{
double x = thisdata->fPosition.x, y = thisdata->fPosition.y;
double viewX, viewY;
char buff[128];
worldPos = (worldFarPt - worldPos) * 0.01 + worldPos;
sprintf(buff, "(%.2lf %.2lf)->(%.2lf, %.2lf, %.2lf)", x, y,
worldPos.
x, worldPos.
y, worldPos.
z);
drawManager.
text(worldPos, buff, thisdata->fTextAlignment,
boxSize[0]+boxSize[1] == 0 ? NULL : boxSize, &thisdata->fTextBoxColor, false);
printf("2D: (%.2lf %.2lf)->(%.2lf, %.2lf, %.2lf)->(%.2lf, %.2lf)\n", x, y,
worldPos.
x, worldPos.
y, worldPos.
z, viewX, viewY);
}
else
{
double x, y;
char buff[128];
sprintf(buff, "(%.2lf, %.2lf, %.2lf)->(%.2lf %.2lf)", thisdata->fPosition.x,
thisdata->fPosition.y, thisdata->fPosition.z, x, y);
drawManager.
text2d(
MPoint(x, y), buff, thisdata->fTextAlignment,
boxSize[0]+boxSize[1] == 0 ? NULL : boxSize, &thisdata->fTextBoxColor, false);
printf("3D: (%.2lf, %.2lf, %.2lf)->(%.2lf %.2lf)->(%.2lf, %.2lf, %.2lf)\n", thisdata->fPosition.x,
thisdata->fPosition.y, thisdata->fPosition.z, x, y, worldPt.
x, worldPt.
y, worldPt.
z);
}
}
else
{
if (thisdata->fDraw2D)
{
drawManager.
text2d(thisdata->fPosition, thisdata->fText, thisdata->fTextAlignment,
boxSize[0]+boxSize[1] == 0 ? NULL : boxSize, &thisdata->fTextBoxColor, false);
}
else
{
drawManager.
text(thisdata->fPosition, thisdata->fText, thisdata->fTextAlignment,
boxSize[0]+boxSize[1] == 0 ? NULL : boxSize, &thisdata->fTextBoxColor, false);
}
}
}
break;
case uiDrawManager::kLine:
case uiDrawManager::kLineList:
case uiDrawManager::kLineStrip:
{
if (thisdata->fUIType == uiDrawManager::kLineStrip)
drawManager.
lineStrip(thisdata->fLines, thisdata->fDraw2D);
else
drawManager.
lineList(thisdata->fLines, thisdata->fDraw2D);
}
break;
case uiDrawManager::kPoint:
case uiDrawManager::kPointList:
{
drawManager.
points(thisdata->fPoints, thisdata->fDraw2D);
}
break;
case uiDrawManager::kRect:
{
MUIDrawManager::kShaded : MUIDrawManager::kFlat);
if (thisdata->fXRay)
if (thisdata->fDraw2D) {
drawManager.
rect2d(thisdata->fPosition, thisdata->fRectUp,
thisdata->fRectScaleX, thisdata->fRectScaleY, thisdata->fIsFilled);
}
else {
drawManager.
rect(thisdata->fPosition, thisdata->fRectUp, thisdata->fRectNormal,
thisdata->fRectScaleX, thisdata->fRectScaleY, thisdata->fIsFilled);
}
if (thisdata->fXRay)
}
break;
case uiDrawManager::kQuad:
{
thisdata->fIsFilled ? MUIDrawManager::kTriStrip : MUIDrawManager::kClosedLine;
for (int i = 0; i < 4; ++i) {
position.
append(thisdata->fQuadVertex[i]);
}
MUIDrawManager::kShaded : MUIDrawManager::kFlat);
if (thisdata->fXRay)
if (thisdata->fDraw2D) {
drawManager.
mesh2d(mode, position, NULL, thisdata->fIsFilled ? &index : NULL);
}
else {
drawManager.
mesh(mode, position, NULL, NULL, thisdata->fIsFilled ? &index : NULL);
}
if (thisdata->fXRay)
}
break;
case uiDrawManager::kSphere:
{
MUIDrawManager::kShaded : MUIDrawManager::kFlat);
if (thisdata->fXRay)
drawManager.
sphere(thisdata->fPosition, thisdata->fRadius, thisdata->fIsFilled);
if (thisdata->fXRay)
}
break;
case uiDrawManager::kCircle:
{
MUIDrawManager::kShaded : MUIDrawManager::kFlat);
if (thisdata->fXRay)
if (thisdata->fDraw2D) {
drawManager.
circle2d(thisdata->fPosition, thisdata->fRadius,
thisdata->fIsFilled);
}
else {
drawManager.
circle(thisdata->fPosition, thisdata->fCircleNormal, thisdata->fRadius,
thisdata->fIsFilled);
}
if (thisdata->fXRay)
}
break;
case uiDrawManager::kArc:
{
MUIDrawManager::kShaded : MUIDrawManager::kFlat);
if (thisdata->fXRay)
if (thisdata->fDraw2D) {
drawManager.
arc2d(thisdata->fPosition, thisdata->fArcStart, thisdata->fArcEnd,
thisdata->fRadius, thisdata->fIsFilled);
}
else {
drawManager.
arc(thisdata->fPosition, thisdata->fArcStart, thisdata->fArcEnd,
thisdata->fArcNormal, thisdata->fRadius, thisdata->fIsFilled);
}
if (thisdata->fXRay)
}
break;
case uiDrawManager::kIcon:
{
MString iconName = uiDrawManagerData::fIconList[thisdata->fIconIndex];
if (thisdata->fXRay)
drawManager.
icon(thisdata->fPosition, iconName, thisdata->fIconScale);
if (thisdata->fXRay)
}
break;
case uiDrawManager::kCone:
{
MUIDrawManager::kShaded : MUIDrawManager::kFlat);
if (thisdata->fXRay)
drawManager.
cone(thisdata->fPosition,
thisdata->fConeDirection,
thisdata->fRadius,
thisdata->fConeHeight,
thisdata->fIsFilled);
if (thisdata->fXRay)
}
break;
case uiDrawManager::kBox:
{
MUIDrawManager::kShaded : MUIDrawManager::kFlat);
if (thisdata->fXRay)
drawManager.
box(thisdata->fPosition,
thisdata->fBoxUp,
thisdata->fBoxRight,
thisdata->fBoxScale[0],
thisdata->fBoxScale[1],
thisdata->fBoxScale[2],
thisdata->fIsFilled);
if (thisdata->fXRay)
}
break;
default:
perror("unhandled ui types.");
break;
}
}
MStatus uiDrawManager::initialize()
{
aUIType = eAttr.
create(
"uiType",
"ut", uiDrawManager::kText);
eAttr.
addField(
"text", uiDrawManager::kText);
eAttr.
addField(
"line", uiDrawManager::kLine);
eAttr.
addField(
"point", uiDrawManager::kPoint);
eAttr.
addField(
"rect", uiDrawManager::kRect);
eAttr.
addField(
"quad", uiDrawManager::kQuad);
eAttr.
addField(
"sphere", uiDrawManager::kSphere);
eAttr.
addField(
"circle", uiDrawManager::kCircle);
eAttr.
addField(
"arc", uiDrawManager::kArc);
eAttr.
addField(
"line list", uiDrawManager::kLineList);
eAttr.
addField(
"line strip", uiDrawManager::kLineStrip);
eAttr.
addField(
"point list", uiDrawManager::kPointList);
eAttr.
addField(
"icon", uiDrawManager::kIcon);
eAttr.
addField(
"cone", uiDrawManager::kCone);
eAttr.
addField(
"box", uiDrawManager::kBox);
aSelectability = eAttr.
create(
"selectability",
"st", MUIDrawManager::kAutomatic);
eAttr.
addField(
"NonSelectable", MUIDrawManager::kNonSelectable);
eAttr.
addField(
"Selectable", MUIDrawManager::kSelectable);
eAttr.
addField(
"Automatic", MUIDrawManager::kAutomatic);
aLineStyle = eAttr.
create(
"lineStyle",
"ls", MUIDrawManager::kSolid);
eAttr.
addField(
"solid", MUIDrawManager::kSolid);
eAttr.
addField(
"shortdotted", MUIDrawManager::kShortDotted);
eAttr.
addField(
"shortdashed", MUIDrawManager::kShortDashed);
eAttr.
addField(
"dashed", MUIDrawManager::kDashed);
eAttr.
addField(
"dotted", MUIDrawManager::kDotted);
unsigned int nFont = MUIDrawManager::getFontList(uiDrawManagerData::fFontList);
if (nFont == 0)
{
perror("No font available!");
}
aFontFaceName = eAttr.
create(
"fontFaceName",
"ffn", 0);
for (unsigned int i = 0; i < nFont; i++)
{
MString str = uiDrawManagerData::fFontList[i];
}
aTextAlignment = eAttr.
create(
"textAlignment",
"ta", MUIDrawManager::kLeft);
eAttr.
addField(
"left", MUIDrawManager::kLeft);
eAttr.
addField(
"center", MUIDrawManager::kCenter);
eAttr.
addField(
"right", MUIDrawManager::kRight);
eTextIncline = eAttr.
create(
"textIncline",
"tic", MUIDrawManager::kInclineNormal);
eAttr.
addField(
"normal", MUIDrawManager::kInclineNormal);
eAttr.
addField(
"italic", MUIDrawManager::kInclineItalic);
aTextWeight = eAttr.
create(
"textWeight",
"tw", MUIDrawManager::kWeightBold);
eAttr.
addField(
"light", MUIDrawManager::kWeightLight);
eAttr.
addField(
"normal", MUIDrawManager::kWeightNormal);
eAttr.
addField(
"demiBold", MUIDrawManager::kWeightDemiBold);
eAttr.
addField(
"bold", MUIDrawManager::kWeightBold);
eAttr.
addField(
"black", MUIDrawManager::kWeightBlack);
aTextLine = eAttr.
create(
"textLine",
"tl", 0);
eAttr.
addField(
"overline", MUIDrawManager::kLineOverline);
eAttr.
addField(
"underline", MUIDrawManager::kLineUnderline);
eAttr.
addField(
"strikeout", MUIDrawManager::kLineStrikeoutLine);
double defaultPosition[4][3] =
{
{0.0, 0.0, 0.0},
{1.0, 0.0, 0.0},
{1.0, 1.0, 0.0},
{0.0, 1.0, 0.0}
};
for (int i = 0; i < 4; ++i)
{
nAttr.
setDefault(defaultPosition[i][0], defaultPosition[i][1], defaultPosition[i][2]);
}
aIconName = eAttr.
create(
"icon",
"i", 0 );
unsigned int iconCount = MUIDrawManager::getIconNames(uiDrawManagerData::fIconList);
for (unsigned int i=0; i<iconCount; i++)
{
MString str = uiDrawManagerData::fIconList[i];
}
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerNode(
"uiDrawManager",
uiDrawManager::id,
&uiDrawManager::creator,
&uiDrawManager::initialize,
&uiDrawManager::drawDbClassification);
if (!status) {
status.
perror(
"registerNode");
return status;
}
uiDrawManager::drawDbClassification,
uiDrawManager::drawRegistrantId,
uiDrawManagerDrawOverride::Creator);
if (!status) {
status.
perror(
"registerDrawOverrideCreator");
return status;
}
return status;
}
{
status = MDrawRegistry::deregisterGeometryOverrideCreator(
uiDrawManager::drawDbClassification,
uiDrawManager::drawRegistrantId);
if (!status) {
status.
perror(
"deregisterGeometryOverrideCreator");
return status;
}
status = plugin.deregisterNode( uiDrawManager::id );
if (!status) {
status.
perror(
"deregisterNode");
return status;
}
return status;
}