THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/11/2010 at 02:27, xxxxxxxx wrote:
the commandline example includes a complete example how to create and export a scene with melange sdk. the LoadSaveC4DScene() has a part of source code where where CreateSceneToC4D() is used. comment in the part after "// ... or save new created scene" of the example code (and comment out the part before where BaseDocument::CopyTo() is used intstead).
the function CreateSceneToC4D() calls the functions:
BuildMaterialToC4D()
BuildLayerToC4D()
BuildObjectsToC4D() -> CreateObjectToC4D
CreateObjectToC4D() shows the creation of polygon, null, camera, light and a few other objects. the creation of joints is not included yet.
here's a short example how to add a skin object, 2 joint objects and the weight tag to a document:
BaseDocument *newDoc = BaseDocument::Alloc();
if (!newDoc)
return FALSE;
// create and add polygon object here
BaseObject *mObj = BaseObject::Alloc(Opolygon);
// add points and polygons...
// ...
BaseTag *wTag = NULL;
if (mObj)
wTag = mObj->MakeTag(Tweights);
// add skin object
BaseObject *sObj = BaseObject::Alloc(Oskin);
if (sObj)
sObj->InsertUnder(mObj);
// add null object
BaseObject *nObj = BaseObject::Alloc(Onull);
if (nObj)
{
newDoc->InsertObject(nObj, NULL);
nObj->SetName("Root");
nObj->SetRelPos( Vector(0.0,-400.0,0.0) );
}
// add 2 joint objects
BaseObject *jObj1 = BaseObject::Alloc(Ojoint);
if (jObj1)
{
jObj1->InsertUnder(nObj);
jObj1->SetName("Joint.1");
jObj1->SetRelPos( Vector(0.0,0.0,0.0) );
}
BaseObject* jObj2 = BaseObject::Alloc(Ojoint);
if (jObj2)
{
jObj2->InsertUnder(jObj1);
jObj2->SetName("Joint.2");
jObj2->SetRelPos( Vector(0.0,450.0,0.0) );
}
if (wTag && jObj1 && jObj2)
{
((WeightTagData* )wTag->GetNodeData())->AddJoint(jObj1);
((WeightTagData* )wTag->GetNodeData())->AddJoint(jObj2);
}
// save the document and free the objects
// ...
jens