Jump to content

Merging Contexts


Recommended Posts

Hi,

I'm trying to make a custom version of the trail sop and I'm struggling to get my head around one bit. I've figured out how to evaluate my geometry at different times thanks to the TimeCompare example, but what I want to do is be able to merge multiple contexts, so I can have the geometry from my current frame and the geometry from a different frame all together. Here's my code so far:


SOP_myTrail::cookMySop(OP_Context &context)
{
fpreal t = context.getTime();
fpreal new_t;
OP_Context second_context = context;

// This is the frame number we want to evaluate
new_t = FRAME(t);

// The context takes seconds, not frame, so we convert.
new_t = OPgetDirector()->getChannelManager()->getTime(new_t);

// Adjust our cooking context to reflect this
context.setTime(new_t);

//Same again but with second context and 1 frame before
new_t = FRAME(t);
new_t-=1;
new_t = OPgetDirector()->getChannelManager()->getTime(new_t);
second_context.setTime(new_t);

*****************************************************************************
context+=second_context
*****************************************************************************

//Lock the input context
if (lockInput(0, context) >= UT_ERROR_ABORT)
return error();

// Duplicate our incoming geometry
duplicateSource(0, context);

unlockInput(0);
}
[/CODE]

The bit with the stars around is where it errors. I'd be very grateful for any advice.

Cheers

Tony

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...