FAQ: Application

Threading

What operations must be executed from the main thread?

The following operations must only be executed from the main application thread:

  • any GUI operation.
  • any operation that changes the currently active BaseDocument.

For details see Cinema 4D Threads Manual.

How can I execute code from the main thread?

There are multiple ways to trigger the execution of code from the main thread:

See Core Messages Manual and BaseDocument Manual.

Note
If the active document is edited from a GeDialog one must call StopAllThreads().

GUI

Can I use different GUI systems like Qt?

Other GUI systems like Qt are not supported. It is advised to only use the Cinema 4D GUI and application framework.

How does drag and drop work?

It is possible to handle drag and drop events in different scenarios:

How can I display an image in the GUI?

To display an image in a GeDialog one can create a custom GeUserArea that simply draws the image. Another solution is to use a bitmap button GUI widget (BitmapButtonCustomGui).

How can I draw in the viewport?

One can implement several "Draw" functions of various plugin types to draw in the viewport. See Draw Manual. One should only draw in the viewport using the BaseDraw class, see BaseView / BaseDraw Manual.

Note
It is only allowed to draw in such "Draw" functions.

Additionally the SceneHookData plugin type allows to change how objects are drawn by implementing SceneHookData::DisplayControl().

Files

How do I read and write files?

Files can be accessed using file streams. See InputStream Manual and OutputStream Manual.

Media files are handled using media sessions, see Media Sessions Manual.

How do I download a file from the web?

A file can be downloaded using a InputStream. See InputStream Manual.