UI Code Quality: General, Smaller Changes #74432
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#74432
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
UI Code Quality: General, Smaller Changes
NOTE: This is a proposal, not an agreed on plan.
Naming conventions
We should avoid ambiguous names. We should also avoid abbreviations, esp. extreme ones, for variables with non-small scope. That should further remove ambiguity and make code more readable.
For example:
ARegion
ar
region
ScrArea
sa
area
bScreen
sc
,scr
screen
PanelType
pt
panel_type
MenuType
mt
menu_type
HeaderType
ht
header_type
ColorBand
coba
color_band
ExtensionRNA
ext
rna_extension
int
x1
,x2
,y1
,y2
xmin
,width
,ymin
,height
Note that all these examples can be changed without touching DNA (AFAICS).
Further:
uiListDyn
->uiList_Runtime
Various
PointerRNA
&PropertyRNA
,wmOperatorType
&PointerRNA
,ScrArea
&ARegion
).uiBut
contains data that only applies to certain button-types.uiButTab
is an example of how this can be avoided.uiBut.editstr
,uiBut.editval
,uiBut.editvec
, etc, it could beuiBut.edit_values.foo
.foo(true, false, false)
is cumbersome to use (what does each boolean mean) and leads to mistakes (using wrong order of booleans). It's better to be explicit what each value refers to by using enum types. Bitflags are also an option.GHOST_FullScreen()
,GHOST_EndFullscreen()
, embedder windows (GHOST_TEmbedderWindowID
+ non-dialog child windows)const
where applicableEVT_
prefix for all event types, to complete work started in D7164.Added subscriber: @JulianEisel
Added subscriber: @ideasman42
WM Names: +1 for naming
region
,area
,screen
.Type Names:
ColorBand: +1 to name
color_band
.ExtensionRNA: prefer
rna_ext
since it's a common enough abbreviation (used 200+ times in our code already).x1, x2, y1, y2:
Added subscriber: @Harley
I would love to see refactor and standardization of our use of words like "Active" and "Selected" in the UI code. We (strangely) use "active" for the state of having the mouse hovering over. Sometimes "Selected" to simulate having focus and therefore activated by hitting "Enter". Other times "Selected" is when it is being actively acted upon. Elsewhere we use Active and Selected in a large variety of different ways. Would love for us to define how we use them in way that is similar to html pseudoclasses:
Hover - when something is being passed over by some input device, like mouse cursor moving over it.
Focus - when an item is selected for, or ready for, keyboard entry. Moved with Tab. A button with focus is executed with Enter.
Default - A preselected item, even if it does not currently have focus.
Active - when something is currently activated by the user, like when a button is being depressed
Selected - Chosen by the user
Disabled - not currently usable or applicable
I realize that the above would not eliminate the overlap with our use of Active verses Selected objects. But even in those I wish we were always just operating on a list of Selected objects, the first of which is what we now consider "Active". That could help in possibly (eventually) getting to a future where we could pass any list of objects to operators without any relation to what is currently selected by the user.
Changing to confirmed because all
TODO
tasks should be confirmed. Feel free to close the task if it's no longer relevant.