Getting a RayLight from a BaseObject?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/05/2007 at 04:07, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10
Platform: Windows ;
Language(s) : C++ ;---------
Hello there!
Is there any way to get a RayLight that corresponds to a BaseObject of type Olight or is that only available to a shader plugin?
The example plugins (cinema4dsdk with all the stuff in it) only uses RayLight in some shading functions.
I searched the SDK help forum for RayLight, but all I found were some code snippets using GetParameter or something like that. I'm quite new to the C4D SDK, have just started yesterday evening, and I am trying to write a custom scene exporter, which should also be able to export the lights (or an approximation to them fitting in my "file format"), so it would be handy to just have the RayLight instead of having to somehow find out all the constants needed for GetParameter and stuff.
If there is no way to get a RayLight from a BaseObject of type Olight: Does anyone know where I could look up how to get all the light parameters from the "General" and "Details" tab in C4D? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/05/2007 at 01:18, xxxxxxxx wrote:
You can't get a Raylight from a BaseObject.
To get all the light parameters you have to use the GetParameter function. Here a little example how to get the light's Contrast.
GeData d; if(op->GetParameter(DescLevel(LIGHT_DETAILS_CONTRAST),d,0)) { Real brightness = d.GetReal(); GePrint(RealToString(brightness)); }
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/05/2007 at 02:43, xxxxxxxx wrote:
Weird.
After I checked in the SDK docs for something helpful about lights and did come up with nothing, except that GetParameter(...) requires those DescIDs which again require some constants I don't know yet, I just gave AllocRayLight(BaseObject* ) a shot and it seems to work just fine (at least for a BaseObject* with GetType() == Olight, of course) :('bo' is a BaseObject* with GetType() == Olight)
RayLight* rl = AllocRayLight(bo);
switch(rl->type)
{
//handle different light types
case RT_LT_OMNI:...
}all the members of 'rl' are what I would expect (tested it with one omni and one area light including falloff).
The reason why I didn't try that earlier was because I read in the forums that the parameter for AllocRaylight(...) had to be a RayLight anyway.
I guess the way I do it is not supposed to work then and I'm just lucky it did in my scenes so far?