mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 08:54:53 +01:00
OP-2765 - cleaned up workfile collector
This commit is contained in:
parent
71cd7a3fb0
commit
0506c38e00
2 changed files with 43 additions and 35 deletions
|
|
@ -17,16 +17,37 @@ class CollectWorkfile(pyblish.api.ContextPlugin):
|
||||||
existing_instance = instance
|
existing_instance = instance
|
||||||
break
|
break
|
||||||
|
|
||||||
task = api.Session["AVALON_TASK"]
|
|
||||||
current_file = context.data["currentFile"]
|
current_file = context.data["currentFile"]
|
||||||
staging_dir = os.path.dirname(current_file)
|
staging_dir = os.path.dirname(current_file)
|
||||||
scene_file = os.path.basename(current_file)
|
scene_file = os.path.basename(current_file)
|
||||||
|
if existing_instance is None: # old publish
|
||||||
|
instance = self._get_new_instance(context, scene_file)
|
||||||
|
else:
|
||||||
|
instance = existing_instance
|
||||||
|
|
||||||
|
# creating representation
|
||||||
|
representation = {
|
||||||
|
'name': 'aep',
|
||||||
|
'ext': 'aep',
|
||||||
|
'files': scene_file,
|
||||||
|
"stagingDir": staging_dir,
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.data["representations"].append(representation)
|
||||||
|
|
||||||
|
def _get_new_instance(self, context, scene_file):
|
||||||
|
task = api.Session["AVALON_TASK"]
|
||||||
version = context.data["version"]
|
version = context.data["version"]
|
||||||
asset_entity = context.data["assetEntity"]
|
asset_entity = context.data["assetEntity"]
|
||||||
project_entity = context.data["projectEntity"]
|
project_entity = context.data["projectEntity"]
|
||||||
|
|
||||||
shared_instance_data = {
|
# workfile instance
|
||||||
|
family = "workfile"
|
||||||
|
subset = family + task.capitalize() # TOOD use method
|
||||||
|
|
||||||
|
instance_data = {
|
||||||
"asset": asset_entity["name"],
|
"asset": asset_entity["name"],
|
||||||
|
"task": task,
|
||||||
"frameStart": asset_entity["data"]["frameStart"],
|
"frameStart": asset_entity["data"]["frameStart"],
|
||||||
"frameEnd": asset_entity["data"]["frameEnd"],
|
"frameEnd": asset_entity["data"]["frameEnd"],
|
||||||
"handleStart": asset_entity["data"]["handleStart"],
|
"handleStart": asset_entity["data"]["handleStart"],
|
||||||
|
|
@ -40,37 +61,16 @@ class CollectWorkfile(pyblish.api.ContextPlugin):
|
||||||
project_entity["data"]["resolutionHeight"]),
|
project_entity["data"]["resolutionHeight"]),
|
||||||
"pixelAspect": 1,
|
"pixelAspect": 1,
|
||||||
"step": 1,
|
"step": 1,
|
||||||
"version": version
|
"version": version,
|
||||||
|
"subset": subset,
|
||||||
|
"label": scene_file,
|
||||||
|
"family": family,
|
||||||
|
"families": [family],
|
||||||
|
"representations": list()
|
||||||
}
|
}
|
||||||
|
|
||||||
# workfile instance
|
# Create instance
|
||||||
family = "workfile"
|
instance = context.create_instance(subset)
|
||||||
subset = family + task.capitalize()
|
instance.data.update(instance_data)
|
||||||
if existing_instance is None: # old publish
|
|
||||||
# Create instance
|
|
||||||
instance = context.create_instance(subset)
|
|
||||||
|
|
||||||
# creating instance data
|
return instance
|
||||||
instance.data.update({
|
|
||||||
"subset": subset,
|
|
||||||
"label": scene_file,
|
|
||||||
"family": family,
|
|
||||||
"families": [family],
|
|
||||||
"representations": list()
|
|
||||||
})
|
|
||||||
|
|
||||||
# adding basic script data
|
|
||||||
instance.data.update(shared_instance_data)
|
|
||||||
else:
|
|
||||||
instance = existing_instance
|
|
||||||
instance.data["publish"] = True # for DL
|
|
||||||
|
|
||||||
# creating representation
|
|
||||||
representation = {
|
|
||||||
'name': 'aep',
|
|
||||||
'ext': 'aep',
|
|
||||||
'files': scene_file,
|
|
||||||
"stagingDir": staging_dir,
|
|
||||||
}
|
|
||||||
|
|
||||||
instance.data["representations"].append(representation)
|
|
||||||
|
|
@ -392,6 +392,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
||||||
list of instances
|
list of instances
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
self.log.info("!!!!! _create_instances_for_aov")
|
||||||
task = os.environ["AVALON_TASK"]
|
task = os.environ["AVALON_TASK"]
|
||||||
subset = instance_data["subset"]
|
subset = instance_data["subset"]
|
||||||
cameras = instance_data.get("cameras", [])
|
cameras = instance_data.get("cameras", [])
|
||||||
|
|
@ -454,6 +455,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
||||||
break
|
break
|
||||||
|
|
||||||
if instance_data.get("multipartExr"):
|
if instance_data.get("multipartExr"):
|
||||||
|
self.log.info("!!!!! _create_instances_for_aov add multipartExr")
|
||||||
preview = True
|
preview = True
|
||||||
|
|
||||||
new_instance = copy(instance_data)
|
new_instance = copy(instance_data)
|
||||||
|
|
@ -519,9 +521,10 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
||||||
"""
|
"""
|
||||||
representations = []
|
representations = []
|
||||||
collections, remainders = clique.assemble(exp_files)
|
collections, remainders = clique.assemble(exp_files)
|
||||||
|
self.log.info("!!!!! _get_representations")
|
||||||
# create representation for every collected sequento ce
|
# create representation for every collected sequento ce
|
||||||
for collection in collections:
|
for collection in collections:
|
||||||
|
self.log.info("!!!!! collection")
|
||||||
ext = collection.tail.lstrip(".")
|
ext = collection.tail.lstrip(".")
|
||||||
preview = False
|
preview = False
|
||||||
# if filtered aov name is found in filename, toggle it for
|
# if filtered aov name is found in filename, toggle it for
|
||||||
|
|
@ -533,6 +536,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
||||||
aov,
|
aov,
|
||||||
list(collection)[0]
|
list(collection)[0]
|
||||||
):
|
):
|
||||||
|
self.log.info("!!!!! add preview")
|
||||||
preview = True
|
preview = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
@ -582,6 +586,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
# add reminders as representations
|
# add reminders as representations
|
||||||
for remainder in remainders:
|
for remainder in remainders:
|
||||||
|
self.log.info("!!!!! remainder")
|
||||||
ext = remainder.split(".")[-1]
|
ext = remainder.split(".")[-1]
|
||||||
|
|
||||||
staging = os.path.dirname(remainder)
|
staging = os.path.dirname(remainder)
|
||||||
|
|
@ -602,7 +607,10 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
||||||
"files": os.path.basename(remainder),
|
"files": os.path.basename(remainder),
|
||||||
"stagingDir": os.path.dirname(remainder),
|
"stagingDir": os.path.dirname(remainder),
|
||||||
}
|
}
|
||||||
if "render" in instance.get("families"):
|
is_render_type = set(["render"]).\
|
||||||
|
intersection(instance.get("families"))
|
||||||
|
if is_render_type:
|
||||||
|
self.log.info("!!!!! is_render_type")
|
||||||
rep.update({
|
rep.update({
|
||||||
"fps": instance.get("fps"),
|
"fps": instance.get("fps"),
|
||||||
"tags": ["review"]
|
"tags": ["review"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue