Code Quality Day Tasks #73586
Closed
opened 2020-02-04 15:06:55 +01:00 by Dalai Felinto
·
34 comments
No Branch/Tag Specified
main
blender-v3.6-release
temp-sculpt-dyntopo-hive-alloc
temp-sculpt-dyntopo
tmp-usd-python-mtl
asset-browser-frontend-split
node-group-operators
brush-assets-project
asset-shelf
blender-v2.93-release
blender-v3.3-release
universal-scene-description
temp-sculpt-attr-api
blender-v3.5-release
realtime-clock
sculpt-dev
gpencil-next
bevelv2
microfacet_hair
blender-projects-basics
principled-v2
v3.3.7
v2.93.18
v3.5.1
v3.3.6
v2.93.17
v3.5.0
v2.93.16
v3.3.5
v3.3.4
v2.93.15
v2.93.14
v3.3.3
v2.93.13
v2.93.12
v3.4.1
v3.3.2
v3.4.0
v3.3.1
v2.93.11
v3.3.0
v3.2.2
v2.93.10
v3.2.1
v3.2.0
v2.83.20
v2.93.9
v3.1.2
v3.1.1
v3.1.0
v2.83.19
v2.93.8
v3.0.1
v2.93.7
v3.0.0
v2.93.6
v2.93.5
v2.83.18
v2.93.4
v2.93.3
v2.83.17
v2.93.2
v2.93.1
v2.83.16
v2.93.0
v2.83.15
v2.83.14
v2.83.13
v2.92.0
v2.83.12
v2.91.2
v2.83.10
v2.91.0
v2.83.9
v2.83.8
v2.83.7
v2.90.1
v2.83.6.1
v2.83.6
v2.90.0
v2.83.5
v2.83.4
v2.83.3
v2.83.2
v2.83.1
v2.83
v2.82a
v2.82
v2.81a
v2.81
v2.80
v2.80-rc3
v2.80-rc2
v2.80-rc1
v2.79b
v2.79a
v2.79
v2.79-rc2
v2.79-rc1
v2.78c
v2.78b
v2.78a
v2.78
v2.78-rc2
v2.78-rc1
v2.77a
v2.77
v2.77-rc2
v2.77-rc1
v2.76b
v2.76a
v2.76
v2.76-rc3
v2.76-rc2
v2.76-rc1
v2.75a
v2.75
v2.75-rc2
v2.75-rc1
v2.74
v2.74-rc4
v2.74-rc3
v2.74-rc2
v2.74-rc1
v2.73a
v2.73
v2.73-rc1
v2.72b
2.72b
v2.72a
v2.72
v2.72-rc1
v2.71
v2.71-rc2
v2.71-rc1
v2.70a
v2.70
v2.70-rc2
v2.70-rc
v2.69
v2.68a
v2.68
v2.67b
v2.67a
v2.67
v2.66a
v2.66
v2.65a
v2.65
v2.64a
v2.64
v2.63a
v2.63
v2.61
v2.60a
v2.60
v2.59
v2.58a
v2.58
v2.57b
v2.57a
v2.57
v2.56a
v2.56
v2.55
v2.54
v2.53
v2.52
v2.51
v2.50
v2.49b
v2.49a
v2.49
v2.48a
v2.48
v2.47
v2.46
v2.45
v2.44
v2.43
v2.42a
v2.42
v2.41
v2.40
v2.37a
v2.37
v2.36
v2.35a
v2.35
v2.34
v2.33a
v2.33
v2.32
v2.31a
v2.31
v2.30
v2.28c
v2.28a
v2.28
v2.27
v2.26
v2.25
Labels
Clear labels
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
Apply labels
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
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
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 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
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Set Project
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
19 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#73586
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Code Quality Day
https://wiki.blender.org/wiki/Style_Guide/Code_Quality_Day
Bigger impact changes
Projects which might go somewhat deeper but which have big impact on Blender code quality.
Extensible Architecture Refactoring
Task: #75724 (Extensible Architecture Refactoring)
Write a script to automatically rename DNA fields
Make it super easy to rename fields in DNA, avoiding manual work to through files and
Suggestion: look into clang-rename tool
Alternative: maybe there is IDE which has good enough refactoring functionality
Once that's done we will improve naming of all ambiguous/confusing DNA names.
Compositor
Design task: #74491
Dependency graph
There are multiple possible solutions, but goal is: consolidate nodes/relations building on per-ID basis.
Refactor multilayer storage
Make it more clear and easier to follow design, which will not be dependent on Render.
Note: Needs clear design first.
Physics
simulation/
Render module
Refactor/cleanup in
render/
:pipeline.h/.c
Move headers files fromrender/extern/
torender/
e15076b22f
User Interface
Automated Testing
Clang-Tidy integration
Code linter, which diagnoses typical programming errors.
More details and coordination in #78535
Smaller isolated changes
"Papercut" type of projects, which might not have that much of a difference on a local scale, but which adds up and make overall experience better.
Split big translation units
Applies to big files, big functions, big
if
andcase
statements.While is not end of a world, makes it hard to jump into area and grasp a bigger picture.
anim.c
andanim_sys.c
. (being worked on by @dr.sybren).if
,switch
stataments in Draw Manager.BKE_boundbox
API out ofBKE_object
(possibly renameBKE_object_boundbox
).Refactor directory structure
util
, 60utils
. Example:ED_util.h
,path_util.c
,MOD_util.c
).Motion tracking
Finish moving away from DerivedMesh
BKE_object_free_derived_caches
BKE_editmesh_free_derivedmesh
.After multires is fully ported to Subdiv:
Code modernize/readability
LISTBASE_FOREACH
in C code (e.g., D7320)DNA: Replace manual offset calculation with offsetof()
GHOST: Naming
getAllDisplayDimensions
currently returns dimensions of the main monitor, should be renamed or made to work as named.Improve names of BLI_path_util API
Without reading docstrings the purposes of the following functions is unclear.
BLI_make_exist
BLI_make_existing_file
Propose to use
BLI_path_
prefix. See #74506 for proposed new names.Working on this: @dr.sybren
Split out operating system wrappers (
BLI_path_util
,BLI_storage
) own API#75516 (Day of Clean Code: Split wrappers for C API functions into own files)
Working on this: @ideasman42
Improve naming of
BKE_library
/BKE_main
See #72604 (Proposal: BKE_library and BKE_main API naming: prefixes conventions)
#71219 (Refactor out BKE ID copy functions)
Refactor GPU attributes
gpuPushAttr
/gpuPopAttr
: Make this part ofGPU_state
since it's pushing attributes associated with state, use snake-case naming convention.Disambiguate term "Line" in BLI_math.h
Currently it's sometimes used for a line-segment (clamped start/end points), other uses extend infinitely in both directions. eg:
closest_to_line_v2
clamps between the two points, whereline_point_factor_v3_ex
doesn't.Propose for all clamping versions to use
line_segment
, orseg
in cases where we need to include multiple in a name, eg:isect_seg_seg_v2_point_ex
.Use
_fn
as a suffix for callbacks instead off
,cb
func
FileList.checkdirf
->check_dir_fn
.PointerPropertyRNA.typef
type_fn
PointerPropertyRNA.itemf
item_fn
RenderEngine.update_render_passes_cb
->update_render_passes_fn
bNodeType.freeexecfunc
->free_exec_fn
Working on this: @sebbas
Use shorter commonly used naming
Use shorter terms for function names where there is no ambiguity (which are already used in the API).
synchronize
->sync
initialize
->init
attrib
->attr
Terminology
ibuf_arr
→ibufs_arr
(or the other way around, but we have both in the same file often, e.g., sequencer.c)See #74427 (Code Quality: Terminology)
FFmpeg API update
We are using some fields and functions which are declared as deprecated in FFmpeg. Is better to update code to avoid use deprecated fields, as it will minimize frustration when deprecated symbols are actually removed.
The easiest way to see code which needs to be updated is to compile with strict)er) warnings with GCC or CLang. Not sure yet how to see such warnings when using MSVC.
Review task: D10338
Modernize OpenColorIO C-API
It can benefit from using C++11/C++17 features like
string_view
. Also, can do more propervirtual
/override
semantic.#86960 (Fix/Refactor IDPStringProperty code)
Documentation
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @dfelinto
Added subscriber: @EAW
Added subscriber: @antoniov
Added subscriber: @Mets
Added subscriber: @JacquesLucke
Added subscriber: @rjg
Added subscriber: @lichtwerk
Added subscriber: @Poulpator
Added subscriber: @c2ba
Not 100% sure, but after reading math_geom.c, I find no issue related to "Disambiguate term "Line" in BLI_math.h"
The example given:
does not apply here:
line_point_factor_v3_ex
actually returns a signed factor x such that the projection c of p on the line (l1,l2) can be obtained with c = l1 + x * (l2 - l1), but it's not clamped at all by the function so it is indeed a line that the function acts on.The functions that clamp the projection are
closest_to_line_segment_v
and are called by functionsdist_*_to_line_segment_v*
, so everything is correctly named here.So maybe I'm missing something, but I think this task can be removed from the description.
Added subscriber: @Stefan_Werner
Please don't do any mindless search/replace of symbol names or files. Please.
Renaming and refactoring things "just because" does not improve anything - in the ideal case, Blender remains unchanged, in reality there is always the risk of breaking things. Changes like that also cause lots of extra unnecessary work for contributors who maintain branches and patches that haven't been merged to master.
The move to
clang-format
(which at least brought convenience after it was done) and the huge commits of white space only changes, which literally and intentionally did not change (therefore not improve) Blender in any shape or form already caused me (and I would guess other contributors too) days of work just to update my feature branches and patches. If we now get commits like that every Friday, our productivity is ruined.Ideally the renaming that occurs is not mindless and "just because", but made to improve the quality of the code - which in turn will make it easier for new and existing developers to understand the code, which will result in a better Blender. Ofc your point of increasing workload for branch/patch maintainers is valid and I can't speak to that, but I don't agree that improving code quality does not equate to improving Blender.
I don't consider renaming "attrib" to "attr" an improvement in code quality, for example. It is however an effective way to annoy developers who are maintaining custom branches and patches.
Meanwhile, I think there are much more meaningful improvements in code quality that could be done instead. Fixing compiler warnings, for example - that could unearth some hidden bugs. Right now the make files for Blender still explicitly turn off a number of compiler warnings globally instead of addressing questionable code.
If in the future, we could build with warnings like -Wswitch, -Wformat or -Wclass-memacces, we will actually prevent future bugs from even happening.
Added subscriber: @fclem
Added subscribers: @ideasman42, @brecht, @Sergey
Moved terminology to own subtask. It deserves to be have more clear and permanent explanation, while tasks here are more like "remove me once done".
Arguably, terminology should be in a Wiki page so it's persistent and available. However, is risking to have a very long document where it will be very difficult to find bit of information you need right now.
Updated description with tasks discussed with @brecht (something we both considered belongs to the quality days). Really hope didn't get anything from @ideasman42 lost :)
@Sergey you added to use message bus or remove it. It shouldn't be half done, yet there is basically no motivation for anyone to spend time here.
Said differently, we're prioritizing user visible stuff but not un-finished back-end work.
Also, this isn't a simple removal, removing will need to have a way for gizmos to know when properties they use change.
So don't think this makes sense to have in code-quality page, it's more general issue that time should be spent to finish replacing notifier system.
Edit, removed this, it's out of scope for a cleanup since it's currently used and removing would require a replacement.
Added subscriber: @JulianEisel
I made some short-term proposals for the UI code, #74429 (UI Code Quality: bContext Management), #74430 (UI Code Quality: Ghost C++ Coding-Style), #74432 (UI Code Quality: General, Smaller Changes). They may need further discussion before being added to this task, I'll let that up to the admins.
There are many other things we could do there, this is just for a start.
Added subscriber: @Jeroen-Bakker
This comment was removed by @Jeroen-Bakker
Added subscriber: @Blendify
@Blendify, i would advice against checkboxes, and instead just do two things:
Working on: @Blendify
.Keeps it clear and avoids a long lists of "scratched out" tasks after a while.
Added subscriber: @dr.sybren
Added subscriber: @ankitm
I suggest to add:
Wrap function parameters into structs (where reasonable)
Add structs to wrap arguments passed to callbacks. E.g.:
{icon minus}
void view3d_main_region_listener(wmWindow *UNUSED(win), ScrArea *area, ARegion *region, wmNotifier *wmn, const Scene *scene)
{icon plus}
void view3d_main_region_listener(wmNotifierRegionListenerParams *)
This makes it easier to add parameters if needed and helps readability.
Also, a caller may pass a derived type with additional parameters, reducing the need for custom-data via
void *
.Are we moving solves to
physics/
orsimulation/
?simulation
exists currently but it is confusing with simulation nodes.I think it was decided to put this on hold for now right?
@JulianEisel, sounds good.
@Blendify, indeed some code layout did change since this task was initially created. Best to get input from @JacquesLucke .
Added subscriber: @Raimund58
Added subscriber: @sebbas
Changed status from 'Confirmed' to: 'Archived'
Archiving. See https://lists.blender.org/pipermail/bf-committers/2021-March/050956.html
Modules re encouraged to organize work without a central hub.