Melange writing example?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/10/2010 at 12:26, xxxxxxxx wrote:

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

    ---------
    Is there a writing example of using the Melange library?  There are some bits and pieces in the commandline example,
    but it's not enough.  I'm looking for an complete example that fills empty document and writes it out? 
    Preferably, an example that uses joints.



  • 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



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/11/2010 at 15:06, xxxxxxxx wrote:

    Thanks!


Log in to reply