mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
fix removement of instances
This commit is contained in:
parent
6b5f0afdba
commit
9a9aeef3ac
1 changed files with 20 additions and 17 deletions
|
|
@ -139,6 +139,26 @@ class TVPaintHost(HostBase, IWorkfileHost, ILoadHost):
|
|||
log.info("Setting up project...")
|
||||
set_context_settings()
|
||||
|
||||
def remove_instance(self, instance):
|
||||
"""Remove instance from current workfile metadata.
|
||||
|
||||
Implementation for Subset manager tool.
|
||||
"""
|
||||
|
||||
current_instances = get_workfile_metadata(SECTION_NAME_INSTANCES)
|
||||
instance_id = instance.get("uuid")
|
||||
found_idx = None
|
||||
if instance_id:
|
||||
for idx, _inst in enumerate(current_instances):
|
||||
if _inst["uuid"] == instance_id:
|
||||
found_idx = idx
|
||||
break
|
||||
|
||||
if found_idx is None:
|
||||
return
|
||||
current_instances.pop(found_idx)
|
||||
write_instances(current_instances)
|
||||
|
||||
def application_exit(self):
|
||||
"""Logic related to TimerManager.
|
||||
|
||||
|
|
@ -421,23 +441,6 @@ def save_current_workfile_context(context):
|
|||
return write_workfile_metadata(SECTION_NAME_CONTEXT, context)
|
||||
|
||||
|
||||
def remove_instance(instance):
|
||||
"""Remove instance from current workfile metadata."""
|
||||
current_instances = get_workfile_metadata(SECTION_NAME_INSTANCES)
|
||||
instance_id = instance.get("uuid")
|
||||
found_idx = None
|
||||
if instance_id:
|
||||
for idx, _inst in enumerate(current_instances):
|
||||
if _inst["uuid"] == instance_id:
|
||||
found_idx = idx
|
||||
break
|
||||
|
||||
if found_idx is None:
|
||||
return
|
||||
current_instances.pop(found_idx)
|
||||
write_instances(current_instances)
|
||||
|
||||
|
||||
def list_instances():
|
||||
"""List all created instances from current workfile."""
|
||||
return get_workfile_metadata(SECTION_NAME_INSTANCES)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue