render_annotations_atom, publishing annotations
In Cinesite, we are currently exploring basic functionality of XSTUDIO and how much of it fits with our workflow/pipeline. One of the basic requirements we started out with was publishing annotations.
However, we're coming up with an issue that it difficult to work around.
Our workflow is simply that we pull images from the project server (FTrack), annotate the images, and export the images (from the review application) in a way that allows us to identify the asset version it originally came from. Once we get the entity id, we publish the notes+drawings against the asset version.
Getting Bookmark data is very easy, but associating it with an annotated image is difficult.
The closest functionality in XS is in render_annotations_atom , but according to the comments in the code, it was intended for debugging. render_annotations_atom dumps all annotated images as a single series, not identify the original image, and so it's not possible for us to send these notes back to the server.
Are there any plans of expanding the viewport render toolset that addresses these sort of issues?
(I planned on making an adhoc fix to render_annotations_atom to insert media reference source file path to solve this issue to allow us to continue testing XS in other areas.)
Thanks for reading.
Sounds like you're deep into the code, you have my sympathy :). Anyway if you're implementing a C++ plugin you could look at the Shotgun DNeg plugin src, this implements publishing annotations / notes. Otherwise we could look at exposing a python call to render the Bookmark annotation and return it to python as a buffer, or maybe a destination path to write it to.
@faulknermano i was just looking at xstudio for ftrack. Were you able to make any headway? I don’t like the idea of paying $1600/year for CineSync Pro for a few features I need.
Hi @emlcpfx , given some obstacles in building source code in the studio environment, I've resorted to a workaround which seems to robust enough to continue the path.
The solution I ended up with was so simple I felt like an imbecile. :-)
render_annotations_atom take the list of bookmarks, then sorts them by logical start frame as shown in this snippet in session_actor.cpp:
request(bookmarks_, infinite, bookmark::bookmark_detail_atom_v, d)
.then(
[=](std::vector<bookmark::BookmarkDetail> bd) mutable {
std::sort(
bd.begin(),
bd.end(),
[](const bookmark::BookmarkDetail &a,
const bookmark::BookmarkDetail &b) -> bool {
return *(a.logical_start_frame_) < *(b.logical_start_frame_);
});
Therefore, we can follow the same idea when we implement our own export in Python:
XSTUDIO = Connection(auto_connect=True)
SESSION = XSTUDIO.api.session
bookmarks_object = SESSION.bookmarks
sorted_bookmarks = [] # type: list[tuple[float, Bookmark]]
for bm in bookmarks_object.bookmarks:
mr = bm.media_source.media_reference[0]
fps = mr.rate().fps()
start_frame = bm.start.total_seconds() * fps
sorted_bookmarks.append((start_frame, bm))
# Sort by the start frame
sorted_bookmarks = sorted(sorted_bookmarks, key=lambds x: x[0])
sorted_bookmarks is in the same order as how render_annotations_atom will export it. I can make a sequential association of the MediaReference with the exported numbered images.
Circling back, I guess the docstring of pyfunc render_all_annotations in dump_shots.py is inaccurate. It says "Render all annotations in the session as a sequence of (unordered) images", when in fact it is ordered.
It might instead read: Render all annotations in the session as a sequence of images ordered by the its source start frames.