CTrackData Plugins?

On 03/09/2013 at 16:44, xxxxxxxx wrote:

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

I'm trying to figure out how to write CTrackData plugins. But I can't even get a simple GePrint() to occur in any of the methods. Except for the GetHeight() method.

Can anyone tell me what in the heck the BlinkerTrack plugin does? Or how to use it?
No matter what I do. I cannot get it to do anything.
The code seems to indicate that it changes the display mode. But I cannot get it to work.

I also tried drawing my own GeClipmap in the Draw() method.
Same results..nothing happens.

I've written tons of CTtrack code. But never a CTrack plugin. And I'm getting less than nothing. 😠
I would appreciate any hints at all about how to write one of these plugins.


On 03/09/2013 at 22:09, xxxxxxxx wrote:

After much head banging I stumbled upon something very important.
The Blinker plugin only creates Keys...It does not create F-Curves.
I was working in F-curve mode and that's why I wasn't getting any output from it.

Now that I've got that important part figured out. How do I draw the F-Cuve for the keys?
There's a built-in GeClipMap variable in it called map in the Draw() method. But I can't get anything to draw with it.
Do we need to use Init() with this?

It would have been really nice to see that F-Curve code. Rather than leaving it blank in the Blinker plugin. 😠


On 03/09/2013 at 22:42, xxxxxxxx wrote:

You need keyframes on the track before it will do anything.

On 04/09/2013 at 07:18, xxxxxxxx wrote:

Hi Robert.
Yeah. I figured that out after lots and lots of headbanging.
But how do we draw the F-Curves and the background colors?

I'm going to take another crack it today. And try to figure it out.


On 04/09/2013 at 08:40, xxxxxxxx wrote:

F-Curves are automatic.  They are created by the specifications of the keys (interpolation types)

On 04/09/2013 at 09:29, xxxxxxxx wrote:

When I create keys in the blinker track. It doesn't automatically create an f-Curve. I wish that it did.
That's why I'm assuming that a CTrack Plugin requires us to draw the F-Curves ourselves?

There's no comments in the SDK example. So I'm still trying to learn how everything works in this thing.


On 04/09/2013 at 13:01, xxxxxxxx wrote:

Since there are zero posts about how to use this plugin. I guess I'll just keep posting my findings.

I figured out how to draw things. And it's not what I was hoping for.
It seems that we can only draw below the blinker track..not on the track itself.


Bool BlinkerTrack::Draw(CTrack *track, GeClipMap *map, const BaseTime &clip_left, const BaseTime &clip_right)  
  //Make sure the GetHeight() method is not returning zero..Or you won't see what's being drawn  
  map->SetColor(255,0,0);     //The color red  
  map->FillRect(0,0,40,40);   //The size of the rectangle  
  return TRUE;  
LONG BlinkerTrack::GetHeight(CTrack *track)  
  //Creates an arrow option for the TL entry to unfold it (the return value determines how tall it is in pixels)  
  //This lets us draw things underneath the keys (not in the key's track itself)  
  //This will not allow you to draw things in the key's tracks... like f-cuves for example  
  //NOTE: When this arrow is used to unfold it...The Draw() method is then called..otherwise Draw() never gets called  
  return 50;  

I still can't figure out how to create an f-Curve in this thing.
And I still can't figure out how to generate keys with code. Rather than creating them manually with Ctrl+LMB.

Still trying to figure this thing out......


On 16/09/2013 at 02:40, xxxxxxxx wrote:

Hi ScottA,
I read in your former post that you managed to get your 40x40 rectangle drawn.
I added and registered the SDK example Blinker plugin into my project, but I didn't find that plugin in any Plugin menu of Cinema/Timeline or any context menu in the Timeline editor, i.e. how can I create an instance of such plugin?
Do you have an entry "CTblinker" in any plugin menu?
I also tried to create an instance of that plugin by code from one of my plugins, but then of course Cinema isn't aware of it and won't do anything with it (calling methods of it).
Maybe I missed some very basic detail?

On 16/09/2013 at 03:03, xxxxxxxx wrote:

Please ignore my former post/question - a missing string resource (IDS_BLINKER) in c4d_strings.str was the reason that the plugin wasn't shown in the Timeline editor context menu under "Add Special Tracks".
Now I also see the red 40x40 rectangle from your code example.

When I manage to create some CTracks/CCurves/CKeys by code I will post it.

On 16/09/2013 at 07:47, xxxxxxxx wrote:

Glad you got it figured out.
I have figured out how to add keys to the track since my last post.
The only big problem I'm having with these CTrackData plugins is creating the f-curve.
The Blinker SDK example does not create an f-curve.

The Time track does have an f-curve in it. And it looks like it was created using a CTrackData plugin.
But that one was created by Maxon. So I don't know if we can even do it or not?


On 16/09/2013 at 09:31, xxxxxxxx wrote:

