1
$\begingroup$

To refresh colors F-Curves I have to display the Graph editor on the screen. Blender doesn't refresh colors F-Curves automatically.

Create some animation with the default cube and follow:

bpy.data.actions['CubeAction'].fcurves[0].color

without display the Graph editor on the screen, we get a pure black color:

Color((0.0, 0.0, 0.0))

It the any way to refresh and update colors F-Curves via python ?

Below a screenshot from Outliner, Datablocks. enter image description here

$\endgroup$
1
$\begingroup$

I think that the fcurves colors are calculated when the graph editor tries to read their value for the first time, so you may have to do that yourself :

for action in D.actions :    
    for fcurve in action.fcurves :
        index = fcurve.array_index

        if fcurve.color_mode == 'AUTO_RGB':
            h = float(1.0)/3.0        
        #I don't have the right formula for rainbow 
        elif fcurve.color_mode == 'AUTO_RAINBOW': 
            h = float(1.0)/4.0  

        fcurve.color.hsv = (index*h, 1, 1)
$\endgroup$
  • $\begingroup$ For me the colors were updated only after I changed the color_mode to 'CUSTOM' (fcurve.color_mode = 'CUSTOM') $\endgroup$ – Noam Peled Jan 13 '16 at 4:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.