flame: reuse batch groups

This commit is contained in:
Jakub Jezek 2022-03-24 12:56:18 +01:00
parent 9fb6d7a723
commit a87f778f1e
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
3 changed files with 31 additions and 8 deletions

View file

@ -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",

View file

@ -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

View file

@ -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"]