[Sidefx-houdini-list] HDK: How to get nth point attrib value in H16?

Edward Lam edward at sidefx.com
Wed Mar 15 15:42:16 EDT 2017


Ideally, you should read the Houdini Geometry section in the HDK docs:
   - https://www.sidefx.com/docs/hdk/_h_d_k__geometry__intro.html
   - https://www.sidefx.com/docs/hdk/_h_d_k__g_a__using.html
   - https://www.sidefx.com/docs/hdk/_h_d_k__g_a__porting.html

But the direct answer is something like:

   UT_Vector3 p = gdp->getPos3(gdp->pointOffset(point_num));

Check out the table on how to stop using GEO_Point:

   https://www.sidefx.com/docs/hdk/_h_d_k__g_a__using.html#HDK_GA_Using_GEO_Point


Cheers,
-Edward

On 3/15/2017 3:20 PM, Pradeep Barua wrote:
> I haven't used HDK for a long time. Now I'm a little rusty while using new
> classes.
>
> I wrote a tool a long back which was using GEO_Point and GEO_PointList. Until
> H12(since then I was in Python and VEX world) it worked fine but now I get
> more lines of errors than my code :S
>
> At 51 and 59 I need nth point position inside for loop(// create
> connections).
>
> I'm going through the documentation and I think it's a lot to cover. Any
> help(or alternative) is highly appreciated!
>
> My old code:
> //---------------------------------------------------------------- OP_ERROR
> pbConnections::cookMySop(OP_Context &context) { // lock input if
> (lockInputs(context) >= UT_ERROR_ABORT) return error();
>
> // clean the geometry gdp->clearAndDestroy();
>
> // inputs const GU_Detail *source = inputGeo(0); const GU_Detail *target =
> inputGeo(1);
>
> float t = context.getTime();
>
> // get user input parameter values unsigned int maxConnections =
> evalInt("maxConnections", 0, t); int curveSamples = evalInt("curveSamples",
> 0, t); int maxConnectionsClamp = evalInt("maxConnectionsClamp", 0, t);
>
> // number of points in source and target int sourceNumPoints{0},
> targetNumPoints{0};
>
> // number of connections unsigned int connections{0}; connections >
> maxConnections ? connections = maxConnections : 0;
>
> //GEO_PointList sourceNumPoints; // old if (source != NULL) {
> //sourceNumPoints = source->points().entries(); // old H12 sourceNumPoints =
> source->getNumPoints(); // new H16 connections = sourceNumPoints; }
>
> //GEO_PointList targetNumPoints; // old if (target != NULL) {
> //targetNumPoints = target->points().entries(); // old H12 targetNumPoints =
> target->getNumPoints(); // new H16 if (maxConnectionsClamp == 1) connections
> > targetNumPoints ? connections = targetNumPoints : 0; }
>
> // create connections for (int i = 0; i < connections; i++) {
>
> // get the start position const GEO_Point *sourceCurPoint =
> source->points().entry(i); // old H12 UT_Vector3 startPos =
> sourceCurPoint->getPos(); // how to get nth point pos in H16?
>
> // set the end position UT_Vector3 endPos = startPos; // initial endPos
>
> if (targetNumPoints > 0) { const GEO_Point *targetCurPoint =
> target->points().entry(i % targetNumPoints); // old H12 endPos =
> targetCurPoint->getPos(); // how to get nth point pos in H16? }
>
> // some other code // .......
>
> }
>
> // ......... // .........
>
> unlockInputs();
>
> return error(); }
> //----------------------------------------------------------------
>
>
> Thank you!
>
>
>
> -Pradeep Barua _______________________________________________
> Sidefx-houdini-list mailing list Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>




More information about the Sidefx-houdini-list mailing list