On 04/08/2013 at 12:31, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
---------
Please help.
I have a tag plugin.
Inside this tag plugin I have a spline GUI. Which is being created from the .res file.
I can create and edit the spline and it's points in this gizmo just fine. Using any of the sdk functions found in the "SplineData" page in the docs.
However.
I cannot figure out how use any of the sdk functions found in "SplineCustomGui" in the docs.
These are the things I'm trying to use on my gizmo:
class SplineCustomGui : public BaseCustomGui<CUSTOMGUI_SPLINE>
{
public:
void SetMessageFunctions(SplineControlMessages* pFuncs);
SplineData* GetSplineData(void);
Bool SetSpline(SplineData* pData);
void SetGridLineCountH(LONG l);
void SetGridLineCountV(LONG l);
LONG GetGridLineCountH() const;
LONG GetGridLineCountV() const;
void SetLabelText(String* strXMin = NULL, String* strXMax = NULL, String* strYMin = NULL, String* strYMax = NULL, String* strX = NULL, String* strY = NULL);
void SetCustomColor(Bool bSet = FALSE, Vector col = Vector(0.0,0.0,0.0));
void GetScreenPosition(const Vector& v, LONG& x, LONG& y) const;
void GetValue(const LONG x, const LONG y, Vector& v) const;
Bool Command(LONG id, const BaseContainer& msg);
};
Here is my code where I build my splineGUI:
Bool SplineTag::Init(GeListNode *node)
{
BaseTag *tag = (BaseTag* )node;
BaseContainer *data = tag->GetDataInstance();
GeData d(CUSTOMDATATYPE_SPLINE, DEFAULTVALUE); //Stores the data gotten from SplineData
SplineData *spd = (SplineData* )d.GetCustomDataType(CUSTOMDATATYPE_SPLINE); //Creates an instance of the SplineData class
if (!spd) return FALSE;
spd->SetUserCallback(mySplineCallBack, NULL); //Call to mySplineCallBack() to make it start running
CustomSplineKnot *knot1; //The first spline knot
CustomSplineKnot *knot2; //The second spline knot
spd->MakeLinearSplineLinear(2);
spd->SetRange(0.0, 100.0, 1.0, 0.0, 100.0, 1.0); //Set up the spline's range options
//Real xmin, Real xmax, Real xsteps, Real ymin, Real ymax, Real ysteps
//Set The first spline knot's position to 0,0,0
knot1 = spd->GetKnot(0);
knot1->vPos = Vector(0, 0, 0);
knot1->lFlagsSettings |= FLAG_KNOT_LOCK_X|ADD_KNOT_ADAPT_TANGENTS;
knot1->vTangentRight = Vector(5, 50, 0);
//Set The second spline knot's position to 100,100,0
knot2 = spd->GetKnot(1);
knot2->vPos = Vector(100, 100, 0);
knot2->lFlagsSettings |= FLAG_KNOT_LOCK_X|ADD_KNOT_ADAPT_TANGENTS;
knot2->vTangentLeft = Vector(-10, -10, 0);
data->SetData(MY_SPLINE, d); //Apply the setting frpm memory to the spline GUI gizmo to update the spline
////////////////// Up until this point. Everything is working as expected /////////////////////////////////
//Now lets try to access the splineGui itself and change it
//This is where things stop working
//What am I doing wrong?
SplineCustomGui *splGui = (SplineCustomGui* )data->GetCustomDataType(MY_SPLINE, CUSTOMDATATYPE_SPLINE); //NOTE: MY_SPLINE is the ID of my spline gui
splGui->SetGridLineCountV(22); //Change the number of vertical grid lines
LONG gv = splGui->GetGridLineCountV(); //Get the number of vertical grid lines
GePrint(LongToString(gv)); //<--Always returns zero?!!
//None of the other SplineCustomGui functions work either
//What am I doing wrong?
return TRUE;
}
How do we use this SplineCustomGui class?
-ScottA