mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
🐛 fix caching
This commit is contained in:
parent
3efd0b4529
commit
7a2e6bdf78
2 changed files with 16 additions and 19 deletions
|
|
@ -1,9 +1,7 @@
|
|||
from .pipeline import (
|
||||
HoudiniHost,
|
||||
ls,
|
||||
containerise,
|
||||
list_instances,
|
||||
remove_instance
|
||||
containerise
|
||||
)
|
||||
|
||||
from .plugin import (
|
||||
|
|
@ -24,8 +22,6 @@ __all__ = [
|
|||
|
||||
"ls",
|
||||
"containerise",
|
||||
"list_instances",
|
||||
"remove_instance",
|
||||
|
||||
"Creator",
|
||||
|
||||
|
|
|
|||
|
|
@ -162,21 +162,22 @@ class HoudiniCreator(NewCreator):
|
|||
self.log.debug("missing lock pattern {}".format(name))
|
||||
|
||||
def collect_instances(self):
|
||||
cached_instances = self.collection_shared_data.get(
|
||||
"houdini_cached_instances", {})
|
||||
instances = cached_instances.get(self.identifier)
|
||||
if not instances:
|
||||
instances = [
|
||||
i for i in lsattr("id", "pyblish.avalon.instance")
|
||||
if i.parm("creator_identifier").eval() == self.identifier
|
||||
]
|
||||
# cache instances if missing
|
||||
if self.collection_shared_data.get("houdini_cached_instances") is None:
|
||||
self.log.info("Caching instances ...")
|
||||
self.collection_shared_data["houdini_cached_instances"] = {}
|
||||
cached_instances = lsattr("id", "pyblish.avalon.instance")
|
||||
for i in cached_instances:
|
||||
creator_id = i.parm("creator_identifier").eval()
|
||||
if creator_id not in self.collection_shared_data[
|
||||
"houdini_cached_instances"]:
|
||||
self.collection_shared_data["houdini_cached_instances"][
|
||||
creator_id] = [i]
|
||||
else:
|
||||
self.collection_shared_data["houdini_cached_instances"][
|
||||
creator_id].append(i)
|
||||
|
||||
if not self.collection_shared_data.get(
|
||||
"houdini_cached_instances"):
|
||||
self.collection_shared_data["houdini_cached_instances"] = {}
|
||||
self.log.info("Caching instances for {}".format(self.identifier))
|
||||
self.collection_shared_data["houdini_cached_instances"][self.identifier] = instances # noqa: E501
|
||||
for instance in instances:
|
||||
for instance in self.collection_shared_data["houdini_cached_instances"].get(self.identifier, []): # noqa
|
||||
created_instance = CreatedInstance.from_existing(
|
||||
read(instance), self
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue