Skip to content

Commit

Permalink
CutItems Version field is now filled out if Version exists on Shot wi…
Browse files Browse the repository at this point in the history
…th same name as Clip.
  • Loading branch information
Raphael Matto committed Apr 22, 2016
1 parent a96f623 commit 1253231
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 69 deletions.
14 changes: 2 additions & 12 deletions python/tk_multi_importcut/cut_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,6 @@ def sg_version(self):
return self._sg_cut_item["version"]
return None

def set_sg_version(self, sg_version):
"""
Set the Shotgun version associated with this diff
:param sg_version: A SG version, as a dictionary
:raises: ValueError if no EditEvent is associated to this diff
"""
if not self._edit:
raise ValueError("Can't set Shotgun version without an edit entry")
self._edit._sg_version = sg_version

@property
def default_head_in(self):
"""
Expand Down Expand Up @@ -606,9 +596,9 @@ def tail_duration(self):
:returns: An integer or None
"""
if self.cut_out is None or self.tail_out is None:
if self.cut_out is None or self.shot_tail_out is None:
return None
return self.tail_out - self.cut_out
return self.shot_tail_out - self.cut_out

@property
def new_tail_duration(self):
Expand Down
41 changes: 1 addition & 40 deletions python/tk_multi_importcut/edl_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ def do_cut_import(self, title, sender, to, description, update_shots):
self._sg_new_cut = self.create_sg_cut(title, description)
self.update_sg_shots(update_shots)
self.progress_changed.emit(1)
# self.update_sg_versions()
self.progress_changed.emit(2)
self.create_sg_cut_items(self._sg_new_cut)
self.progress_changed.emit(3)
Expand Down Expand Up @@ -1106,44 +1105,6 @@ def update_sg_shots(self, update_shots):
else:
cut_diff._sg_shot = sg_shot

def update_sg_versions(self):
"""
Create versions in Shotgun for each shot which needs one
"""
# Temporary helper to create versions in SG for initial
# testing. Should be commented out before going into production
# unless it becomes part of the specs
self._logger.info("Updating versions ...")
sg_batch_data = []
for shot_name, items in self._summary.iteritems():
for cut_diff in items:
edit = cut_diff.edit
if edit and not edit.get_sg_version() and edit.get_version_name():
sg_batch_data.append({
"request_type": "create",
"entity_type": "Version",
"data": {
"project": self._ctx.project,
"code": edit.get_version_name(),
"entity": cut_diff.sg_shot,
"updated_by": self._ctx.user,
"created_by": self._ctx.user,
"entity": cut_diff.sg_shot,
},
"return_fields": [
"entity.Shot.code",
]
})
if sg_batch_data:
res = self._sg.batch(sg_batch_data)
self._logger.info("Created %d new versions." % len(res))
for shot_name, items in self._summary.iteritems():
for cut_diff in items:
edit = cut_diff.edit
if edit and not edit.get_sg_version():
# Creation order should match
cut_diff.set_sg_version(res.pop(0))

def create_sg_cut_items(self, sg_cut):
"""
Create the cut items in Shotgun, linked to the given cut
Expand Down Expand Up @@ -1178,7 +1139,7 @@ def create_sg_cut_items(self, sg_cut):
"edit_out": edit_out,
"cut_item_duration": cut_diff.new_cut_out - cut_diff.new_cut_in + 1,
"shot": cut_diff.sg_shot,
# "version": edit.get_sg_version(),
"version": cut_diff.sg_version,
"created_by": self._ctx.user,
"updated_by": self._ctx.user,
}
Expand Down
9 changes: 3 additions & 6 deletions resources/examples/RFE.edl
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
TITLE: RFE_EDL_TITLE
FCM: NON-DROP FRAME
001 RFE_CLIP1 V C 00:00:00:00 00:00:00:01 00:00:00:00 00:00:00:01
* FROM CLIP NAME: RFE_V0003.MOV
* LOC: 01:00:00:12 YELLOW rfe001
* FROM CLIP NAME: RFE_V1.MOV
002 RFE_CLIP2 V C 00:00:00:00 00:00:00:03 00:00:00:01 00:00:00:04
* FROM CLIP NAME: RFE_V0052.MOV
* LOC: 01:00:00:12 YELLOW rfe002
* FROM CLIP NAME: RFE_V2
003 RFE_CLIP2 V C 00:00:00:00 00:00:00:02 00:00:00:04 00:00:00:06
* FROM CLIP NAME: RFE_V0002.MOV
* LOC: 01:00:00:12 YELLOW rfe003
* FROM CLIP NAME: RFE_V3
11 changes: 0 additions & 11 deletions resources/examples/RFE_cut_change.edl

This file was deleted.

0 comments on commit 1253231

Please sign in to comment.