Jump to content

SOP with only vertex attribute ?


Recommended Posts

Hi,

 

  I am prototyping a SOP which generates UVs (2D) using a sampling algorithm

 

  Here is what I did in the cook

  (1) clearAndDestroy()

  (2) appendVertexBlock(nSamples)

  (3) addFloatTuple(GA_ATTRIB_VERTEX, "suv", 2)

  (4) getVertexRange() // for use subsequently

  (5) set up UT_ValArray<fpreal32> suvResult

  (6) append data via suvResult.append(resultIter->x) in a loop

  finally

  (7) setAttributeFromArray(suvAttrib,vertexRange,suvResult)

 

  When I look at the SOP's spreadsheet, I can see the rows matches nSamples but they are all empty

 

  Is that because vertex need to reference a point (Point Num) so I'd have to add at least a dummy point ?

 

  How would one associate (programmatically) a vertex to the point ?

 

 

Cheers

 

Link to comment
Share on other sites

I don't know that the spreadsheet looks at unattached vertices at all. By definition, a vertex is a "point reference that resides in a primitive". See here for the typical polygon case:

http://www.sidefx.com/docs/hdk13.0/_h_d_k__geometry__intro.html#HDK_GeometryIntro_AddingPrimitive

 

Thanks for that Edward, using that example code as a based, I created a dummy primitive with a single dummy point and added all the sampling UV vertex attribute with all the vertices referencing the same single point and the UV data shows up

 

        prim_poly_ptr->appendVertex(first_ptoff)

 

Cheers

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...