how to save multil bitmap with render?



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

    On 30/07/2007 at 02:27, xxxxxxxx wrote:

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

    ---------
    I Want to render the animal and save to bitmap from each frame?
    how can I to do ?
    this my code advance:
    void ShadeAnimRender()
    {
     
     BaseDocument* doc = GetActiveDocument();
     BaseObject* null = doc->GetActiveObject();
        if (!null) return;
     
        RenderData* rd = doc->GetFirstRenderData();
     BaseContainer rdata = rd->GetData();
      
     rdata.SetData(RDATA_FRAMESEQUENCE,2);
     //// change 1 and 3 values to
     //// 0 for manual
     //// 1 for current frame
     //// 2 for all frames
     //// 3 preview range
     rdata.SetData(RDATA_SAVEIMAGE,1);
     ///////////////////////change 1 to
     ///////////////////////////// 0 for save off
     ///////////////////////////// 1 for save on
     rdata.SetFilename(RDATA_PATH, Filename(null->GetName()));
     LONG lngIndex = 0;
     for ( ; rd; rd->GetNext() ) //multi frame render loop for
     {
      if ( bRenderStop == TRUE )
      {//ABORT RENDER
       //BaseThread::TestBreak()
       break;
      }

    rd->SetData( rdata );
      doc->SetActiveRenderData( rd ); //delete this if console shows errors//
      EventAdd();

    BaseBitmap* bmp = BaseBitmap::Alloc();
      BaseBitmap* desbmp =  BaseBitmap::Alloc();
     
      bmp->Init(rdata.GetLong(RDATA_XRES),
        rdata.GetLong(RDATA_YRES));
     
      EventAdd(EVENT_FORCEREDRAW);

    RenderDocument(doc, rdata, NULL, NULL, bmp, TRUE , NULL);
     
      ////render to picture viewer
      //CallCommand( 12099 );
      if ( bmp )
      {
       bmp->ScaleBicubic( desbmp, 0, 0, bmp->GetBw(), bmp->GetBh(), 0, 0, 400, 400);
      }
         
            Filename strfilename( GeGetStartupPath() + "test_anim" +LongToString(lngIndex)+"jpg");
      bmp->Save( strfilename, FILTER_JPG , NULL,  SAVEBIT_32b*tchANNELS);
      BaseBitmap::Free( bmp);
      BaseBitmap::Free( desbmp );
     }

    }
     
    anyone can help with me to give me instance and modify the code?


Log in to reply