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.