Handling of appending collections that contain linked materials has changed from 2.93 to 3.0, no longer works as expected #92224

Closed
opened 2021-10-14 23:33:11 +02:00 by Casey Berg · 23 comments

System Information
Operating system: Mac OS Big Sur Version 11.6
Graphics card: AMD Radeon Pro 5500M 8 GB

Blender Version
Broken: 3.0.0 Alpha
Worked: 2.93.3

Caused by 3be5ce4aad

Short description of error
When using bpy.ops.wm.append on a collection from a file with materials linked from other file, all appended objects now come in as linked, previously objects would be appended and linked materials would come in as links.

Exact steps for others to reproduce the error
linking_example.zip

  • from a fresh blend file use append on the file called "external_objects" in the attached folder
  • choose append_me collection
  • append with Localize All unchecked (this will link the objects in the collection [wrong])

In blender 2.93 the objects appended into scene will be editable, but the materials on them will still be links to the original material file.
In 3.0 the objects will all be linked and non editable, or, if localize all is selected the materials will be localized rather than linked. As far as I can tell there is no way to get the objects to append while keeping the materials linked

**System Information** Operating system: Mac OS Big Sur Version 11.6 Graphics card: AMD Radeon Pro 5500M 8 GB **Blender Version** Broken: 3.0.0 Alpha Worked: 2.93.3 Caused by 3be5ce4aad **Short description of error** When using bpy.ops.wm.append on a collection from a file with materials linked from other file, all appended objects now come in as linked, previously objects would be appended and linked materials would come in as links. **Exact steps for others to reproduce the error** [linking_example.zip](https://archive.blender.org/developer/F11114086/linking_example.zip) - from a fresh blend file use append on the file called "external_objects" in the attached folder - choose `append_me` collection - append with `Localize All` unchecked (this will link the objects in the collection [wrong]) In blender 2.93 the objects appended into scene will be editable, but the materials on them will still be links to the original material file. In 3.0 the objects will all be linked and non editable, or, if localize all is selected the materials will be localized rather than linked. As far as I can tell there is no way to get the objects to append while keeping the materials linked
Author

Added subscriber: @casey_recogni

Added subscriber: @casey_recogni
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Hm, cannot reproduce here.

I have used this:

import bpy

filepath = "/path/to/linking_example/external_objects.blend"
directory = filepath + "/Object"
filename = "Sphere"

bpy.ops.wm.append(filepath=filepath, 
                  directory=directory, 
                  filename=filename, 
                  link=False, 
                  do_reuse_local_id=True, 
                  autoselect=False, 
                  active_collection=True, 
                  instance_collections=True, 
                  instance_object_data=True, 
                  set_fake=True, 
                  use_recursive=True)

If I do this in 3.0, Sphere is editable, material is localized (link to material file vanishes when saving and reopening that file)
Same If I do this in 2.93.5 [with the exception that do_reuse_local_id is not available there].

Could you share the exact code you are using?

Hm, cannot reproduce here. I have used this: ``` import bpy filepath = "/path/to/linking_example/external_objects.blend" directory = filepath + "/Object" filename = "Sphere" bpy.ops.wm.append(filepath=filepath, directory=directory, filename=filename, link=False, do_reuse_local_id=True, autoselect=False, active_collection=True, instance_collections=True, instance_object_data=True, set_fake=True, use_recursive=True) ``` If I do this in 3.0, Sphere is editable, material is localized (link to material file vanishes when saving and reopening that file) Same If I do this in 2.93.5 [with the exception that `do_reuse_local_id` is not available there]. Could you share the exact code you are using?
Author

{F11150819}{F11150729}Sure thing, to clarify though, what I'm looking for is the sphere to be editable and the materials to NOT be localized

        def import_domain(path, domain):
            dir = path + "\\Collection\\"
            print("dir: ", dir)
            bpy.ops.wm.append(
                directory=dir,
                filename=domain,
                instance_collections=False,
                instance_object_data=False,
                use_recursive=False,
            )

at the moment when I run this the objects that get appended are editable but the material links are maintained, but in 3.0 either everything gets linked or everything gets localized

I've attached a screenshot of what the structure of the file is after importing stuff, this started as a new file so everything in it is imported

{[F11150819](https://archive.blender.org/developer/F11150819/import.png)}{F11150729}Sure thing, to clarify though, what I'm looking for is the sphere to be editable and the materials to NOT be localized ``` def import_domain(path, domain): dir = path + "\\Collection\\" print("dir: ", dir) bpy.ops.wm.append( directory=dir, filename=domain, instance_collections=False, instance_object_data=False, use_recursive=False, ) ``` at the moment when I run this the objects that get appended are editable but the material links are maintained, but in 3.0 either everything gets linked or everything gets localized I've attached a screenshot of what the structure of the file is after importing stuff, this started as a new file so everything in it is imported
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm now for collections, will check.
This is also the case for doing it via the UI (so not only in the case of using the Python API)

Can confirm now for collections, will check. This is also the case for doing it via the UI (so not only in the case of using the Python API)
Member

Added subscriber: @mont29

Added subscriber: @mont29
Member

Caused by 3be5ce4aad

CC @mont29

Caused by 3be5ce4aad CC @mont29

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Current code is behaving as it should (on a logical level that is), the appended ID is the collection, so this is the only thing that should be made local here.

Note that objects can easily be made local too (from the Outliner e.g.).

Now, on a user experience level, I am not sure... I can see how also getting the collection's objects made local could be an expected/desired behavior here, even when 'localize all' is disabled. But on the other end this breaks the consistency in behavior of this code.

In any case, even if enabled for users, on code level such 'rule breaking' behavior should be optional.

This is more a product design/UX topic, so would rather get @dfelinto and #user_interface inputs on this topic before making any change and adding some custom exception in such code.

Current code is behaving as it should (on a logical level that is), the appended ID is the collection, so this is the only thing that should be made local here. Note that objects can easily be made local too (from the Outliner e.g.). Now, on a user experience level, I am not sure... I can see how also getting the collection's objects made local could be an expected/desired behavior here, even when 'localize all' is disabled. But on the other end this breaks the consistency in behavior of this code. In any case, even if enabled for users, on code level such 'rule breaking' behavior should be optional. This is more a product design/UX topic, so would rather get @dfelinto and #user_interface inputs on this topic before making any change and adding some custom exception in such code.
Member

Was also talking to @mont29 in chat, but will share my (uneducated) view here:

  • this does not only touch collections, if you append a cube with a lattice modifier in 3.0 and Localize All is OFF, new behavior will also leave the lattice linked to the source file (2.93 also made the lattice local)
    • this is (I think) unexpected, but of course it is right from the technical standpoint (cube is localized, lattice is "indirectly linked")
  • tooltip for Localize All says "...including those indirectly linked from other libraries" (guess part of the confusion also comes from "other libraries"), what is libraries? .blend files?
    • I am wondering (without knowing the code here), if the original intentions of Localize All OFF were to keep links in other files (like in the report: linked materials from .blend B, but localized collections/objects/whatnot from .blend A)
  • workaround is to selectively localize IDs further (objects in collection) via the Outliner
    • in case of the lattice example, this is not possible via the Outliner/UI
Was also talking to @mont29 in chat, but will share my (uneducated) view here: - this does not only touch collections, if you append a cube with a lattice modifier in 3.0 and `Localize All` is OFF, new behavior will also leave the lattice linked to the source file (2.93 also made the lattice local) - this is (I think) unexpected, but of course it is right from the technical standpoint (cube is localized, lattice is "indirectly linked") - tooltip for `Localize All` says "...including those indirectly linked from other libraries" (guess part of the confusion also comes from "other libraries"), what is libraries? .blend files? - I am wondering (without knowing the code here), if the original intentions of `Localize All` OFF were to keep links in other **files** (like in the report: linked materials from .blend B, but localized collections/objects/whatnot from .blend A) - workaround is to selectively localize IDs further (objects in collection) via the Outliner - in case of the lattice example, this is not possible via the Outliner/UI
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Member

Will also CC @Jeroen-Bakker (since #92315/T91252 might be related?)

Will also CC @Jeroen-Bakker (since #92315/T91252 might be related?)

@mont29 I don't see a reason for collections to be treated differently than other datablocks. Users can always hand-pick which objects to make local after appending the collection itself.

@mont29 I don't see a reason for collections to be treated differently than other datablocks. Users can always hand-pick which objects to make local after appending the collection itself.

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'

@lichtwerk I do not see how dealing with external files would be related to dealing with (indirectly) linked IDs...

Anyway, this is behaving as expected now. Again, you can make the objects local as needed from e.g. the Outliner.
Will add a note to the release notes about the change of behavior though. thanks for the report.

@lichtwerk I do not see how dealing with external files would be related to dealing with (indirectly) linked IDs... Anyway, this is behaving as expected now. Again, you can make the objects local as needed from e.g. the Outliner. Will add a note to the release notes about the change of behavior though. thanks for the report.
Member

In #92224#1238008, @mont29 wrote:
@lichtwerk I do not see how dealing with external files would be related to dealing with (indirectly) linked IDs...

Sorry, I was misreading #92315/T91252 as dealing with external/linked .blend files (will go back to my corner).

Guess I will have to live with the new behavior (still thinking about the usecase where you would want Localize All being OFF in 3.0 when dealing with collections at all now though...)
To repeat: afaics, the workflow up to and including 2.93 [which was beneficial and working fine on my end] was that you could append from .blend A and everything from that .blend was localized but if in turn .blend A linked from .blend B those were still links

> In #92224#1238008, @mont29 wrote: > @lichtwerk I do not see how dealing with external files would be related to dealing with (indirectly) linked IDs... > Sorry, I was misreading #92315/T91252 as dealing with external/linked **.blend** files (will go back to my corner). Guess I will have to live with the new behavior (still thinking about the usecase where you would want `Localize All` being OFF in 3.0 when dealing with collections **at all** now though...) To repeat: afaics, the workflow up to and including 2.93 [which was beneficial and working fine on my end] was that you could append from .blend A and everything from that .blend was localized but if in turn .blend A linked from .blend B those were still links

Changed status from 'Archived' to: 'Confirmed'

Changed status from 'Archived' to: 'Confirmed'

@lichtwerk Uuuuh thanks for that precision, that was indeed not clear to me at all until now (I thought it was only a weird quirk in objects handling, not a systematic consistent behavior for all ID types).

That change in behavior was not intended, and only happened due to misunderstanding of confusing code...

There could be two options, either revert to previous behavior, or add a new option to control whether to locallize all IDs from same library (2.93 behavior) or only strictly selected ones (3.0 current behavior).

Talked with @dfelinto, we agreed that for now it was simpler to revert to 2.93 behavior, as it is unclear whether new one is really useful in practice and it breaks existing workflows for no good reasons.

@lichtwerk Uuuuh thanks for that precision, that was indeed not clear to me at all until now (I thought it was only a weird quirk in objects handling, not a systematic consistent behavior for all ID types). That change in behavior was not intended, and only happened due to misunderstanding of confusing code... There could be two options, either revert to previous behavior, or add a new option to control whether to locallize all IDs from same library (2.93 behavior) or only strictly selected ones (3.0 current behavior). Talked with @dfelinto, we agreed that for now it was simpler to revert to 2.93 behavior, as it is unclear whether new one is really useful in practice and it breaks existing workflows for no good reasons.

This issue was referenced by b3b7319de7

This issue was referenced by b3b7319de7aaa17d96e304857bc57401bb11ad17

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne self-assigned this 2021-10-19 16:26:39 +02:00
Sign in to join this conversation.
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
5 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#92224
No description provided.