Refactor yscale of bAnimContext #104500

Merged
Christoph Lendenfeld merged 8 commits from ChrisLend/blender:refactor_channel_yscale into main 2023-02-09 14:28:06 +01:00

bAnimContext had a float property called yscale_fac that was used to define the height of the keyframe channels.

However the property was never set, only read so there really is no need to have it in the struct.

Moreover it complicated getting the channel height because bAnimContext had to be passed in.

Speaking of getting the channel height. This was done with macros. I ripped them all out and replaced them with function calls.

Originally it was introduced in this patch: https://developer.blender.org/rB095c8dbe6919857ea322b213a1e240161cd7c843

`bAnimContext` had a float property called `yscale_fac` that was used to define the height of the keyframe channels. However the property was never set, only read so there really is no need to have it in the struct. Moreover it complicated getting the channel height because `bAnimContext` had to be passed in. Speaking of getting the channel height. This was done with macros. I ripped them all out and replaced them with function calls. Originally it was introduced in this patch: https://developer.blender.org/rB095c8dbe6919857ea322b213a1e240161cd7c843
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2023-02-09 10:32:51 +01:00
Sybren A. Stüvel was assigned by Christoph Lendenfeld 2023-02-09 10:32:52 +01:00
Christoph Lendenfeld added 3 commits 2023-02-09 10:32:54 +01:00
Christoph Lendenfeld added this to the Animation & Rigging project 2023-02-09 10:33:40 +01:00
Christoph Lendenfeld added 1 commit 2023-02-09 10:56:54 +01:00
Christoph Lendenfeld added 1 commit 2023-02-09 11:04:26 +01:00
Christoph Lendenfeld added 1 commit 2023-02-09 11:05:09 +01:00
Christoph Lendenfeld changed title from WIP: Refactor yscale of bAnimContext to Refactor yscale of bAnimContext 2023-02-09 11:31:38 +01:00
Christoph Lendenfeld self-assigned this 2023-02-09 11:32:18 +01:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2023-02-09 11:32:33 +01:00
Sybren A. Stüvel was unassigned by Christoph Lendenfeld 2023-02-09 11:32:45 +01:00
Christoph Lendenfeld removed their assignment 2023-02-09 11:32:45 +01:00
Sybren A. Stüvel reviewed 2023-02-09 11:39:09 +01:00
@ -4376,0 +4376,4 @@
float ANIM_UI_get_keyframe_scale_factor(void)
{
bTheme *btheme = UI_GetTheme();
float yscale_fac = btheme->space_action.keyframe_scale_fac;

can be const

can be `const`
ChrisLend marked this conversation as resolved
Sybren A. Stüvel requested changes 2023-02-09 12:26:16 +01:00
Sybren A. Stüvel left a comment
Member

Nice improvements!

Nice improvements!
@ -615,0 +598,4 @@
float ANIM_UI_get_channel_skip(void);
float ANIM_UI_get_first_channel_top(View2D *v2d);
float ANIM_UI_get_channel_step(void);
float ANIM_UI_get_channels_total_height(View2D *v2d, const int item_count);

Here remove const, it has no meaning in a function declaration for pass-by-value types.

Here remove `const`, it has no meaning in a function declaration for pass-by-value types.
ChrisLend marked this conversation as resolved
@ -74,2 +75,2 @@
for (ale = anim_data.first; ale; ale = ale->next, ymax -= ACHANNEL_STEP(ac), channel_index++) {
float ymin = ymax - ACHANNEL_HEIGHT(ac);
for (ale = anim_data.first; ale; ale = ale->next, ymax -= channel_step, channel_index++) {
float ymin = ymax - ANIM_UI_get_channel_height();

const float -- it doesn't change value within its scope, so it can be const even when it's different on every loop iteration. Same with some others below.

`const float` -- it doesn't change value within its scope, so it can be `const` even when it's different on every loop iteration. Same with some others below.
ChrisLend marked this conversation as resolved
Christoph Lendenfeld added 1 commit 2023-02-09 12:37:23 +01:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2023-02-09 12:38:52 +01:00
Sybren A. Stüvel approved these changes 2023-02-09 13:08:21 +01:00
Sybren A. Stüvel left a comment
Member

LGTM!

LGTM!
Christoph Lendenfeld added 1 commit 2023-02-09 14:22:05 +01:00
Christoph Lendenfeld merged commit 666c2ea012 into main 2023-02-09 14:28:06 +01:00
Christoph Lendenfeld deleted branch refactor_channel_yscale 2023-02-09 14:28:06 +01:00
Sybren A. Stüvel removed this from the Animation & Rigging project 2023-02-09 16:43:11 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#104500
No description provided.