Jump to content

SOP : Writing out simulation data to disk


Recommended Posts

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 by nicholas_yue
Link to comment
Share on other sites

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
    }

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...