set "Visible in Editor" keyframe



  • On 06/09/2017 at 02:46, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    I have a tag plugin and I want to set the objects "Visible in Editor" using keyframes.

    Here my code.
    A keyframe is set on frame 0, but the value for "Visible in Editor" is not correct (always On).
    What am I doing wrong?

    track = CTrack::Alloc(op, DescID(ID_BASEOBJECT_VISIBILITY_EDITOR, DTYPE_LONG, 0)); 
    if (track) {
       // Add track to op
       op->InsertTrackSorted(track);
    		
       // Get track curve
       CCurve* curve = track->GetCurve();
       if (curve!=nullptr) {
          CKey* key = curve->AddKey(BaseTime(0.0));
          key->SetValue(curve, 1);		//set to Off
       }
    }
      
    
    

    -Pim



  • On 06/09/2017 at 02:52, xxxxxxxx wrote:

    I already notice some "bugs" (key was not created) putting key at BaseTime(0.0). So this may be related.

    I end up by creating a key then move his time at BaseTime(0.0)



  • On 06/09/2017 at 03:05, xxxxxxxx wrote:

    Actually the keyframe is set, but the Visible in Editor value is not set correctly.
    Perhaps it is because Long - Float issue.
    Visible in Editor is an integer, but SetValue() expects a Float?

    I did a test creating the keyframe at 1.0, but the result is the same (a value of 0 (On) is inserted in the key).

    -Pim



  • On 07/09/2017 at 01:26, xxxxxxxx wrote:

    Hello,

    to set the value of animation tracks that do not store Float values you can use SetGeData(). See the CKey Manual.

    best wishes,
    Sebastian



  • On 07/09/2017 at 01:28, xxxxxxxx wrote:

    Yes, that did the trick.

    Thanks, Pim


Log in to reply