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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Team Render Server Bitmap Paths

    SDK Help
    0
    3
    323
    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
      Helper
      last edited by

      On 30/11/2014 at 22:00, xxxxxxxx wrote:

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

      ---------
      Hello Forum,

      I'm working on a tag plugin that samples a shader.  This plugin needs to be able to render over the network using Team Render Server and Team Render to Picture Viewer.  The plugin needs to be able to distinguish between Team Render Client and Cinema 4D running as a shared network machine.

      Here is the code I have so far:

      bitmapshader_filename = _shd_data->GetFilename( BITMAPSHADER_FILENAME );
      if ( bitmapshader_filename.Content() )
      {
          if ( IsNet() || IsClient )
          {
              Filename docpath = Filename( doc->GetDocumentPath() );
              Filename srcname = Filename( bitmapshader_filename.GetFile() );
              Filename netpath = docpath + srcname;
              _shd_data->SetFilename( BITMAPSHADER_FILENAME, netpath );
          }
          else
          {
              Filename docpath = Filename( doc->GetDocumentPath() );
              //GePrint( "docpath: " + docpath.GetString() );
              Filename srcname = Filename( bitmapshader_filename.GetFile() );
              //GePrint( "srcname: " + srcname.GetString() );
              Filename suggestedfolder = Filename( bitmapshader_filename.GetDirectory() );
              //GePrint( "suggestedfolder: " + suggestedfolder.GetString() );
              Filename dstname;
        
              Bool res = GenerateTexturePath( docpath, srcname, suggestedfolder, &dstname );
              if ( res )
              {
                  if ( ! GeFExist( dstname ) )
                  {
                      GePrint( "Could not generate Texture Path.  Check path to bitmap" );
                      return EXECUTIONRESULT_OK;
                  }
                  //GePrint( "dstname: " + dstname.GetString() );
                  _shd_data->SetFilename( BITMAPSHADER_FILENAME, dstname );
              }
              else
              {
                  GePrint( "Error locating bitmap image.  Check path to bitmap" );
                  return EXECUTIONRESULT_OK;
              }
          }
      }
      

      This code works with:

      1. Team Render Server only using Team Render Clients to render.
      2. Cinema 4D running "Render To Picture Viewer" without any Net.
      3. Cinema 4D with "Share Machine Over Network" turned off running "Team Render To Picture Viewer" using only Team Render Clients to render.

      It does not work with:

      1. Cinema 4D with "Share Machine Over Network" turned on while running "Team Render To Picture Viewer" also incorporating Team Render Clients in render.  The clients find frames, but C4D does not.
      2. Team Render Server using Cinema 4D with "Share Machine Over Network" turned on as a clinet. C4D cannot find frames.

      Is there a way to check if Cinema 4D is running as a shared network machine so the bitmap path can be adjusted accordingly?

      Perhaps there is a better way to handle bitmap paths so machine type checking is not needed?

      Thank you,

      Joe Buck

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

        On 01/12/2014 at 02:40, xxxxxxxx wrote:

        Hello,

        you can find out if the current document is rendered via TeamRender by checking if the NetRenderDocumentContext[URL-REMOVED] has a NetRenderService[URL-REMOVED]. In this case don't use a suggested folder but you can use the NetRenderService as an argument for GenerateTexturePath()[URL-REMOVED].

          
                  NetRenderDocumentContext* context = doc->GetNetRenderDocumentContext();  
          
                  if(context && context->_service)  
                  {  
                      Filename docpath = Filename( doc->GetDocumentPath() );  
                      Filename dest;  
                      GenerateTexturePath(docpath,"thefile.png","",&dest,context->_service);  
                  }  
        

        Let me know if this helps you.

        best wishes,
        Sebastian


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

          On 01/12/2014 at 09:37, xxxxxxxx wrote:

          Hi Sebastian,

          Your solution works perfectly.  My question is answered.

          Thanks for your help and super fast response.

          I'm seeing/experiencing the changes you guys are implementing in the forum and I really appreciate it.  Excellent work.

          Thank you,

          Joe Buck

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