mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Fix same named track item and track would overwrite clip instances and be ignored.
This commit is contained in:
parent
7131dbfeff
commit
6f27305936
1 changed files with 34 additions and 28 deletions
|
|
@ -12,8 +12,9 @@ class CollectClips(api.ContextPlugin):
|
|||
def process(self, context):
|
||||
projectdata = context.data["projectData"]
|
||||
version = context.data.get("version", "001")
|
||||
data = {}
|
||||
instances_data = []
|
||||
for item in context.data.get("selection", []):
|
||||
self.log.debug(item)
|
||||
# Skip audio track items
|
||||
# Try/Except is to handle items types, like EffectTrackItem
|
||||
try:
|
||||
|
|
@ -26,44 +27,49 @@ class CollectClips(api.ContextPlugin):
|
|||
track = item.parent()
|
||||
source = item.source().mediaSource()
|
||||
source_path = source.firstpath()
|
||||
instance_name = "{0}_{1}".format(track.name(), item.name())
|
||||
|
||||
try:
|
||||
head, padding, ext = os.path.basename(source_path).split('.')
|
||||
head, padding, ext = os.path.basename(source_path).split(".")
|
||||
source_first_frame = int(padding)
|
||||
except:
|
||||
source_first_frame = 0
|
||||
|
||||
data[instance_name] = {
|
||||
"item": item,
|
||||
"source": source,
|
||||
"sourcePath": source_path,
|
||||
"track": track.name(),
|
||||
"sourceFirst": source_first_frame,
|
||||
"sourceIn": int(item.sourceIn()),
|
||||
"sourceOut": int(item.sourceOut()),
|
||||
"startFrame": int(item.timelineIn()),
|
||||
"endFrame": int(item.timelineOut())
|
||||
}
|
||||
instances_data.append(
|
||||
{
|
||||
"name": "{0}_{1}".format(track.name(), item.name()),
|
||||
"item": item,
|
||||
"source": source,
|
||||
"sourcePath": source_path,
|
||||
"track": track.name(),
|
||||
"sourceFirst": source_first_frame,
|
||||
"sourceIn": int(item.sourceIn()),
|
||||
"sourceOut": int(item.sourceOut()),
|
||||
"startFrame": int(item.timelineIn()),
|
||||
"endFrame": int(item.timelineOut())
|
||||
}
|
||||
)
|
||||
|
||||
for key, value in data.items():
|
||||
for data in instances_data:
|
||||
family = "clip"
|
||||
context.create_instance(
|
||||
name=key,
|
||||
asset=value["item"].name(),
|
||||
item=value["item"],
|
||||
source=value["source"],
|
||||
sourcePath=value["sourcePath"],
|
||||
instance = context.create_instance(
|
||||
name=data["name"],
|
||||
asset=data["item"].name(),
|
||||
item=data["item"],
|
||||
source=data["source"],
|
||||
sourcePath=data["sourcePath"],
|
||||
family=family,
|
||||
families=[],
|
||||
sourceFirst=value["sourceFirst"],
|
||||
sourceIn=value["sourceIn"],
|
||||
sourceOut=value["sourceOut"],
|
||||
startFrame=value["startFrame"],
|
||||
endFrame=value["endFrame"],
|
||||
handles=projectdata['handles'],
|
||||
sourceFirst=data["sourceFirst"],
|
||||
sourceIn=data["sourceIn"],
|
||||
sourceOut=data["sourceOut"],
|
||||
startFrame=data["startFrame"],
|
||||
endFrame=data["endFrame"],
|
||||
handles=projectdata["handles"],
|
||||
handleStart=0,
|
||||
handleEnd=0,
|
||||
version=version,
|
||||
track=value["track"]
|
||||
track=data["track"]
|
||||
)
|
||||
self.log.debug(
|
||||
"Created instance with data: {}".format(instance.data)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue