Skip to content

Conversation

@moonyuet
Copy link
Member

Changelog Description

This PR is to provide a quick fix to make sure no duplicated objects linked to scene collections.

Additional review information

As there is no duplicated object linked to scene collections.

Testing notes:

  1. Load Camera (both abc and fbx)
  2. Set version or update to the latest
  3. The error should be gone

@moonyuet moonyuet requested a review from LiborBatek December 11, 2025 09:21
@moonyuet moonyuet self-assigned this Dec 11, 2025
@moonyuet moonyuet added the type: bug Something isn't working label Dec 11, 2025
Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All been working well and no issues were spotted. All good!

@LiborBatek
Copy link
Member

@BigRoy here you have it while in ayon-blender 1.0.11 ...those products originates in maya but I guess it doesnt make any difference to any blender based ones too..

Loading_FBX_ABC_Camera.mp4

@LiborBatek
Copy link
Member

@moonyuet @BigRoy how things are with this one? are we stuck for a reason?

Copy link
Contributor

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So after some more investigating, I'm pretty sure the issue is that we're essentially trying to link it where it's already linked (but were than after unlinking it too?)

@moonyuet thoughts?
@LiborBatek can you test if the change seems good to Kayla - and then see if it does actually solve the issue at hand.

Comment on lines +56 to 64
if obj.name in parent.objects:
self.log.info(
"Object with name '%s' already exists in the scene. "
"Skipping linking to the scene collection.",
obj.name,
)
continue
parent.objects.link(obj)
collection.objects.unlink(obj)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm quite sure that I faced this same issue in another PR #214 which I tweaked here: 860200e

The issue of it already being linked - was that because by default it was already linked to parent because it is the active collection in some cases. And this active collection is where things are loaded into by default in blender so they were already linked, hence we can't link them again.

To avoid that ambiguous behavior I think we should just always unlink it from the active, and then link it to where we want it. Which means, just reversing the order of these here.

Suggested change
if obj.name in parent.objects:
self.log.info(
"Object with name '%s' already exists in the scene. "
"Skipping linking to the scene collection.",
obj.name,
)
continue
parent.objects.link(obj)
collection.objects.unlink(obj)
collection.objects.unlink(obj)
parent.objects.link(obj)

Copy link
Contributor

@BigRoy BigRoy Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually - note that this fix ... is already pushed upstream ;) so you can just test develop @LiborBatek because it should be fixed already. :) If so, then we can just close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants