Dialog spline

On 27/06/2013 at 10:39, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R14 
Platform:   Windows  ;   
Language(s) :     C++  ;

Hi Folks,

I've got myself a dialog spline gui, but I'm a bit lost as to where to put/add the data for it. Is this done in the GetDDescription()? And can the data be added or dynamically changed from elsewhere (another function)?

EDIT: this is what I tried inside the GetDDesctipion() :

SplineData* sData;   
MySpline->SetSpline(sData); // MySpline is the customgui element   
sData = NULL;   


On 27/06/2013 at 12:07, xxxxxxxx wrote:

You initialise the spline in your plugin's Init routine. Here's the complete initialisation function from one of the X-Particles' modifiers:

// this is called from ObjectData::Init()   
void XModSpeed::InitSpline(BaseContainer *data)   
     SplineData *spd = NULL;   
     CustomSplineKnot *knot;   
     spd = (SplineData* )d.GetCustomDataType(CUSTOMDATATYPE_SPLINE);   
          spd->SetRange(0.0, 1.0, 0.01, 0.0, 300.0, 1.0);   
          spd->MakeLinearSplineBezier(2);   // 2 knots   
          knot = spd->GetKnot(0);   
          knot->vPos = Vector(0.0, 150.0, 0.0);   
          knot->lFlagsSettings |= FLAG_KNOT_LOCK_X|ADD_KNOT_ADAPT_TANGENTS;   
          knot->vTangentRight = Vector(0.1, 0.0, 0.0);   
          knot = spd->GetKnot(1);   
          knot->vPos = Vector(1.0, 150.0, 0.0);   
          knot->lFlagsSettings |= FLAG_KNOT_LOCK_X|ADD_KNOT_ADAPT_TANGENTS;   
          knot->vTangentLeft = Vector(-0.1, 0.0, 0.0);   
          data->SetData(XMSP_SPEED_SPLINE, d); // replace the ID with your resource element   

The flag settings for the knots you can find in the SDK.

On 27/06/2013 at 13:41, xxxxxxxx wrote:

This brings up something that trips me up a lot with GeDialogs.
When you want to change a gizmo using a BaseContainer for a node based plugin. You simply grab the node. Then assign the BaseContainer to it like this:

    BaseTag  *tag  = (BaseTag* )node;  
  BaseContainer *data = tag->GetDataInstance();

Then when you want to change the gizmo (Like adding spline knots to it). You simply change the BaseContainer then updated those changes using SetData().

But when you're using a GeDialog to host the gizmo. There's no node to use. So you can't use the BaseContainer the same way as you use it on a node based plugin like tags and objects.
So even though I can add the SplineGUI gizmo itself to my GeDialog. I can't do anything to it like add any points to it. Because I don't know the dialog equivalent version of this code: BaseContainer *data = tag->GetDataInstance();

This trips me up all the time when using GeDialogs.


#Edit- Never mind. I've figured out how to get it working.