Proposal: BKE_library and BKE_main API naming: prefixes conventions #72604
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#72604
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?
The purpose of this task is not to actually rename all our functions in those headers right now. But rather to define (and document, in a comment in those headers) proper rules for the
BKE_xxx
prefixes we should use for these 'public' APIs.In the past years, me and the few other devs that had to work in that area tried to sanitize a bit old names, but looking at current code state I have the feeling this was at best a mixed success so far.
Current situation
Besides old, never-yet-renamed functions, currently we seem to motsly follow those rules for new/renamed functions:
BKE_main.h
(affecting Main structure itself)BKE_main_
BKE_library.h
(ID management)BKE_libblock_
BKE_id_
BKE_main_id_
BKE_library_
BKE_library_query.h
(queries over Main database)BKE_library_
BKE_library_remap.h
(remapping of IDs)BKE_libblock_
BKE_library_callback_
BKE_library_idmap.h
(mapping from ID type/name to id)BKE_main_idmap_
reafile.c
for in undo code currentlyBKE_library_override.h
(library overrides)BKE_override_library_
BKE_main_override_library_
Remarks
BKE_library_idmap.h
should really be nameBKE_main_idmap.h
, this is not really related to ID management (though it could be useful there in some cases), this is just an alternative 'view' of given Main content.library
is a confusing term, since it is used for both a specific datablock type, and as the generic ID management word.libblock
(when only considering the actual generic ID part of a data-block) versusid
(when considering the whole data-block, including its type-specific stuff) is rather confusing and somewhat misleading. Also because we do not uselibblock
wording anywhere else in Blender codebase afaik. Not sure we’d benefit much about changing that now though, given how deep those functions go allover Blender codebase?Proposal
First, rename
BKE_library_idmap.h
toBKE_main_idmap.h
(and same for the.c
implementation of course).Then rename
BKE_library
files to useBKE_lib
prefix instead (changingBKE_library.h
toBKE_lib_id.h
to avoid having too common/collision-risky name).Finally split out
Library
data-blocks-specific functions into their ownBKE_library
file.Then document this convention in respective headers, based on following principles:
**
BKE_main
files are for operations over the Main database itself, or generating extra temp data to help working with it. Those should typically not affect the data-blocks themselves.**
BKE_library
files are for operations over data-blocks themselves, although they might alter Main as well (when creating/Renaming/deleting an ID e.g.).**
BKE_main_
is kind of obvious.**
BKE_lib_
for all theBKE_library
files, to keep it short, and distinguish it from actual Library data-block specific code.BKE_main.h
(affecting Main structure itself)BKE_main_
BKE_main_
BKE_main_idmap.h
(mapping from ID type/name to id)BKE_main_idmap_
BKE_main_idmap_
BKE_lib_id.h
(ID management)BKE_libblock_
BKE_lib_libblock_
BKE_id_
BKE_lib_id_
BKE_main_id_
BKE_lib_main_
BKE_lib_query.h
(queries over Main database)BKE_library_
BKE_lib_query_
BKE_lib_remap.h
(remapping of IDs)BKE_libblock_
BKE_lib_remap_libblock_
BKE_library_callback_
BKE_lib_remap_callback_
BKE_lib_override.h
(library overrides)BKE_override_library_
BKE_lib_override_library_
BKE_main_override_library_
BKE_lib_override_library_main_
BKE_library.h
(Library IDs)BKE_library_
BKE_library_
This should be enforced for all new functions added there, as well as any future cleanup/renaming.
Added subscribers: @mont29, @brecht, @Sergey, @ideasman42
Note that this is an initial draft, am not happy with all proposed new names,. E.g. the override case is a bit hairy, since we end up using
library
for two different meaning (lib
, as 'par of ID management code, and in
library override`, i.e. 'override of linked data-blocks' [opposed to 'dynamic override']), none of them being fully related to actual Library data-block itself…Proposal sounds good to me.
One extra possible step is to split
BKE_library
perhaps. Just to add some separation betweenallocate new ID block
and operations onLibrary
. But that's another story :)Well thought through, not much to add.
Minor preference to use the lib abbreviation for file naming too:
BLI_lib.h
BLI_lib_remap.h
- we mostly stick to the same convention, so I think it's nice to keep this.@Sergey @ideasman42 agree, will add.
Quick question: if we rename
BKE_library
toBKE_lib
, do we wantBKE_lib.h
/lib.c
(I guess not), or something like e.g.BKE_lib_id.h
/lib_id.c
?Agree having
lib.c
- is too likely to collide w/ other names,BKE_lib_id.h
/lib_id.c
LGTM.@ideasman42 thanks, also talked to @brecht here and he was fine with
BKE_lib_id
as well, so there we go.Changed status from 'Confirmed' to: 'Resolved'
Think we can close this now, changes at high-level have been approved and done, functions renaming will happen on case-by-case approach.