Skip to content

integrate_ftrack_comments

IntegrateFtrackComments

Bases: InstancePlugin

Create comments in ftrack.

Source code in client/ayon_ftrack/plugins/_unused_publish/integrate_ftrack_comments.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class IntegrateFtrackComments(pyblish.api.InstancePlugin):
    """Create comments in ftrack."""

    order = pyblish.api.IntegratorOrder
    label = "Integrate Comments to ftrack"
    families = ["shot"]
    enabled = False

    def process(self, instance):
        session = instance.context.data["ftrackSession"]

        entity = session.query(
            "Shot where name is \"{}\"".format(instance.data["item"].name())
        ).one()

        notes = []
        for comment in instance.data["comments"]:
            notes.append(session.create("Note", {"content": comment}))

        entity["notes"].extend(notes)

        try:
            session.commit()
        except Exception as exc:
            session.rollback()
            raise exc