Page MenuHome

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

Description

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 rB3be5ce4aad5e: LibLink: New Append code.

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

  • 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

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Information from User.Oct 15 2021, 12:11 PM

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?

{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

Philipp Oeser (lichtwerk) changed the task status from Needs Information from User to Needs Triage.Oct 16 2021, 7:17 AM
Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Oct 18 2021, 11:49 AM
Philipp Oeser (lichtwerk) edited projects, added Core; removed 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)

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 @Dalai Felinto (dfelinto) and User Interface inputs on this topic before making any change and adding some custom exception in such code.

Was also talking to @Bastien Montagne (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

@Bastien Montagne (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.

Bastien Montagne (mont29) lowered the priority of this task from High to Normal.

@Philipp Oeser (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.

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

Sorry, I was misreading T92315/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

Bastien Montagne (mont29) reopened this task as Confirmed.Oct 19 2021, 3:45 PM
Bastien Montagne (mont29) changed the subtype of this task from "Report" to "Bug".
Bastien Montagne (mont29) moved this task from Backlog to Blender 3.0 on the Core board.

@Philipp Oeser (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 @Dalai Felinto (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.