mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #1009 from ynput/bugfix/create-instance-data
Create: Required keys in Create Instance data
This commit is contained in:
commit
ed06d0fd79
2 changed files with 14 additions and 2 deletions
|
|
@ -429,11 +429,18 @@ class CreatedInstance:
|
|||
__immutable_keys = (
|
||||
"id",
|
||||
"instance_id",
|
||||
"product_type",
|
||||
"productType",
|
||||
"creator_identifier",
|
||||
"creator_attributes",
|
||||
"publish_attributes"
|
||||
)
|
||||
# Keys that can be changed, but should not be removed from instance
|
||||
__required_keys = {
|
||||
"folderPath": None,
|
||||
"task": None,
|
||||
"productName": None,
|
||||
"active": True,
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -515,6 +522,9 @@ class CreatedInstance:
|
|||
if data:
|
||||
self._data.update(data)
|
||||
|
||||
for key, default in self.__required_keys.items():
|
||||
self._data.setdefault(key, default)
|
||||
|
||||
if not self._data.get("instance_id"):
|
||||
self._data["instance_id"] = str(uuid4())
|
||||
|
||||
|
|
@ -567,6 +577,8 @@ class CreatedInstance:
|
|||
has_key = key in self._data
|
||||
output = self._data.pop(key, *args, **kwargs)
|
||||
if has_key:
|
||||
if key in self.__required_keys:
|
||||
self._data[key] = self.__required_keys[key]
|
||||
self._create_context.instance_values_changed(
|
||||
self.id, {key: None}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ class InstanceItem:
|
|||
return InstanceItem(
|
||||
instance.id,
|
||||
instance.creator_identifier,
|
||||
instance.label,
|
||||
instance.label or "N/A",
|
||||
instance.group_label,
|
||||
instance.product_type,
|
||||
instance.product_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue