Hi @ajayakumarrp,
I had to do something similar to this in the past. In my case I wanted the user to be able to open a file from the file system, add annotations, then upload the annotations/note to SG.
Here’s what I came up with:
shotgun_mode
has a function called updateTrackingInfo
that is responsible for, as the name suggests, updating the tracking info on a source node in RV. This function only updates existing values and will not work on a source node that was loaded outside of screening room. However, all the function actually requires is for the version ID to be set in the tracking info. So my hack was to insert the ID into the tracking info, then call updateTrackingInfo
to fill in the rest of the values for me.
The other thing to keep in mind is that the updateTrackingInfo
function either works on the currently rendered source, or all sources. You cannot specify a source for it to update. In my case this wasn’t a problem since I only wanted the currently visible source anyway. Here’s all that in code:
import rv
from rv import commands as rvc
version_id = 6073
# Get the source node currently being viewed
source_node = rvc.sourcesRendered()[0]["node"]
# Make sure the tracking info property exists. Create it if it doesn't exist
tracking_info_prop= "%s.tracking.info" % source_node
if not rvc.propertyExists(tracking_info_prop):
rvc.newProperty(tracking_info_prop, rv.commands.StringType, 2)
# Set the version ID on the tracking info
rvc.setStringProperty(tracking_info_prop, ["id", str(version_id)], True)
# Ask the shotgun_mode to fill in the rest of the tracking info based on the version ID
rv.runtime.eval(
"""shotgun_mode.theMode().updateTrackingInfo("one", nil);""",
["shotgun_mode"]
)
At this point, your source node should work exactly as if it had been loaded from screening room. Since we’re not dealing with API calls and hacking our way through this, you have to keep in mind that this method may not work this way (or even exist) in future releases. But for now this should get you what you need.
Hopefully this will work for your scenario as well.
Ehsan