THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/08/2007 at 15:34, xxxxxxxx wrote:
Cinema 4D Version: 10.111
Language(s) : C++ ;
I'm converting some code over from COFFEE into C++. A similar setup worked in COFFEE, but I'm not having luck in C++...
I'm having trouble getting the Ambient Occlusion settings from the render dialog.
BaseDocument *bDoc = GetActiveDocument();
RenderData* rdata = bDoc->GetActiveRenderData();
BaseContainer* rdbc = rdata->GetDataInstance();
BaseContainer* rdao = rdbc->GetContainerInstance(RDATA_AMBIENTOCCLUSION);
GeData rdAOMinLength = rdao->GetData(AMBIENTOCCLUSIONSHADER_MINLENGTH);
I'm getting an error that AMBIENTOCCLUSIONSHADER_MINLENGTH has not been declared.
I'm just starting out in C++, and I'm not really sure where I'm going wrong.
Can anyone help sort me out?
On 30/08/2007 at 01:57, xxxxxxxx wrote:
You have to use GetReal() to get the MinLength of AO.
Real rdAOMinLength = rdao->GetReal(AMBIENTOCCLUSIONSHADER_MINLENGTH);
Unlike COFFEE you have to differentiate between variable types in C++. So for a length value you usally would use a Real. You can look up what kind of type you need in the xambientocclusion.res file. You also have to include the xambientocclusion.h file to your sourcecode to have access to the defines.
On 06/09/2007 at 22:24, xxxxxxxx wrote:
Thanks for the reply, Matthias.
Should I include the path to the xambientocclusion.res file in Cinema 4D, or should I copy that into my plug-in's resource directory, instead?
Right now, I'm including from the C4D directory, which works. Just not sure if that is a good programming practice.
On 07/09/2007 at 10:17, xxxxxxxx wrote:
It's better to just reference the include directory instead of moving all of the files to the project. Imagine working on twenty plugins and having a copy of the C4D resource folder for each one for each version of C4D! ;)
This is the correct practice: reference third party APIs from a stock location. Now, there is no problem copying the resource folder somewhere 'closer' to your project. I keep my projects on a data drive and that is where copies of the C4D resource folders and libraries are kept as well.