ynput / ayon-core

Apache License 2.0
18 stars 30 forks source link

Collect Anatomy Object: avoid `AddonsManager` reinitialization #677

Open BigRoy opened 2 weeks ago

BigRoy commented 2 weeks ago

Is there an existing issue for this?

Please describe the feature you have in mind and explain what the current shortcomings are?

The Collect Anatomy Object plug-in creates an Anatomy instance to the context. Which in its turn seems to initialize an AddonsManager to retrieve the current site for that anatomy?

This clutters the publish logs, and also seems to re-initialize more than is needed because the Addons are already collected prior, by the Collect Addons plug-in.

It would be great if we could somehow avoid the sitesync addon logic in Anatomy or somehow be able to pass along into Anatomy object the pre-initialized addons manager to avoid the extra initializing.

How would you imagine the implementation of the feature?

  1. Avoid the need for the AYON addon manager initialization in Anatomy instance creation.
  2. Or pass the relevant data to the object on __init__ to avoid the initialization pass if e.g. you pass it the addon manager.

Are there any labels you wish to add?

Describe alternatives you've considered:

Live with cluttered logs. :)

Additional context:

It's not critical at all - would just be nice to optimize/clean this up.

BigRoy commented 2 weeks ago

Side note: the site sync addon is currently cached globally on the Anatomy object so the initialization may only occur every 60+ seconds.