Refactor: resolution_scale in graph_draw.cc #111037
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#111037
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChrisLend/blender:reafactor_graph_draw_res_scale"
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?
Recent patches added a variable
resolution_scale
This variable defines how many points on the x or y axis to add.
However I find the name confusing.
Instead of that, change it to
pixels_per_unit
and move the
points_per_pixel
factorto
calculate_bezt_draw_resolution
This makes also sense in context of #110788: Animation: Graph Editor - Don't draw keys if they are too close to each other
no functional changes
Both names feel about equivalently clear to me: they both give an idea of what it is, but don't define it precisely. So I'm happy for it to be changed if you think it's better, but I don't have a strong opinion myself.
Having said that, if we want to increase clarity here (which is never a bad idea) I think a doc comment on the function explaining its functionality and parameters would be more effective.
@nathanvegdahl good idea. Added a comment as well
@ -1008,3 +1008,3 @@
}
static blender::float2 calculate_resolution_scale(View2D *v2d)
/** Calculate how many points are needed per unit of the visible range of the View2D based on its
Maybe:
That way it's a little clearer what kind of points we're talking about and for what purpose.
I'm also realizing that it feels to me like the variable
points_per_pixel
should either be a function parameter, or it shouldn't exist at all (i.e. just substitute 1.0, and then the function becomespixels_per_unit()
). Maybe that's too much for what's supposed to be a tiny PR, though.Good point changing it to
pixels_per_unit
That is actually what I need for #110788 as well
The
points_per_pixel
I'd like to keep but that can be moved into thecalculate_bezt_draw_resolution
functionIf I set that to 1 it would make 4 times the amount of points impacting performance
Yes the patch bloated a bit, but it is for good reason :)
Refactor: Rename variable in graph_draw.ccto Refactor: resolution_scale in graph_draw.ccI've changed the function to
calculate_pixels_per_unit
the
points_per_pixel
I've moved to the functioncalculate_bezt_draw_resolution
I think that makes much more sense
I verified that the resolution returned from
calculate_bezt_draw_resolution
is the same as before. So it stays at no functional changesJust a couple of comments that are now out of date (I think?) and can be removed at this point. Other than that, looks good to me!
@ -1009,2 +1012,3 @@
static blender::float2 calculate_resolution_scale(View2D *v2d)
/** Calculate how many points are needed per unit of the visible range of the View2D based on its
* pixel size. */
This doc comment feels out of date to me now. And the name of the function is now pretty self-documenting.
So I'd say just remove the doc comment. (Either that or update it, but I don't think that's necessary.)
@ -1011,3 +1015,4 @@
static blender::float2 calculate_pixels_per_unit(View2D *v2d)
{
/* The resolution for bezier forward diff in frame/value space. This ensures a constant
* resolution in screen-space. */
This comment is also outdated, I think, and can just be removed.
@nathanvegdahl removed both comments. Feels good to do so because it means the code is more self explaining :)
Looks good to me!