Page MenuHome

Fix: RNA property not set for Graph editor breakdown op
ClosedPublic

Authored by Christoph Lendenfeld (ChrisLend) on Feb 14 2022, 8:47 AM.

Details

Summary

Bug: After running the breakdown operator for the graph editor, the factor property in the redo panel didn't reflect the value you chose. Rather it was always stuck at 0.33 because that's the default value.

This patch fixes that so the value corresponds to what the user picked

Diff Detail

Repository
rB Blender

Event Timeline

Christoph Lendenfeld (ChrisLend) requested review of this revision.Feb 14 2022, 8:47 AM
Christoph Lendenfeld (ChrisLend) created this revision.
Sybren A. Stüvel (sybren) requested changes to this revision.Feb 14 2022, 11:35 AM
Sybren A. Stüvel (sybren) added inline comments.
source/blender/editors/space_graph/graph_slider_ops.c
736–738

I think it would be good to extract these two lines into their own function. Maybe it's possible to create some ED_slider_op_factor_get(op) along those lines? Disclaimer: I haven't actually compiled/tested this ;-)

// Document assumptions here about `op` having `tGraphSliderOp` customdata.
float ED_slider_op_factor_get_and_remember(wmOperator *op)
{
  tGraphSliderOp *gso = op->customdata;
  const float factor = ED_slider_factor_get(gso->slider);
  RNA_property_float_set(op->ptr, gso->factor_prop, factor);
  return factor;
}

That way it'll be easier to make future code do the right thing. It could also be worth documenting the existance of this function at ED_slider_factor_get().

This revision now requires changes to proceed.Feb 14 2022, 11:35 AM

Implement slider_factor_get_and_remember

Good call on the helper function. That makes it harder to miss that line
I put that function into graph_slider_ops.c because it's tightly coupled to the tGraphSliderOp struct.

This revision is now accepted and ready to land.Feb 15 2022, 11:45 AM