Search the Community
Showing results for tags 'accessing'.
-
Hello guys! I have a simple C++ code which should be used by VEX in Houdini. I need to access to geometry data in specific node from current frame till frame 1 in backward direction until certain condition is met. The problem is that this access cause a huge impact on runtime when using wetmap function in a point wrangle node! Here is the sample: #include <iostream> #include <VEX/VEX_VexOp.h> #include <OP/OP_Director.h> #include <GU/GU_Detail.h> #include <SOP/SOP_Node.h> #include <GEO/GEO_VolumeSampler.h> #include <GU/GU_PrimVolume.h> #include <GU/GU_SopResolver.h> #include <VM/VM_Math.h> #include <OP/OP_AutoLockInputs.h> template <VEX_Precision PREC> static void wetmap(int argc, void *argv[], void *) { VEXvec3<PREC> *resultCd = static_cast<VEXvec3<PREC>*>(argv[0]); const char *surfaceAddress = static_cast<const char *>(argv[1]); VEXvec3<PREC> *P = static_cast<VEXvec3<PREC>*>(argv[2]); VEXvec3<PREC> *Cd = static_cast<VEXvec3<PREC>*>(argv[3]); *resultCd = VEXvec3<PREC>{0, 1, 0}; SOP_Node *surfaceNode = OPgetDirector()->findSOPNode(surfaceAddress); exint currentFrame = CHgetFrameFromTime(CHgetEvalTime()); OP_Context context; VEXvec3<PREC> color{0, 0, 1}; if(surfaceNode != nullptr) { for (exint i = currentFrame; i > 0; --i) { context.setTime(CHgetTimeFromFrame(i)); GU_DetailHandle gd_handle = surfaceNode->getCookedGeoHandle(context); } } } void newVEXOp(void *) { using UT::Literal::operator""_sh; new VEX_VexOp("wetness@&VSVV"_sh, // Signature wetmap<VEX_32>, // Evaluator 32 wetmap<VEX_64> // Evaluator 64 ); } I also try to lock the referenced node input just like SOP node examples in HDK but it makes no difference! This is an image of use case: After couple of frames pointwrangle1 become slow to cook and I don't know why! Can anyone help me? Thanks in advance!