OP-3909 - added caching of list_instances

list_instances could be expensive in larger workfiles, it makes sense to cache it for all creator, but only for collecting phase. (This is why creator.collection_shared_data is used.)
This commit is contained in:
Petr Kalis 2022-11-03 10:26:53 +01:00
parent 414afab0c0
commit f78bd11977
3 changed files with 22 additions and 4 deletions

View file

@ -7,7 +7,7 @@ from openpype.pipeline import (
CreatorError,
legacy_io,
)
from openpype.hosts.aftereffects.api.pipeline import cache_and_get_instances
class RenderCreator(Creator):
identifier = "render"
@ -28,7 +28,7 @@ class RenderCreator(Creator):
return resources.get_openpype_splash_filepath()
def collect_instances(self):
for instance_data in self.host.list_instances():
for instance_data in cache_and_get_instances(self):
# legacy instances have family=='render' or 'renderLocal', use them
creator_id = (instance_data.get("creator_identifier") or
instance_data.get("family", '').replace("Local", ''))

View file

@ -5,6 +5,7 @@ from openpype.pipeline import (
CreatedInstance,
legacy_io,
)
from openpype.hosts.aftereffects.api.pipeline import cache_and_get_instances
class AEWorkfileCreator(AutoCreator):
@ -17,7 +18,7 @@ class AEWorkfileCreator(AutoCreator):
return []
def collect_instances(self):
for instance_data in self.host.list_instances():
for instance_data in cache_and_get_instances(self):
creator_id = instance_data.get("creator_identifier")
if creator_id == self.identifier:
subset_name = instance_data["subset"]