THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/06/2011 at 10:58, xxxxxxxx wrote:
Sorry about not being clear.
I'm interested in learning more about custom GUI's like what Nux posted. But the spline GUI I'm talking about is the built in one(graph view) that comes with C4D.
I'm having problems creating my own simple spline control on my own tag.
-The first problem is I can't get the spline graph to show up.
-The second problem is because the number of knots is dynamic. I don't know how to get the values of the spline's knots. So I can use that information to control something in the scene.
Here's my tag plugin's .cpp code:
#include "c4d.h"
#include "c4d_symbols.h"
#include "tmyspline_GUI.h"
#include "c4d_graphview_enum.h"
#include "c4d_graphview.h"
#include "c4d_graphview_def.h"
#include "customgui_splinecontrol.h"
class MySplineTag : public TagData
{
INSTANCEOF(MySplineTag,TagData)
public:
virtual Bool Init(GeListNode *node);
virtual EXECUTIONRESULT Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags);
virtual void Free(GeListNode *node);
virtual Bool Message(GeListNode *node, LONG type, void *data);
static NodeData *Alloc(void) { return gNew MySplineTag; }
};
Bool MySplineTag::Init(GeListNode *node)
{
BaseContainer *bc=((BaseList2D* )node)->GetDataInstance();
bc->SetReal(MAX_VALUE, 10.0);
GeData d(CUSTOMDATATYPE_SPLINE, DEFAULTVALUE);
SplineData* p = (SplineData* )d.GetCustomDataType(CUSTOMDATATYPE_SPLINE);
if (p)
{
p->MakeLinearSpline(2);
p->SetRound(1.0);
}
bc->SetData(MYSPLINE, d);
return TRUE;
}
EXECUTIONRESULT MySplineTag::Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags)
{
BaseContainer *bc = op->GetDataInstance();
SplineData *myspline = (SplineData* )bc->GetCustomDataType(MYSPLINE, CUSTOMDATATYPE_SPLINE);
Real displace = bc->GetReal(MAX_VALUE);
if (myspline) GePrint("True");
return EXECUTIONRESULT_OK;
}
void MySplineTag::Free(GeListNode *node)
{
}
Bool MySplineTag::Message(GeListNode *node, LONG type, void *data)
{
return SUPER::Message(node,type,data);
}
//////////////////////////////////////////////////////////////////////////
#define PLUGIN_ID 10000011 // Testing ID ONLY!!!
Bool RegisterMySplineTag()
{
return RegisterTagPlugin(PLUGIN_ID, GeLoadString(IDS_MYSPLINE_GUI), TAG_MULTIPLE|TAG_VISIBLE, MySplineTag::Alloc,"tmyspline_GUI", AutoBitmap("myicon.tif"),0);
}
Here's the .h file:
#ifndef _Tmyspline_GUI_H_
#define _Tmyspline_GUI_H_
enum
{
MAX_VALUE = 2000,
MYSPLINE = 2001,
};
#endif
Here's the .res file
CONTAINER Tmyspline_GUI
{
NAME Tmyspline_GUI;
INCLUDE Texpression;
GROUP ID_TAGPROPERTIES
{
REAL MAX_VALUE { UNIT METER; MIN 0.0; }
SPLINE MYSPLINE
{
SHOWGRID_H;
SHOWGRID_V;
GRIDSIZE_H 8;
GRIDSIZE_V 8;
HAS_PRESET_BTN;
MINSIZE_H 120;
MINSIZE_V 90;
EDIT_H;
EDIT_V;
LABELS_H;
LABELS_V;
HAS_ROUND_SLIDER;
X_MIN 0;
X_MAX 100;
Y_MIN 0;
Y_MAX 100;
X_STEPS 1;
Y_STEPS 1;
}
}
}
Here's the .str file:
STRINGTABLE Tmyspline_GUI
{
Tmyspline_GUI "My spline GUI test";
MAX_VALUE "Max Spline Value";
MYSPLINE "My Spline's Shape";
}
Here's the strange part.
If I use this same code to edit one of the hair tag examples in the SDK. It's works and The graph and spline shows up. But when I try to build my own tag, without doing it inside of the cinema4dsdk. It doesn't show up. 
So I'm thinking that maybe I'm missing an include?
But I can't find it.
After I get the stupid thing to show up.
Then I have to tackle how to get the values of the spline's knots.
-ScottA