AlexOddbratt Posted October 21, 2018 Report Posted October 21, 2018 I'm trying to make an event that runs some code whenever a shot is created, deleted or renamed. I'm running into 1 problem and 1 annoyance/slowdown which both stem from the same issue of several types, ie sequence, shot and task, all being handled as entityType "task". - I currently have to use the entityId and query TypedContext and check if entity isinstance session.types['Shot']. This adds an unnecessary 0.3 second query every time the event is run in order to just check if an entity is a shot. Is this really the most optimized way to figure out if something is a sequence, shot or task? Seems like having a subEntityType attribute in the event data dict that stores what subtype it is would save a lot of querying. - I'm also running into the problem of once a shot is removed I can no longer query the removed entityId, as it returns None, to check if what was deleted was of type shot or not. How do I figure out if it was specifically a shot that was just deleted?
Guest Posted October 22, 2018 Report Posted October 22, 2018 Hi Alex, You should be able to use the objectTypeId on the event, to distinguish between Sequences, Shots and Tasks. When your script starts, get the ids of each relevant ObjectType and then just compare against those. objectTypeId is even available on the event for deleted shots.
AlexOddbratt Posted October 23, 2018 Author Report Posted October 23, 2018 Hey Steve, Thanks for the answer and I understand the approach your suggesting but I can't for the life of me figure out how I would "get the ids of each relevant ObjectType".
Martin Pengelly-Phillips Posted October 23, 2018 Report Posted October 23, 2018 >>> for object_type in session.query("select id, name from ObjectType"): >>> print object_type["id"], object_type["name"] 4be63b64-5010-42fb-bf1f-428af9d638f0 Asset Build 01decdd1-51cb-11e3-9d5b-20c9d0831e59 Milestone bad911de-3bd6-47b9-8b46-3476e237cb36 Shot 11c137c0-ee7e-4f9c-91c5-8c77cec22b2c Task ...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.