Ninjakeks Posted December 30, 2018 Share Posted December 30, 2018 (edited) Hi, I`m trying to create a SOP node, that basically does the same thing as the copytopoints SOP in Houdini but with a Box deformation added to it. Now I was able to copy the detail from the second Input into the gdp, but I find myself unable to access the newly added geo to actually offset it to the corresponding point in the first input. I want to add that I am a noobie when it comes to HDK (as you can probably see) and any help is much appreciated and thanks in advance. OP_ERROR SOP_copyPTs::cookMySop(OP_Context &context) { OP_AutoLockInputs inputs(this); if (inputs.lock(context) >= UT_ERROR_ABORT) return error(); const GU_Detail *firstGDP = inputGeo(0, context); const GU_Detail *secondGDP = inputGeo(1, context); UT_AutoInterrupt progress("still copying..."); duplicateSource(0, context); GA_RWHandleV3 Phandle(gdp->findAttribute(GA_ATTRIB_POINT, "P")); GA_Offset firstPToff; GEO_CopyMethod copymethod = GEO_COPY_ADD; GA_FOR_ALL_PTOFF(firstGDP, firstPToff) { if (progress.wasInterrupted()) break; gdp->copy(*secondGDP, copymethod, true, false, GA_DATA_ID_CLONE); UT_Vector3 Pvalue = Phandle.get(firstPToff); } Phandle.bumpDataId(); return error(); } i got it to work! (propably a pretty bad way to do it but it works) (orientation is working as well now but its not in the code down below) I am still very interested how experienced users would have written it. :S GA_FOR_ALL_PTOFF(firstGDP, gridPoints) { if (progress.wasInterrupted()) break; GU_Detail *newgdp = new GU_Detail(); GA_RWHandleV3 newPhandle(newgdp->findAttribute(GA_ATTRIB_POINT, "P")); newgdp->copy(*secondGDP, copymethod, true, false, GA_DATA_ID_CLONE); GA_Offset spherePoint; UT_Vector3 pointPos = Phandle.get(gridPoints); GA_FOR_ALL_PTOFF(newgdp, spherePoint) { UT_Vector3 spherePos = newPhandle.get(spherePoint); UT_Vector3 addedPos = spherePos + pointPos; newPhandle.set(spherePoint, addedPos); } gdp->copy(*newgdp, copymethod, true, false, GA_DATA_ID_CLONE); } Edited December 30, 2018 by Ninjakeks wrote the post at 2am and didnt frase the question right 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.