Jump to content

pcunshaded function in SOP context


Recommended Posts

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 by beeemtee
Link to comment
Share on other sites

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 by beeemtee
Link to comment
Share on other sites

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 ) ;
}

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...