Hi,
It's true that the sweep nurbs is not there in the example. Supporting it is easy, at least once you know how to ^^'
in the file alien_def.h you must add a class to support the SweepNurb
class AlienSweepObjectData : public NodeData
{
INSTANCEOF(AlienSweepObjectData, NodeData)
public:
virtual Bool Execute();
};
And of course you need to implement it and retrieve all the parameter you need.
Bool AlienSweepObjectData::Execute()
{
BaseObject* op = (BaseObject*)GetNode();
Char* pChar = op->GetName().GetCStringCopy();
if (pChar)
{
printf("\n - AlienExtrudeObjectData (%d): %s\n", (int)op->GetType(), pChar);
DeleteMem(pChar);
}
else
printf("\n - AlienExtrudeObjectData (%d): <noname>\n", (int)op->GetType());
GeData splineScaleParameter;
op->GetParameter(SWEEPOBJECT_SPLINESCALE, splineScaleParameter);
if (splineScaleParameter.GetType() == CUSTOMDATATYPE_SPLINE)
{
SplineData* splineData = static_cast<SplineData*>(splineScaleParameter.GetCustomDataType(CUSTOMDATATYPE_SPLINE));
if (splineData != nullptr)
{
Int32 knotCount = splineData->GetKnotCount();
printf("\n - number of knots %d \n", (int)knotCount);
}
}
return false;
}
Now, to make the object getting supported, you must add a case in the function NodeData *AllocAlienObjectData(Int32 id, Bool &known, BaseList2D* node)
like so:
case Osweep:
m_data = NewObj(AlienSweepObjectData);
break;
Now that the object is getting called you can retrieve all the data you want from it. This parameter is storing SplineData type. In our "regular" sdk (available with all c4d build in the main directory you have a zip archive) we have an example on how to retrieve or set SplineData. The file is in the directory "gui" and is called "objectdata_descriptions.cpp"
// somewhere in objectdata_descriptions.cpp
node->GetParameter(DescID(ID_DYNAMIC_ELEMENT + DESCRIPTIONELEMENTS::SPLINE), data, DESCFLAGS_GET::NONE);
if (data.GetType() == CUSTOMDATATYPE_SPLINE)
{
SplineData* splineData = (SplineData*)data.GetCustomDataType(CUSTOMDATATYPE_SPLINE);
if (splineData != nullptr)
{
splineData->SetRange(0.0, 100.0, 0.1, 0.0, 100, 0.0);
splineData->DeleteAllPoints();
splineData->InsertKnot(0, 0);
splineData->InsertKnot(100, 100);
// set parameter
node->SetParameter(DescID(ID_DYNAMIC_ELEMENT + DESCRIPTIONELEMENTS::SPLINE), data, DESCFLAGS_SET::NONE);
}
}
Finally, to retrieve an ID of a parameter you can drag and drop it on the console
For the sweep object you are interested by SWEEPOBJECT_SPLINESCALE
and SWEEPOBJECT_SPLINEROTATION
let me know if i forgot something or if it is not clear.
Cheers,
Manuel