How to assign target object to target expression.

On 26/02/2018 at 05:37, xxxxxxxx wrote:

I have created a camera and assigned it a  target expression.

TextureTag* textureTag = static_cast<TextureTag*>(camera->MakeTag(Ttargetexpression));
if (!textureTag)
return false;

I able to assign target object to the target expression using drag and drop but here I want to set target object through the C++ API. Please do the needful.:cry:

On 27/02/2018 at 07:39, xxxxxxxx wrote:


this is just a matter of setting the right parameter of the Target tag.

One option to find out about parameters is to simply drag the parameter (grab its name) to the Commandline (the input field below the Console). Another option is to check the resource files directly, in this case it's in <C4D install path>/resource/modules/c4dplugin/description/ttargetexpression.res, easily found if you know the ID of the entity (here Ttargetexpression) already.

So, with the above you get TARGETEXPRESSIONTAG_LINK. And then it's just a matter of tag->SetParameter(TARGETEXPRESSIONTAG_LINK, object, DESCFLAGS_SET_0).

One more note on your code, you shouldn't cast the Target tag into a Texture tag.

Last note, I moved this thread to the SDK Help forum, as you seem to prefer C++ instead of Python.

On 28/02/2018 at 05:23, xxxxxxxx wrote:

Thanks, Andreas Block, My problem is solved.