tony Posted July 11, 2013 Share Posted July 11, 2013 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 evaluatenew_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 thiscontext.setTime(new_t);//Same again but with second context and 1 frame beforenew_t = FRAME(t);new_t-=1;new_t = OPgetDirector()->getChannelManager()->getTime(new_t);second_context.setTime(new_t);*****************************************************************************context+=second_context*****************************************************************************//Lock the input contextif (lockInput(0, context) >= UT_ERROR_ABORT)return error();// Duplicate our incoming geometryduplicateSource(0, context);unlockInput(0);}[/CODE]The bit with the stars around is where it errors. I'd be very grateful for any advice.CheersTony Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted July 11, 2013 Share Posted July 11, 2013 I don't know the answer but there is a an example "of an implementation of the Object Merge SOP" in HDK help. It may give you some ideas about merging multiple gdp into one. Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted July 11, 2013 Share Posted July 11, 2013 (edited) I got it. Below full operator implementation with hip file. Source Code: http://www.mediafire.com/download/h6u9mb1d5vlfaeu/SOP_MergeTwoSourcesWithTimeOffset.zip Edited February 19, 2014 by mantragora 1 Quote Link to comment Share on other sites More sharing options...
tony Posted July 12, 2013 Author Share Posted July 12, 2013 Thanks for pointing me in the direction of that example, it's really useful. Your mediafire link doesn't seem to be working though? Cheers Tony Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted July 12, 2013 Share Posted July 12, 2013 Hmm, just tried it and it works. Quote Link to comment Share on other sites More sharing options...
tony Posted July 12, 2013 Author Share Posted July 12, 2013 Sorry my mistake, it is working fine. That's exactly what I was after, thank you. Cheers Tony 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.