Hiero: loading plugin settings

This commit is contained in:
Jakub Jezek 2021-04-27 16:35:14 +02:00
parent e5f433fe83
commit fcd8fb23e4
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
4 changed files with 67 additions and 14 deletions

View file

@ -388,7 +388,8 @@ class ClipLoader:
# try to get value from options or evaluate key value for `load_to`
self.new_sequence = options.get("newSequence") or bool(
"New timeline" in options.get("load_to", ""))
self.clip_name_template = options.get(
"clipNameTemplate") or "{asset}_{subset}_{representation}"
assert self._populate_data(), str(
"Cannot Load selected data, look into database "
"or call your supervisor")
@ -433,7 +434,7 @@ class ClipLoader:
asset = str(repr_cntx["asset"])
subset = str(repr_cntx["subset"])
representation = str(repr_cntx["representation"])
self.data["clip_name"] = "_".join([asset, subset, representation])
self.data["clip_name"] = self.clip_name_template.format(**repr_cntx)
self.data["track_name"] = "_".join([subset, representation])
self.data["versionData"] = self.context["version"]["data"]
# gets file path
@ -544,15 +545,9 @@ class ClipLoader:
if "slate" in f),
# if nothing was found then use default None
# so other bool could be used
None) or bool(((
# put together duration of clip attributes
self.timeline_out - self.timeline_in + 1) \
+ self.handle_start \
+ self.handle_end
# and compare it with meda duration
) > self.media_duration)
print("__ slate_on: `{}`".format(slate_on))
None) or bool(int(
(self.timeline_out - self.timeline_in + 1)
+ self.handle_start + self.handle_end) < self.media_duration)
# if slate is on then remove the slate frame from begining
if slate_on:

View file

@ -29,13 +29,19 @@ class LoadClip(phiero.SequenceLoader):
clip_color_last = "green"
clip_color = "red"
def load(self, context, name, namespace, options):
clip_name_template = "{asset}_{subset}_{representation}"
def load(self, context, name, namespace, options):
# add clip name template to options
options.update({
"clipNameTemplate": self.clip_name_template
})
# in case loader uses multiselection
if self.track and self.sequence:
options.update({
"sequence": self.sequence,
"track": self.track
"track": self.track,
"clipNameTemplate": self.clip_name_template
})
# load clip to timeline and get main variables
@ -45,7 +51,8 @@ class LoadClip(phiero.SequenceLoader):
version_data = version.get("data", {})
version_name = version.get("name", None)
colorspace = version_data.get("colorspace", None)
object_name = "{}_{}".format(name, namespace)
object_name = self.clip_name_template.format(
**context["representation"]["context"])
# add additional metadata from the version to imprint Avalon knob
add_keys = [

View file

@ -17,6 +17,18 @@
"handleEnd": 10
}
},
"load": {
"LoadClip": {
"enabled": true,
"families": [
"render2d", "source", "plate", "render", "review"
],
"representations": [
"exr", "dpx", "jpg", "jpeg", "png", "h264", "mov"
],
"clip_name_template": "{asset}_{subset}_{representation}"
}
},
"publish": {
"CollectInstanceVersion": {
"enabled": false

View file

@ -120,6 +120,45 @@
}
]
},
{
"type": "dict",
"collapsible": true,
"key": "load",
"label": "Loader plugins",
"children": [
{
"type": "dict",
"collapsible": true,
"key": "LoadClip",
"label": "Load Clip",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "list",
"key": "families",
"label": "Families",
"object_type": "text"
},
{
"type": "list",
"key": "representations",
"label": "Representations",
"object_type": "text"
},
{
"type": "text",
"key": "clip_name_template",
"label": "Clip name template"
}
]
}
]
},
{
"type": "dict",
"collapsible": true,