THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/09/2009 at 22:22, xxxxxxxx wrote:
when I build the project, it works but when I run c4d and select the tool, the viewport starts to freak out. and then it says it's out of memory. What I want is to draw a circle around the radius of the brush.
ANy thoughts as to why this owuld be happening?
Here's the code for all of Draw() whis includes the symmetry plane.
~Shawn
> `
\> LONG SculptTool::Draw(BaseDocument *doc, BaseContainer &data;, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt,LONG flags)
\> {
\> EditorWindow *win = bd->GetEditorWindow();
\>
\> PolygonObject *op = ToPoly(doc->GetActiveObject());
\> LONG lngMySymPlane =data.GetLong (MIRROR_PLANE);
\> LONG trans = 175;
\> Vector color = data.GetVector(PLANE_COLOR);
\>
\> LONG bRad = data.GetLong(BRUSH_RADIUS);
\> Real mx = data.GetReal(BFM_INPUT_X);
\> Real my = data.GetReal(BFM_INPUT_Y);
\> Real mz = data.GetReal(BFM_INPUT_Z);
\>
\> //DRAW THE CIRCLE AROUND THE MOUSE///////////////////////
\>
\> ViewportSelect* vps = ViewportSelect::Alloc();
\> if (!vps) return FALSE; //etc.
\>
\> LONG left, top, right, bottom, width, height;
\> bd->GetFrame(&left;, ⊤, &right;, ⊥);
\> width = right - left + 1;
\> height = bottom - top + 1;
\> Bool ov = true;
\>
\> vps->Init(width,height,bd,op,Mpolyedgepoint,ov,0); // MUST BE DONE!!!!
\> vps->ShowHotspot(win,mx,my);
\> vps->SetBrushRadius(bRad);
\> EventAdd(EVENT_FORCEREDRAW);
\>
\>
\> ////////////////////////////////////////////////////
\>
\>
\> //Matrix for determining scale, rotation, and position.
\> Matrix m = op->GetMg();
\> Vector rad = op->GetRad();
\>
\> m.v1 *= rad.x+100;
\> m.v2 *= rad.y+100;
\> m.v3 *= rad.z+100;
\>
\>
\> switch (lngMySymPlane)
\> {
\>
\> case Z_PLANE:
\>
\> if (data.GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.
\> {
\>
\> Vector p[4];
\>
\> p[0] = Vector(-1,-1,0);
\> p[1] = Vector(-1,1,0);
\> p[2] = Vector(1,1,0);
\> p[3] = Vector(1,-1,0);
\>
\> p[0] = p[0] * m;
\> p[1] = p[1] * m;
\> p[2] = p[2] * m;
\> p[3] = p[3] * m;
\>
\> Vector f[3] = { Vector(color),Vector(color),Vector(color)};
\>
\> bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);
\> bd->SetTransparency(trans);
\> bd->Polygon3D(p,f,TRUE);
\> EventAdd(EVENT_FORCEREDRAW);
\>
\>
\> return true;
\> }
\> else //If SHOW_PLANE is unchecked, stop drawing the polygon.
\> {
\> Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};
\> Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};
\> bd->Polygon3D(p,f,FALSE);
\> EventAdd(EVENT_FORCEREDRAW);
\> }
\>
\> return DRAW_HANDLES|DRAW_AXIS;
\> break;
\>
\> case X_PLANE:
\> if (data.GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.
\> {
\>
\> Vector p[4];
\>
\> p[0] = Vector(0,-1,-1);
\> p[1] = Vector(0,-1,1);
\> p[2] = Vector(0,1,1);
\> p[3] = Vector(0,1,-1);
\>
\> p[0] = p[0] * m;
\> p[1] = p[1] * m;
\> p[2] = p[2] * m;
\> p[3] = p[3] * m;
\>
\> Vector f[3] = { Vector(color),Vector(color),Vector(color)};
\>
\> bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);
\> bd->SetTransparency(trans);
\> bd->Polygon3D(p,f,TRUE);
\> EventAdd(EVENT_FORCEREDRAW);
\>
\> return true;
\> }
\> else //If SHOW_PLANE is unchecked, stop drawing the polygon.
\> {
\> Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};
\> Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};
\> bd->Polygon3D(p,f,FALSE);
\> EventAdd(EVENT_FORCEREDRAW);
\> }
\>
\> return DRAW_HANDLES|DRAW_AXIS;
\> break;
\>
\> case Y_PLANE:
\> if (data.GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.
\> {
\>
\> Vector p[4];
\>
\> p[0] = Vector(-1,0,-1);
\> p[1] = Vector(-1,0,1);
\> p[2] = Vector(1,0,1);
\> p[3] = Vector(1,0,-1);
\>
\> p[0] = p[0] * m;
\> p[1] = p[1] * m;
\> p[2] = p[2] * m;
\> p[3] = p[3] * m;
\>
\> Vector f[3] = { Vector(color),Vector(color),Vector(color)};
\>
\> bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);
\> bd->SetTransparency(trans);
\> bd->Polygon3D(p,f,TRUE);
\> EventAdd(EVENT_FORCEREDRAW);
\>
\> return true;
\> }
\> else //If SHOW_PLANE is unchecked, stop drawing the polygon.
\> {
\> Vector p[4] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};
\> Vector f[3] = { Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)};
\> bd->Polygon3D(p,f,FALSE);
\> EventAdd(EVENT_FORCEREDRAW);
\> }
\>
\> return DRAW_HANDLES|DRAW_AXIS;
\> break;
\> }
\> ViewportSelect::Free(vps);
\> return TRUE;
\> }
\>
`