Issue with Target Expression tag

On 20/03/2018 at 10:48, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R19 
Platform:    Mac  ;  
Language(s) :     C++  ;

---------
In Target Expression tag not able to enable camera dependent option. In below code, I m creating a Target Expression tag for a camera.

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

Tag->SetParameter(TARGETEXPRESSIONTAG_LINK, TargetObj, DESCFLAGS_SET_0);

Tag->SetName("SetTarget");

On 21/03/2018 at 09:55, xxxxxxxx wrote:

As already mentioned in another thread of yours, you really shouldn't cast a Target expression tag into a Texture tag, rather treat it as a BaseTag.

The camera dependent option is part of the priority. PriorityData a custom data type (CUSTOMGUI_PRIORITY_DATA). So in order to modify this parameter the code looks for example like so:

	GeData d;
	targetTag->GetParameter(EXPRESSION_PRIORITY, d, DESCFLAGS_GET_0);
	PriorityData* prio = static_cast<PriorityData*>(d.GetCustomDataType(CUSTOMGUI_PRIORITY_DATA));
	prio->SetPriorityValue(PRIORITYVALUE_CAMERADEPENDENT, true);
	targetTag->SetParameter(EXPRESSION_PRIORITY, d, DESCFLAGS_SET_0);

On 22/03/2018 at 02:50, xxxxxxxx wrote:

Thank you so much.