Team Render Server Bitmap Paths



  • 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



  • 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 has a NetRenderService. In this case don't use a suggested folder but you can use the NetRenderService as an argument for GenerateTexturePath().

      
              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



  • 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


Log in to reply