Macha Posted November 7, 2013 Author Share Posted November 7, 2013 (edited) I store them because I use them to create new points, and it's been suggested it may not be safe to do so while looping through points (although in this particular example nothing appears to go wrong if I do so). The other reason is of course because I don't know what I'm doing and try to find out the right ways. I'll try the point block! Edited November 7, 2013 by Macha Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted November 7, 2013 Share Posted November 7, 2013 (edited) I store them because I use them to create new points, and it's been suggested it may not be safe to do so while looping through points. In your original code you are looping thru GU_Detail* gdp not thru const GU_Detail* input1 and that's why I suggested it. If you iterate thru you const GU_Detail* input1 you don't have to worry about it because it's const. Than you can add points to GU_Detail* gdp, not to const GU_Detail* input1, so there is no problem with changing geometry. Edited November 8, 2013 by mantragora Quote Link to comment Share on other sites More sharing options...
edward Posted November 7, 2013 Share Posted November 7, 2013 Another way: UT_Vector3FArray hit_positions; // ... build up hit_positions gdp->appendPointBlock(hit_positions.entries()); // assuming gdp was empty gdp->setPos3FromArray(gdp->getPointRange(), hit_positions); Quote Link to comment Share on other sites More sharing options...
graham Posted November 7, 2013 Share Posted November 7, 2013 Apparently GA_Detail::appendPoint (which returns a GA_Offset) gets overridden by GEO_Detail::appendPoint which returns a GEO_Point. GA_Detail::appendPointOffset is the proper choice in this case... sigh And as has been mentioned several times: don't iterate over the current node's detail (gdp). Grab a reference to the node's first input geometry. Quote Link to comment Share on other sites More sharing options...
Macha Posted November 9, 2013 Author Share Posted November 9, 2013 (edited) If I want to evaluate hits on an environment map (in sops), would I treat it like a map on a sphere geometry, or is there a more direct way to do that? Edited November 9, 2013 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted November 19, 2013 Author Share Posted November 19, 2013 (edited) How come that when I use this technique to loop over points: GA_FOR_ALL_PTOFF(input0, ptOff){...do something...}[/CODE]it doesn't work when I do it twice, like so:[CODE]GA_FOR_ALL_PTOFF(input0, ptOff){...do something...}GA_FOR_ALL_PTOFF(input0, ptOff){...do something else...}[/CODE]It gives me following error (even if I create a new GA_Offset variable for the second loop):[CODE]error: redefinition of 'lcl_start'[/CODE]Wouldn't that lcl_start expire after the first loop is done?I want to get the min and max value of an attribute I created in the first loop. There may be a min max method, but I didn't find one on the att handle. Edited November 19, 2013 by Macha Quote Link to comment Share on other sites More sharing options...
graham Posted November 19, 2013 Share Posted November 19, 2013 Looking at the macro in GA/GA_GBMacros.h it would appear to be doing declaring offset variables outside the loop which naturally leads to this lovely problem. I guess submit a bug? You could at least work around the issue by constructing the loop yourself instead of relying on the macro. GA_Offset lcl_start, lcl_end; \ for (GA_Iterator lcl_it((gdp)->getPointRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \ for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff) 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.