Refactor: Rename functions and structs in keyframes_draw.cc #111510
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#111510
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChrisLend/blender:keyframes_draw_renames"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
No functional changes.
While looking at the Dope Sheet drawing code to see if it can be made faster I came across a bunch of functions with confusing names.
This PR tries to address that by:
ED_
prefix from static functionsAnimKeylistDrawListElem
toChannelListElement
AnimKeylistDrawList
toChannelDrawList
draw_..._channel
renamed toED_add_..._channel
since the function itself doesn't actually do any drawingHappy to see someone working on refactoring this code! Thank you :)
I have some inline comments and one suggestion: I think renaming the functions to use an
ED_
prefix is good, but what would be even better imho is to use anamespace
. Something likeed::animation::draw
.But I'll let the others decide if they think that's better or not :)
@ -396,2 +394,4 @@
struct ChannelListElement {
ChannelListElement *next, *prev;
AnimKeylist *keylist;
eAnimKeylistDrawListElemType type;
Since we're renaming this struct, I would rename the enum as well. Maybe just
ChannelType
. And I'd make it anenum class
while we're at it. Then the fields can all drop theANIM_KEYLIST_
prefix and we get somthing likeChannelType::Summary
,ChannelType::Scene
, etc.renamed to
eChannelType
I am not sure if the
e
prefix is still needed. Do you know anything about that?No, in C++ we generally don't add a prefix anymore, because the type is known and doesn't need to be hinted at in the name. E.g. C++ will not let you do some operations that you would be able to do in C like it was just an
int
.@ -768,3 +772,1 @@
float ypos,
float yscale_fac,
int saction_flag)
void ED_add_gpl_channel(ChannelDrawList *channel_list,
Since we're renaming things, this should really be named something like
ED_add_gp_layer_legacy_channel
.Agreed. When I first read the function name, I thought, "GNU Public License channel...?" Of course, I knew that's not what it would be, but it wasn't immediately clear what it was.
Since the function just above spells out
grease_pencil
, maybe do that here as well?ED_add_grease_pencil_layer_legacy_channel
renamed the function to
ED_add_grease_pencil_layer_legacy_channel
is more consistent with the other function names
@ -783,3 +787,1 @@
float ypos,
float yscale_fac,
int saction_flag)
void ED_add_masklay_channel(ChannelDrawList *channel_list,
I would prefer
ED_add_mask_layer_channel
Although I touched this code 4 years ago, I will leave it to Nathan for review as it is part of the animation module.
@ -693,3 +688,1 @@
float ypos,
float yscale_fac,
int saction_flag)
void ED_add_agroup_channel(ChannelDrawList *channel_list,
Not sure how deep the renaming rabbit hole would go, but could
agroup
be expanded? It's not immediately clear what that is (action group? animation group?).Maybe that's out of scope for this PR, if it would require touching too many other things to make everything consistent.
renamed it. In the end it wasn't a lot
Functions now no longer refer to
agroup
but there is stillbPose->agroups
This generally looks good to me, and certainly reads a lot more clearly. I agree with the notes from @filedescriptor, and had one additional suggestion that might be out of scope for this PR.
Apart from the
eChannelType
->ChannelType
thing, LGTM.Looks good to me too!