Page MenuHome

Refactor: Support arbitrary y offset for channel list
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on May 2 2019, 6:49 PM.

Details

Summary

This is necessary for D4654.

At first you could think that this refactor would not be
necessary, because ACHANNEL_FIRST exists already.
It contained the small y offset that all channels had.

Unfortunately, a lot of code assumed that
ACHANNEL_FIRST = ACHANNEL_HEIGHT_HALF, making the
define pretty much useless. This refactor fixes that
for the action and nla editor.

Individual refactoring commits:

  • simplify definition of ACHANNEL_HEIGHT_HALF
  • rename ACHANNEL_FIRST to ACHANNEL_FIRST_CENTER
  • move variable declaration into inner scope
  • reduce variable scope
  • reduce vertical scope
  • use correct value to determine selected cell
  • reduce redundant code
  • introduce ACHANNEL_FIRST_TOP
  • use actual channel top in box select
  • correct channel selection
  • cleanup another channel loop
  • fix channel box select
  • simplify NLACHANNEL_HEIGHT_HALF definition
  • rename NLACHANNEL_FIRST to NLACHANNEL_FIRST_CENTER
  • introduce NLACHANNEL_FIRST_TOP
  • reduce usage of ACHANNEL_STEP
  • remove all usages of ACHANNEL_FIRST_CENTER
  • remove all uses of ACHANNEL_HEIGHT_HALF
  • fix UI_view2d_listview_view_to_cell
  • remove unused v2d argument
  • remove unused functions
  • remove temporary offset
  • remove uses of NLACHANNEL_FIRST_CENTER
  • remove NLACHANNEL_HEIGHT_HALF
  • view2d tot height has to take offset into account
  • compute correct height of nla channels

I'd be happy if someone could quickly check if the
channel/keyframe selection still works as before.

As a nice side effect, this patch fixes channel box select.
Before there was always have a half-channel offset.

To test, that the offset is taken into account correctly,
just add e.g. -100 to ACHANNEL_FIRST_TOP.

Diff Detail

Repository
rB Blender
Branch
channel-drawing (branched from master)
Build Status
Buildable 3489
Build 3489: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.May 3 2019, 12:05 PM
This revision was automatically updated to reflect the committed changes.