nicholas_yue Posted October 1, 2014 Share Posted October 1, 2014 (edited) Hi, I am prototyping a SOP which takes in a bunch of points and doing some simulation and wanted to write out the results into an external file for further processing/rendering. Writing the data out on every cookMySop() seems wasteful of I/O e.g. when scrubbing the time line. Is there a call I can make inside cookMySop() to differentiate various trigger of the cooking so that I can minimise file I/O ? I see the following in SOP_HDKObject.C // Peek as to whether we are a render cook or not. cookrender = getCreator()->isCookingRender(); but am not sure if that would fit my intended usage. Cheers Edited October 1, 2014 by nicholas_yue Quote Link to comment Share on other sites More sharing options...
edward Posted October 2, 2014 Share Posted October 2, 2014 isCookingRender() is intended for stuff like the Object Merge SOP where if it's a cooking render, it merges in the node with the render flag of the object instead of the display flag. It makes sense to use if what you want is to only write to disk when your SOP is being rendered. As for knowing whether your SOP is cooking only because of time, that's fairly tricky. If your node is _not_ time dependent, but your input is time dependent, then try using cookParmsModified(). Otherwise, try something like this: // assumes lockInputs() or lockInput(0) called OP_Node *input = getInput(0); if (myLastInputId != input->getUniqueId() || input->cookParmsModified()) { myLastInputId = input->getUniqueId(); // Then we're dirty NOT because of just time, need to write to disk } else { // This was a cook that only changed because of time } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.