2
$\begingroup$

I'm trying to set an FCurve in the Graph Editor to "Active" through python.

In the API FCurves don't actually have an "Active" property, but manually click-selecting a channel or keyframe on an FCurve will bring up this in the Graph's UI:

enter image description here

You can see that the curve gets a very bright highlight and the UI panel on the right now shows that the curve is Active.

FCurve's do have a "select" property that when set to True through script will select the curve. But just setting the select property to True doesn't produce the same result. It only selects the curve but doesn't consider it active, like this:

enter image description here

Even though the curve/channel is selected you can see the curve's highlight is not nearly as bold now, and the UI panel on the right shows no active curve at all.

So I started digging through the source code and found that there's an FCURVE_ACTIVE flag that does in fact get set, but I can't figure out how to do anything through script that would trigger anything that might set that flag.

Here's a link to an ANIM_set_active_channel function in anim_channels_edit.c from the source code:

ANIM_set_active_channel

You can see down on line 111 the FCURVE_ACTIVE flag is set.

This function is called in a number of different places:

  • action_select.c
  • nla_channels.c
  • nla_select.c
  • graph_select.c
  • ED_anim_api.h

Does anyone know how this works? What is Blender doing once it reads the flag to brightly highlight the curve and make it show up in the right UI panel? Can this be reproduced through script without having to manually click-select on either a keyframe or an action channel?

Thanks for any ideas.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.