Create small visual helper

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/07/2008 at 08:52, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.5 
Platform:      Mac OSX  ; 
Language(s) :     C++  ;

---------
Hi!

I created a node-object and would like to create a small helper.

For example a circle, square like the TP Storm Generator. I thought of ObjectData, but I don't want to include it in the objectmanager.

Thanks and bye 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/07/2008 at 09:08, xxxxxxxx wrote:

Do you mean a 'helper' as in a visual aid in the View? You'll need to implement the SceneDraw() method I would think (similar to ObjectData::Draw()).

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/07/2008 at 10:54, xxxxxxxx wrote:

Hi!

Thanks! Yes, that can help me. Do I have to override this function? I try to print out something to the console i(n the function), but nothing happens.

Bye 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/07/2008 at 11:17, xxxxxxxx wrote:

Yes, you have to override the function and do the drawing with help of the BaseDraw instance provided. Unfortunately, I have no idea how the GvOperatorData::SceneDraw() works. If you continue to get no calls to the method, Matthias may need to chime in. GvNodeMaster::AddToDrawList() looks interesting but not much detail on how that works in conjunction with SceneDraw().

Here's the override for one of my plugin objects:

// ObjectData.Draw
//*---------------------------------------------------------------------------*
Bool IPPBase::Draw(PluginObject* op, LONG drawpass, BaseDraw* bd, BaseDrawHelp* bh)
//*---------------------------------------------------------------------------*
{
     if (!(op && bd && bh))     return TRUE;

// Draw 'Bone' in general
     if          (drawpass == DRAWPASS_OBJECT)
     {
          bbc =                    op->GetDataInstance();
          if (!bbc)               return TRUE;
          // Draw Bone or not
          if (!bbc->GetBool(IPP_SHOWBONE))     return TRUE;
          BaseDocument*     doc =     op->GetDocument();
          if (!doc)                    return TRUE;
          root =                         bbc->GetObjectLink(IPP_ROOT, doc);
          if (!root)                    return TRUE;
          // Show Root bones differently
          if (bbc->GetBool(IPP_ISROOT) || root->GetTag(ID_IPPOBJECTTAG))
          {
               Matrix     mg =     bh->GetMg();
               bd->SetPen(Vector(1.0f,1.0f,0.0f));
               mg.v1 =               Vector(epBBlen,0.0f,0.0f);
               mg.v2 =               Vector(0.0f,epBBlen,0.0f);
               bd->Circle3D(mg);
               mg.v1 =               Vector(0.0f,0.0f,epBBlen);
               mg.v2 =               Vector(0.0f,epBBlen,0.0f);
               bd->Circle3D(mg);
               mg.v1 =               Vector(epBBlen,0.0f,0.0f);
               mg.v2 =               Vector(0.0f,0.0f,epBBlen);
               bd->Circle3D(mg);
          }
          else
          {
               // To avoid origin clipping of entire draw using: bd->DrawPolygonObject(bh, boneObj, DRAWPOLYOBJECT_LOCALMATRIX);
               boneObj->SetMg(bh->GetMg());
               boneObj->Message(MSG_UPDATE);
               bd->DrawPolygonObject(bh, boneObj, 0L);
          }
     }
     // Draw Basic Data when selected
     else if (drawpass == DRAWPASS_HANDLES)
     {
          bbc =                    op->GetDataInstance();
          if (!bbc)               return TRUE;
          // Origin-EndPoint
          Matrix     mg =          bh->GetMg();
          // Origin cross-hairs
          bd->SetPen(Vector(0.0f,1.0f,0.0f));
          bd->Line3D(Vector(-lenBB, 0.0f, 0.0f)*mg, Vector(lenBB, 0.0f, 0.0f)*mg);
          bd->Line3D(Vector(0.0f, -lenBB, 0.0f)*mg, Vector(0.0f, lenBB, 0.0f)*mg);
          bd->Line3D(Vector(0.0f, 0.0f, -lenBB)*mg, Vector(0.0f, 0.0f, lenBB)*mg);
          // Line between Origin-EndPoint
          bd->SetPen(Vector(1.0f,1.0f,0.0f));
          bd->Line3D(Vector(0.0f,0.0f,0.0f)*mg, epBB*mg);
          // EndPoint cross-hairs
          bd->SetPen(Vector(1.0f,0.0f,0.0f));
          bd->Line3D(Vector(epBB.x-lenBB, epBB.y, epBB.z)*mg, Vector(epBB.x+lenBB, epBB.y, epBB.z)*mg);
          bd->Line3D(Vector(epBB.x, epBB.y-lenBB, epBB.z)*mg, Vector(epBB.x, epBB.y+lenBB, epBB.z)*mg);
          bd->Line3D(Vector(epBB.x, epBB.y, epBB.z-lenBB)*mg, Vector(epBB.x, epBB.y, epBB.z+lenBB)*mg);
     }
     return SUPER::Draw(op, drawpass, bd, bh);
}

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/07/2008 at 13:31, xxxxxxxx wrote:

Hi!

Thanks for the code snippet, but I can't solve it... I will try it again, tomorrow.. 😕

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/07/2008 at 13:46, xxxxxxxx wrote:

i couldn't give up.. it works 🙂

kuroyume.. you are the best... bye