Create ObjectData as Light Objects

On 21/11/2016 at 12:31, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R18 
Platform:   Windows  ;   
Language(s) :     C++  ;


I want to create an ObjectData plugin that will represent a Light source in my render engine.
There are 2 things that come in my mind but I'm not sure which is possible.

  1. Override (somehow) the Olight object and hide the unwanted parameters. Also, add as parameters anything else that I need.

  2. Create an ObjectData plugin and manually draw in the viewport the lines defined in Spot, Omni e.t.c.

Is there any example that I could use as reference ?

Thank you for your time.

On 22/11/2016 at 02:09, xxxxxxxx wrote:


it is not possible to "override" build-in object types. A third party renderer typically introduces a custom tag that can be added to a light object to provide additional parameters.

One can of course create an ObjectData based plugin that draws something in the viewport. This is done by implementing ObjectData::Draw(). You find some examples in the Draw Manual and the example projects like "Gravitation".

best wishes,

On 22/11/2016 at 05:24, xxxxxxxx wrote:


How can I make the ObjectData operate as light in the viewport ? 
I want to illuminate only specific parts of the scene and create shadows behind the other objects.

I add a GetVirtualObjects method in my ObjectData plugin and I return an Olight object. I can modify this Light Object using my Object Data parameters, but I cannot control it in the viewport.

The Cinema 4D spot light can be configured in the viewport using the dots that control the inner/outer angle. How can I create such viewport controls ?

Thank you again.

On 22/11/2016 at 08:33, xxxxxxxx wrote:


such "viewport controls" are called handles. They are implemented with GetHandleCount() / GetHandle() / SetHandle(). You find some examples in the SDK example project like the "Circle" example.

For questions no longer related to the thread's original topic please open a new thread. Thanks.

best wishes,