I skipped my experiments with the CTrackData class and tried to work with the basics, i.e. CTrack/CCurve/CKey.
I found very helpful information at
I took over some command sequences of that Python examples into the Init() method of my C++ plugin. The result is a x-position track with a function curve that is based on the 4 keys.
> CTrack* pTrack = NULL;
> CCurve* pCurve = NULL;
> CKey* pKey1 = NULL;
> CKey* pKey2 = NULL;
> CKey* pKey3 = NULL;
> CKey* pKey4 = NULL;
> Bool MyPlugin::Init(GeListNode *node)
> {
>  BaseList2D* pBL = (BaseList2D* )node;
>  if(pTrack)
>  {
>   pBL->InsertTrackSorted(pTrack);
>   pCurve = pTrack->GetCurve(CCURVE_CURVE, TRUE);
>   // Create keys at specified timeline position
>   pKey1 = pCurve->AddKey(BaseTime(0));
>   pKey2 = pCurve->AddKey(BaseTime(1));
>   pKey3 = pCurve->AddKey(BaseTime(2));
>   pKey4 = pCurve->AddKey(BaseTime(3));
>   // Initialize keys with default values
>   pTrack->FillKey(GetActiveDocument(),pBL, pKey1);
>   pTrack->FillKey(GetActiveDocument(),pBL, pKey2);
>   pTrack->FillKey(GetActiveDocument(),pBL, pKey3);
>   pTrack->FillKey(GetActiveDocument(),pBL, pKey4);
>   // Set value for each key
>   pKey1->SetValue(pCurve, 0);
>   pKey2->SetValue(pCurve, 20.0);
>   pKey3->SetValue(pCurve, 0);
>   pKey4->SetValue(pCurve, -20.0);
>  }
> }
The Blinker demo from the SDK is far away from being self explaining. I assume we do not see any function curve, because the key(s) isn't explicitly given to a (internally hidden?) CCurve. Maybe this has to be coded explicitly in a CTrackData plugin. Maybe I'll try to extend the Blinker plugin in a next step.

On 16/09/2013 at 10:28, xxxxxxxx wrote:

Creating an f-curve by allocating a new track is simple. Because it's done automatically for us.
But a CTrackData plugin is different than allocating a track.
A CTrackData plugin creates a track from scratch. With no automatic f-curve generated.
So we also have to create f-curve from scratch too.

The problem is....There's nothing I can find in the SDK that lets us create f-curves from scratch.


On 26/09/2013 at 03:18, xxxxxxxx wrote:

I did some debugging with the Blinker plugin.
When you add a new key to the track (CTRL+LMC), BlinkerTrack::FillKey() is called. Over the passed CKey* you can get a link to the CCurve (key->GetCurve()), i.e. a CCurve is created by Cinema and you don't have to create one.
You can also access other information like the number of keys (CCurve::GetKeyCount()), just check what possibilities are provided by the CTrack/CCurve/CKey classes.
My assumption is, that the only advantage/purpose of the CTrackData class is, that you have the possibility to draw into the fcurve area, i.e. that you have 100% control about what is shown on that track.
If you "only" want to show an interactive and editable fcurve, why using the CTrackData class?  CTrack/CCurve/CKey offers all you need for such wish.
But if you want to combine or extend an fcurve with your own drawings, then I assume you have to go the hard way and draw the fcurve on your own, i.e. within CTrackData::Draw() you have to use CCurve::GetValue() to retreive the Y-values of the curve for all X-values (=time) and draw lots of dots (which build the curve) into the GeClipMap.
I have currently no idea how to handle or implement the feature to interactively move keys to adjust the shape of the curve, but the CTrack and CCurve classes have some methods which seem to provide functionality that might be needed for such a task (e.g. CCurve::GetTangents() etc).
What currently came into my mind: maybe it's also possible, that a CTrackData plugin has to internally build a kind of "shadow-track" by rebuilding the track+curve+keys by creating own (internal) CTracks/CCurves/CKeys objects. Maybe it's possible that Cinema cares about the drawing plus the interactive editing stuff for such "shadow track".

On 26/09/2013 at 09:13, xxxxxxxx wrote:

Originally posted by xxxxxxxx

if you want to combine or extend an fcurve with your own drawings, then I assume you have to go the hard way and draw the fcurve on your own, i.e. within CTrackData::Draw() you have to use CCurve::GetValue() to retreive the Y-values of the curve for all X-values (=time) and draw lots of dots (which build the curve) into the GeClipMap.
I have currently no idea how to handle or implement the feature to interactively move keys to adjust the shape of the curve

This is what I've been saying.
The Blinker SDK example is far too simple. And doesn't show enough code to be of much help.
It would be far more helpful if Maxon added the Timer plugin or something similar to the examples. Because there's nothing in the in the SDK that tells us how to create an f-curve by hand based on key values.


On 31/03/2014 at 06:22, xxxxxxxx wrote:

Hello guys, I am also trying to create a CTrackData plugin and I am having trouble understanding how it works.
Can you please tell me how I can add my plug-in under the "Add Special Tracks"? I managed to add it under the "Create" menu of the Timeline, but not under the "Add Special Tracks".

Also if you have more findings about the topic, please post them. It would be very helpful.

Thank you! Alexandra