Description Tracks Not Updating

On 26/04/2014 at 12:44, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   13 
Language(s) :     C++  ;

This seems like a bug to me. I'm having a problem with setting key values using the description tracks.
When I change the values in the keys. Instead of using SetParameter() on the object. The object is not updating and using the key values properly.

This code should create an EditorVisibilty description track and animate the visibility option.
It creates the track and the two keys just fine. But the visibility key values are not being seen and used by the object.
Not only does it not work. But the mode is set to MODE_ON for some really strange reason?

  BaseObject *obj = doc->GetActiveObject(); if(!obj) return FALSE;  
  //Create an EditorVisibilty description track  
  CTrack *trackVis = CTrack::Alloc(obj,DescLevel(ID_BASEOBJECT_VISIBILITY_EDITOR, DTYPE_LONG, 0));  
  //Add a key at frame 0 with the visibilty option set to default  
  CKey *key = trackVis->GetCurve()->AddKey(BaseTime(0.0)); if (!key) return FALSE;      
  key->SetValue(trackVis->GetCurve(), MODE_UNDEF);  
  obj->Message(MSG_CHANGE);  //<---nope!!  
  obj->Message(MSG_UPDATE);  //<---nope!!  
  //Add key at frame 30 with the visibilty option set to off (red dot)  
  key = trackVis->GetCurve()->AddKey(BaseTime(1.0)); if (!key) return FALSE;  
  key->SetValue(trackVis->GetCurve(), MODE_OFF);   
  obj->Message(MSG_CHANGE);  //<---nope!!  
  obj->Message(MSG_UPDATE);  //<---nope!!  

This error does not happen when you change the key values for the position, scale, and rotation descriptions. So it seems like a bug to me.

Is there any way to hack around this to force the object to update and use the key values I'm setting in the timeline keys?


On 26/04/2014 at 16:22, xxxxxxxx wrote:

Never mind guys. I found the problem.
I needed to use SetGeData() to make it work.

    BaseObject *obj = doc->GetActiveObject();  
  if(!obj) return FALSE;  
  //Create an EditorVisibilty description track and insert it into the timeline  
  CTrack *trackVis = CTrack::Alloc(obj, DescLevel(ID_BASEOBJECT_VISIBILITY_EDITOR, DTYPE_LONG, 0));  
  CCurve *curve = trackVis->GetCurve();             //Get the trackVis's curve  
  CKey *key1 = curve->AddKey(BaseTime(0.0));        //Add a new keyframe to it  
  key1->SetGeData(trackVis->GetCurve(), MODE_ON);   //Sets the key's value  
  CKey *key2 = curve->AddKey(BaseTime(1.0));