beeemtee Posted August 31, 2010 Share Posted August 31, 2010 (edited) Hi, I am experimenting with point clouds in SOPs. My problem is that the pcunshaded function only iterates random points in H10, and it seems to get into an infinite loop in H11. Does it intended to work in sop context or it's applicable only in shops? Here is the code: sop pc_group( string file = "" ; // Name of the PC file. float radius = 1 ; int max_points = 1000 ; ) { int handle ; int r_ptnum ; newgroup( "keep" ) ; handle = pcopen(file, "P", P, radius, max_points) ; while (pcunshaded( handle, "something" )) { pcimport(handle, "point.number", r_ptnum) ; if (ptnum == 0) { addgroup( "keep", r_ptnum ) ; } } pcclose( handle ) ; } The same code works as expected if pcunshaded is changed to pciterate. Thanks in advance bmt Edited August 31, 2010 by beeemtee Quote Link to comment Share on other sites More sharing options...
beeemtee Posted August 31, 2010 Author Share Posted August 31, 2010 (edited) Is there any other way to move data from one iteration of a vex sop to the next one? Both attributes and groups would be fine, but it seems to me that they are designed to be used only after the SOP is finished the processing of all points. Edited August 31, 2010 by beeemtee Quote Link to comment Share on other sites More sharing options...
lisux Posted September 1, 2010 Share Posted September 1, 2010 I think you can't use pcunshaded in SOP contest, it will only work properly in SHOP. Quote Link to comment Share on other sites More sharing options...
sho Posted September 1, 2010 Share Posted September 1, 2010 Yes, pcunshaded() works in SOP as well. You just need to use pcexport() to have your points "shaded". sop pc_group( string file = "" ; // Name of the PC file. float radius = 1 ; int max_points = 1000 ; ) { int handle ; int r_ptnum ; newgroup( "keep" ) ; int status ; // Add this handle = pcopen(file, "P", P, radius, max_points) ; while (pcunshaded( handle, "something" )) { pcimport(handle, "point.number", r_ptnum) ; if (ptnum == 0) { addgroup( "keep", r_ptnum ) ; } status = pcexport(handle, "something", 1); // Add this } pcclose( handle ) ; } Quote Link to comment Share on other sites More sharing options...
beeemtee Posted September 1, 2010 Author Share Posted September 1, 2010 Yes, you have to shade ALL your queried points in the pcunshaded loop, otherwise it will give you back the unshaded points for infinity. Thanks for your answers! bmt 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.