Get selected CKeys

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/09/2009 at 03:36, xxxxxxxx wrote:

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

---------
Hi,

I just have a small question. Is it possible to get the index or pointers of selected Keys in a CCurve?

Thanks a lot.

Cheers, Sebastian

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/09/2009 at 05:31, xxxxxxxx wrote:

Use GetNBit() and ChangeNBit() with a key to determine and set the selection state in the four avaible timelines. The bits are:

NBIT_TL1_SELECT
NBIT_TL2_SELECT
NBIT_TL3_SELECT
NBIT_TL4_SELECT

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/09/2009 at 06:14, xxxxxxxx wrote:

Thanks!! 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/09/2009 at 22:35, xxxxxxxx wrote:

Not sure why but when I try using the GetNBit(NBIT_TL1_SELECT) like you mentioned above, I keep getting false returned even though I see the key selected.

Here is a snippet of code

//Set Curr_Key to first found key
Curr_Key =Curr_Seq->GetKey(0);
//Loop through all the keys on this track
while(Curr_Key )
{                         GePrint(LongToString(Curr_Key->GetTime().GetFrame(GetActiveDocument()->GetFps())));
                         GePrint(LongToString(Curr_Key->GetNBit(NBIT_TL1_SELECT)));

//When an active key                if(Curr_Key->GetNBit(NBIT_TL1_SELECT)     || Curr_Key->GetNBit(NBIT_TL2_SELECT) || Curr_Key->GetNBit(NBIT_TL3_SELECT) || Curr_Key->GetNBit(NBIT_TL4_SELECT))
{
//DO something
GePrint("ENTERED");
}

I have confirmed that the keys exist and the 1st GePrint statement show print the value of their time. But the second one always comes up as zero/false. And I cannot get into the above if statement. Any advice?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/09/2009 at 09:29, xxxxxxxx wrote:

Howdy,

Since GetNBit() is accessing bits, you probably need to do this instead:

> \> GePrint(LongToString(Curr_Key->GetNBit() & NBIT_TL1_SELECT) \>

Adios,
Cactus Dan

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/09/2009 at 12:47, xxxxxxxx wrote:

Howdy,

DOH! Sorry, I was thinking of a different function, so disregard what I posted above. :o(

Adios,
Cactus Dan

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/09/2009 at 17:41, xxxxxxxx wrote:

Ok so then I still need help on this one.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2009 at 02:11, xxxxxxxx wrote:

Quote: Originally posted by njt0001 on 11 September 2009
>
> * * *
>
> Ok so then I still need help on this one.
>
> * * *

Sorry but I can't confirm. This is working fine for me.

> \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      BaseObject \*op = NULL; \>      op = doc->GetActiveObject(); \>      if (!op) return FALSE; \> \>      CTrack \*track = NULL; \>      track = op->GetFirstCTrack(); \>      if (!track) return FALSE; \> \>      CCurve \*curve = NULL; \>      curve = track->GetCurve(CC_CURVE, TRUE); \>      if (!curve) return FALSE; \> \>      CKey \*key = NULL; \>      LONG keycnt = curve->GetKeyCount(); \> \>      for (LONG i=0; i<keycnt; i++) \>      { \>           key = curve->GetKey(i); \>           if (!key) return FALSE; \> \>           if (key->GetNBit(NBIT_TL1_SELECT)) GePrint("key"+LongToString(i)+" TL1"); \>           if (key->GetNBit(NBIT_TL2_SELECT)) GePrint("key"+LongToString(i)+" TL2"); \>           if (key->GetNBit(NBIT_TL3_SELECT)) GePrint("key"+LongToString(i)+" TL3"); \>           if (key->GetNBit(NBIT_TL4_SELECT)) GePrint("key"+LongToString(i)+" TL4"); \>      } \> \>      return TRUE; \> } \>

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2009 at 08:50, xxxxxxxx wrote:

Oh ok, well I see it when I select a key in keymode, but when I try switching to Fcurve mode it only displays the keys that are selected in Keymode not the keys I select in Fcurve mode. Any thoughts?

Thanks,
nate

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2009 at 09:06, xxxxxxxx wrote:

For F-Curve keys use these:

NBIT_TL1_SELECT2
NBIT_TL2_SELECT2
NBIT_TL3_SELECT2
NBIT_TL4_SELECT2

At some point these bits will be documented in a proper way. But for now you have to go by the name, they are usally quite self-explanatory.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 14/09/2009 at 11:06, xxxxxxxx wrote:

Thanks Matthias, that should do it!