Add a basic support to BKE library linking code to generate liboverrides. #104746
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#104746
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "mont29/blender:F-link-override-basics"
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?
This commit adds the ability to generate liboverrides of linked data at
the
BKE_blendfile_link_append
BKE level, and through the Python API(the
BPY_library_load
context manager, akabpy.data.libraries.load
).The python API was updated essentially to allow easy testing of the new
code. This commit also adds tests for the new 'override' behavior, and
for existing basic link one.
Current code only generates 'basic' overrides, without any handing of
hierarchies or dependencies, as for brush assets only the Brush ID needs
to be overridden.
That new feature does not aim at being exposed to user through the
link/append operations in its current state, as it is way too simplistic.
This change is a requirement for the Brush Asset project (#101908).
@blender-bot build
a5bb77aff6
to247be14fa0
Minor requests inline, no need for an additional review iteration.
@ -1319,0 +1349,4 @@
const bool do_use_exisiting_liboverrides = (flags &
BKE_LIBLINK_OVERRIDE_USE_EXISTING_LIBOVERRIDES) != 0;
LinkNode *itemlink;
picky can be declared in the for loop.
@ -150,3 +154,3 @@
" :type relative: bool\n"
" :arg assets_only: If True, only list data-blocks marked as assets.\n"
" :type assets_only: bool\n");
" :type assets_only: bool\n"
The new arguments are missing from the declaration which currently reads.
.. method:: load(filepath, link=False, relative=False, assets_only=False)
Useful as it provides defaults.
@ -151,2 +155,3 @@
" :arg assets_only: If True, only list data-blocks marked as assets.\n"
" :type assets_only: bool\n");
" :type assets_only: bool\n"
" :arg create_liboverrides: If True, liboverrides will be created for linked data \n"
picky no space before newline needed.
@ -152,1 +156,3 @@
" :type assets_only: bool\n");
" :type assets_only: bool\n"
" :arg create_liboverrides: If True, liboverrides will be created for linked data \n"
" (only valid when `link` is True).\n"
picky only 3 additional spaces of indentation is required.
@ -153,0 +157,4 @@
" :arg create_liboverrides: If True, liboverrides will be created for linked data \n"
" (only valid when `link` is True).\n"
" :type create_liboverrides: bool\n"
" :arg reuse_liboverrides: If True and `create_liboverride` is True, \n"
literal quoted values should need to be double-back-tick quoted.
@ -153,0 +160,4 @@
" :arg reuse_liboverrides: If True and `create_liboverride` is True, \n"
" search for existing liboverride first.\n"
" :type reuse_liboverrides: bool\n"
" :arg create_runtime: If True and `create_liboverride` is True, \n"
create_runtime
reads ambiguously and doesn't obviously relate to library-overrides.While it's a bit of a mouthful, Prefer
create_liboverrides_runtime
.@ -159,3 +172,1 @@
bool is_rel = false, is_link = false, use_assets_only = false;
static const char *_keywords[] = {"filepath", "link", "relative", "assets_only", NULL};
bool is_rel = false, is_link = false, use_assets_only = false, create_liboverrides = false,
Code in the body of this function accounts for
link
being false &create_liboverrides
being true. e.g.const bool create_liboverrides = !do_append && self->create_liboverrides;
This adds some uncertainty in how arguments should be used, implying that checking
self->create_liboverrides
withoutdo_append
might cause bugs or unexpected behavior.Suggest to raise an exception when invalid arguments combination are passed in. This way there is no need to check combinations of options are valid in the functions body.
Alternatively, set
create_liboverrides
false whenlink
is false, and warn that invalid combination of arguments were passed in.@ -162,0 +179,4 @@
"create_liboverrides",
"reuse_liboverrides",
"create_runtime",
NULL};
picky
NULL, };
to reduce right shift.@ -339,6 +377,8 @@ static bool bpy_lib_exit_lapp_context_items_cb(BlendfileLinkAppendContext *lapp_
const int py_list_index = POINTER_AS_INT(
BKE_blendfile_link_append_context_item_userdata_get(lapp_context, item));
ID *new_id = BKE_blendfile_link_append_context_item_newid_get(lapp_context, item);
ID *liboverride_id = BKE_blendfile_link_append_context_item_liboverrideid_get(lapp_context,
It's a bit odd to call this function even when
create_liboverrides
isn't set.This reads more strightforward to me.
@ -552,0 +593,4 @@
assert len(bpy.data.collections) == 2 # The linked one and its local liboverride.
# Link + LibOverride, so linked data should have remained linked.
assert bpy.data.meshes[-1].library != None
picky
is None
/is not None
(autopep8 even makes this change automatically).247be14fa0
tobb60ef93f6
@blender-bot build
bb60ef93f6
to4a22cb4557
@blender-bot build