On 04/10/2016 at 06:14, xxxxxxxx wrote:
Hi,
actually I think, it's the wrong approach to change the user's preferences in this case. Instead, you should rather add a few lines of code, so your plugin works with Team Render nicely.
Please don't get angry, if I recap too many things you already know, I just want to make sure, I don't miss anything:
First of all, handle the messages MSG_GETALLASSETS, MSG_MULTI_CLEARSUGGESTEDFOLDER
and MSG_RENAMETEXTURES, while these are needed for "Save Project with Assets..." anyway, they are also used in a Team Render context.
Here are a few threads on this topic:
MSG_GETALLASSETS calls?
Weird filenames when using make project
TeamRender&MSG_MULTI_CLEARSUGGESTEDFOLDER
questions about network rendering.
I guess, up to this point there's probably not much new to you.
Now, you need to take care for the case, where the Team Render Clients are supposed to "Get Assets on Demand", in this case your plugin needs to take care of the situation, if running in a Team Render Client. Don't worry, it's actually pretty simple, although I have to apologize in advance, that it's currently documented a bit "sub-optimally".
Basically all you need to do is call NetRenderGetFileFromServer() on the document net render context retrieved via GetNetRenderDocumentContext(). You'd normally do this, when you want to load some external asset from disk. At that point, you check, if the asset is already there (ready to be loaded) or if it's still missing and needs to be requested from the Team Render Server.
For example like so:
// Checks, if fn already exists locally, otherwise the file will be requested from TRS and fn is changed to point to the file received from TRS
void GetTeamRenderAsset(BaseDocument* const doc, Filename& fn)
{
if (GeFExist(fn))
return;
NetRenderDocumentContext* const context = doc->GetNetRenderDocumentContext();
if (context == nullptr)
return;
Filename fnNet;
if (NetRenderGetFileFromServer(context->_service, fn.GetFile(), fnNet)) // NOTE: only filename (not path) is used to request the file from TRS
fn = fnNet;
}