Scripted Rendering
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/03/2004 at 15:17, xxxxxxxx wrote:
What do you refer to?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/03/2004 at 17:19, xxxxxxxx wrote:
Mikael,
To be more specific the Modal Render function in the link <[URL-REMOVED]>. There is a RenderThread class that is of the type Thread, and when you call RenderDocument you use the variant of the function that was removed in 8.5. I was just wondering how you to get that function to work with the other variant of the RenderDocument function. The major difference is that the function uses a BaseThread instead of a Thread. I couldn't get the code to work with a BaseThread. Thanks for your quick response!
Nate
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/03/2004 at 18:38, xxxxxxxx wrote:
Thread::Get() will return the BaseThread of this thread.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/03/2004 at 20:36, xxxxxxxx wrote:
Thanks Samir that did compile but now I get an application error when I use the code on 8.5 but not on 8.2. I am not sure why though.
Nate -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2004 at 03:17, xxxxxxxx wrote:
Can you show the RenderDocument line you are now using?
Samir -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2004 at 10:54, xxxxxxxx wrote:
I don't have the code infront of me but believe the line looks as follows. If its not I will post an update.
RenderDocument(m_dlg->m_doc, m_dlg->m_rdata,
ProgressFunction, m_dlg,
m_dlg->m_bmp,
uni_showerrors, this->Get());
this is a Thread class
Nate -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2004 at 11:30, xxxxxxxx wrote:
you need to use the other RenderDocument function (seems you use the old one). It should look something like this:
RenderDocument(doc,rdata,RenderProgress,NULL,bm,FALSE,Get()) -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2004 at 12:28, xxxxxxxx wrote:
What is the main difference between the way you use it and the way I use it? This may be a stupid question but I don't see how they are different.
RenderDocument(doc,rdata,RenderProgress,NULL,bm,FALSE,Get())
RenderDocument(m_dlg->m_doc, m_dlg->m_rdata,
ProgressFunction, m_dlg,
m_dlg->m_bmp,
uni_showerrors, this->Get());
m_dlg->m_doc = doc, m_dlg->m_rdata = rdata, ProgressFunction = RenderProgress, NULL is m_dlg, m_dlg->m_bmp = bm, uni_showerrors = FALSE, this->Get = Get() -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2004 at 15:01, xxxxxxxx wrote:
Well I just realized what is going on, I have a problem rendering when I use a different plugin I created and that is making the C4D crash for some reason. The suggestion you gave me above does work. Now I just have to figure out why the other object plugin crashes C4D when I render either the way above or to the picture viewer. It also only happens when I place objects into the plugin object. I may need to relook at the SDK for information about how to create an object plugin, maybe there is something in there about rendering plugin objects. Thanks again for all your help you were very helpful!
Nate -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2004 at 18:13, xxxxxxxx wrote:
Sorry, I haven´t seen your m_dlg parameter you passed. My fault. It´s the same function of course then.
Hope you find the problem. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2004 at 20:59, xxxxxxxx wrote:
Thanks Mikael - this gives me a bit to chew on.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2004 at 16:11, xxxxxxxx wrote:
Ok - I have given Mikael's example a try. I did get the basic rendering to work but with two problems.
The first is that the changes I make to rdata seem to be ignored and it just goes ahead and uses the render settings from the scene such as framefrom, frametwo, filename, etc.
The second is that c4d crashes unless I comment out the line
ShowBitmap(pd->bmp);
in the progress function.#include "c4d.h" #include "c4d_symbols.h" struct MyPrivateData { String* cam; BaseBitmap* bmp; }; void MyProgressHook(Real p, void* private_data) { StatusSetBar(p); MyPrivateData* pd = static_cast<MyPrivateData*>(private_data); StatusSetText("Rendering \"" + *pd->cam + "\"..."); //ShowBitmap(pd->bmp); } class RenderMenuTest : public CommandData { public: virtual Bool Execute(BaseDocument *doc); }; Bool RenderMenuTest::Execute(BaseDocument *doc) { RenderData* rd = doc->GetActiveRenderData(); BaseContainer rdata = rd->GetData(); rdata.SetTime(RDATA_FRAMEFROM, BaseTime(12, doc->GetFps())); rdata.SetTime(RDATA_FRAMETO, BaseTime(15, doc->GetFps())); GePrint("Start frame: " + LongToString( rdata.GetTime( RDATA_FRAMEFROM ).GetFrame(30) ) ); GePrint("End frame: " + LongToString( rdata.GetTime( RDATA_FRAMETO ).GetFrame(30) ) ); const LONG N = 1; for (LONG i = 1; i <= N; ++i) { AutoAlloc<BaseBitmap> bmp; if (!bmp) break; bmp->Init(rdata.GetLong(RDATA_XRES), rdata.GetLong(RDATA_YRES)); String cam = "cam" + LongToString(i); BaseObject* cobj = doc->SearchObject(cam); if (!cobj) break; doc->GetRenderBaseDraw()->SetSceneCamera(cobj); rdata.SetFilename(RDATA_PATH, doc->GetDocumentPath() + Filename(cam) + doc->GetDocumentName()); GePrint("Filename: " + rdata.GetFilename(RDATA_PATH).GetFileString()); MyPrivateData pd; pd.cam = &cam; pd.bmp = bmp; if (RenderDocument(doc, rdata, MyProgressHook, &pd;, bmp, TRUE, NULL) != RAY_OK) { MessageDialog("Unable to write file..."); break; } } StatusClear(); MessageDialog("RENDER FINISHED!"); return TRUE; } Bool RegisterRenderMenuTest(void) { // decide by name if the plugin shall be registered - just for user convenience String name=GeLoadString(IDS_RENDERMENUTEST); if (!name.Content()) return TRUE; // be sure to use a unique ID obtained from www.plugincafe.com return RegisterCommandPlugin(1888956,name,0,"icon.tif","C++ SDK Rnder Menu Test Plugin",gNew RenderMenuTest); }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2004 at 05:51, xxxxxxxx wrote:
The ShowBitmap line in the code above crashes c4d on a dual processor G5 but not on a single processor G4.
On the dual machine, it displays the rendering with one processor until the other processor would join in (with the second scan line) then it crashes.
Is there something that needs to be done to use ShowBitmap on a dual processor machine?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/03/2004 at 05:04, xxxxxxxx wrote:
OK - I slogged my through it (is there any other way!)
Of the two problems I encountered, the first was that the camera FROMFRAME and TOFRAME attributes of the rdata BaseContainer seemed to have no effect. I went into the scene and changed Frame option in the "Output" section of the render dialog from "All Frames" to "Manual" and that seemed to do it. I guess that can also be set programatically with the RDATA_FRAMESEQUENCE container id.
The next problem of the crashing with the dual processor when it hit ShowBitmap was resolved as I went for the more sophisticated GeModalDialog subclass example that Mikael pointed to. Perhaps a separate thread was the necessary addition?
In any case it is all working now with the help of Mikael's ModalRenderer. Thanks Mikael!
There were a couple of things that had to be modified with the recent SDK. The original code is here:
[URL-REMOVED]and the modifications are:
The GeUserArea can now only be gotten by:gadgetarea = AddUserArea(PREVIEW_AREA_ID, 0, m_bmp->GetBw(), m_bmp->GetBh()); if (gadgetarea) AttachUserArea(ua,gadgetarea);
and AttachImage(PREVIEW_AREA_ID, m_bmp, 0);
no longer works so you have to sublass GeUserArea and define the draw command to draw the bitmap:void RenderPreviewUserArea::Draw(LONG x1,LONG y1,LONG x2,LONG y2) { LONG w = bmp->GetBw(); LONG h = bmp->GetBh(); DrawBitmap(bmp,0,0,w,h,0,0,w,h,0); }
Where bmp is a member variable of the RenderPreviewUserArea subclass.
Finally, in the GeModalDialog subclass, GetUserArea is no longer valid but the user area is now a member of the dialog subclass (was set by AttachUserArea in the dialog layout). So the UpdatePreview becomes:
// Tell the preview to redraw itself void UpdatePreview() { // GeUserArea* ua = GetUserArea(PREVIEW_AREA_ID); ua.Redraw(TRUE); }
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/03/2004 at 18:40, xxxxxxxx wrote:
Thanks for reporting back. I'm sure your results will be useful to future forum readers!