mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
flame: reuse batch groups
This commit is contained in:
parent
9fb6d7a723
commit
a87f778f1e
3 changed files with 31 additions and 8 deletions
|
|
@ -29,7 +29,8 @@ from .lib import (
|
|||
get_frame_from_filename,
|
||||
get_padding_from_filename,
|
||||
maintained_object_duplication,
|
||||
get_clip_segment
|
||||
get_clip_segment,
|
||||
get_batch_group_from_desktop
|
||||
)
|
||||
from .utils import (
|
||||
setup,
|
||||
|
|
@ -105,6 +106,7 @@ __all__ = [
|
|||
"get_padding_from_filename",
|
||||
"maintained_object_duplication",
|
||||
"get_clip_segment",
|
||||
"get_batch_group_from_desktop",
|
||||
|
||||
# pipeline
|
||||
"install",
|
||||
|
|
|
|||
|
|
@ -708,3 +708,12 @@ def get_clip_segment(flame_clip):
|
|||
raise ValueError("Clip `{}` has too many segments!".format(name))
|
||||
|
||||
return segments[0]
|
||||
|
||||
|
||||
def get_batch_group_from_desktop(name):
|
||||
project = get_current_project()
|
||||
project_desktop = project.current_workspace.desktop
|
||||
|
||||
for bgroup in project_desktop.batch_groups:
|
||||
if bgroup.name.get_value() == name:
|
||||
return bgroup
|
||||
|
|
|
|||
|
|
@ -43,13 +43,25 @@ class IntegrateBatchGroup(pyblish.api.InstancePlugin):
|
|||
self.log.debug(
|
||||
"__ batch_data: {}".format(pformat(batch_data)))
|
||||
|
||||
# create batch with utils
|
||||
opfapi.create_batch(
|
||||
batchgroup_name,
|
||||
frame_start,
|
||||
frame_duration,
|
||||
**batch_data
|
||||
)
|
||||
# check if the batch group already exists
|
||||
bgroup = opfapi.get_batch_group_from_desktop(batchgroup_name)
|
||||
|
||||
if not bgroup:
|
||||
self.log.info(
|
||||
"Creating new batch group: {}".format(batchgroup_name))
|
||||
# create batch with utils
|
||||
opfapi.create_batch(
|
||||
batchgroup_name,
|
||||
frame_start,
|
||||
frame_duration,
|
||||
**batch_data
|
||||
)
|
||||
else:
|
||||
self.log.info(
|
||||
"Updating batch group: {}".format(batchgroup_name))
|
||||
# update already created batch group
|
||||
bgroup.start_frame = frame_start
|
||||
bgroup.duration = frame_duration
|
||||
|
||||
def _get_write_prefs(self, instance, task_data):
|
||||
anatomy_data = instance.data["anatomyData"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue