Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Hijacking the client

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 265 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 07/07/2010 at 07:26, xxxxxxxx wrote:

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

      ---------
      Hi all,

      We are currently developing a renderfarm which has to control various software packages and C4D should be one of them. Since there is no possibility to control the client via command line, i'm trying to write a plugin to take over control. The base functionality is to run a thread in the background and load / render a document on an external trigger. This works fine in the main application but not on the client.

      Here comes some code to show you my problem:

        
      // Here the listener thread is started and stopped when the program is opened/closed.  
      // BackboneListenerThread is derived from C4DThread and is described later  
      Bool PluginMessage(LONG id, void *data)  
      {  
          switch (id)  
          {  
              case C4DPL_PROGRAM_STARTED:  
                  // create and start listener thread  
                  backboneListener = gNew BackboneListenerThread();  
                  backboneListener->Start(TRUE);  
                  return TRUE;  
              case C4DPL_ENDACTIVITY:  
                  // stop and destroy listener thread  
                  backboneListener->End();  
                  gDelete(backboneListener);  
                  return TRUE;  
          }  
        
          return FALSE;  
      }  
        
      // This is the threads main method which is running in the background. It constantly tests  
      // for an external trigger. If the trigger occurs a given document loaded  
      // and the render process started.  
      void BackboneListenerThread::Main()  
      {  
          while (!this->TestBreak())  
          {  
              if (/* external trigger */)   
              {  
                  Filename fn(/* Filename from external source */);  
                  LoadFile(fn);  
        
                  // get document  
                  BaseDocument *doc = GetActiveDocument();  
                  if (!doc) continue;  
        
                  // get render data  
                  RenderData *rd = doc->GetActiveRenderData();  
                  if (!rd) continue;  
        
                  // create bitmap  
                  BaseBitmap *bm = BaseBitmap::Alloc();  
                  if (!dm) continue;  
        
                  // hardcode image dimensions for quick test  
                  bm->Init(320, 240);  
        
                  // start rendering  
                  RenderDocument(    doc,   
                                  rd->GetData(),   
                                  NULL,   
                                  NULL,   
                                  bm,   
                                  RENDERFLAG_EXTERNAL|RENDERFLAG_SHOWERRORS,   
                                  NULL    );  
              }  
          }  
      }  
      

      When executed on the client, RenderDocument() returns immediately with RAY_OK  and the console tells: "Stop rendering at <Date, Time>".

      This is the point where i can't figure out what the problem is and if it's possible what i'm trying to do. How can i use the client without the Server to cover our extended needs?

      Regards,
      Heinrich Löwe,
      Sehsucht GmbH, Hamburg, Germany.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 08/07/2010 at 03:10, xxxxxxxx wrote:

        When you talk about server and client do you mean the server and client applications of CINEMA NET Render?

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 08/07/2010 at 10:08, xxxxxxxx wrote:

          Yes i do.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post