Jump to content

GB_AttributeRef in Houdini 11


ssh

Recommended Posts

Hello

I'm porting c++ plugin from Houdini 10 to 11.

This plugin deals with uv.

Original code:

TOPOLOGY t;
...
int uvid = -1;
if(t.hasUV) uvid = gdp->addVertexAttrib("uv",sizeof(UT_Vector3),GB_ATTRIB_FLOAT,GB_ATTRIB_INFO_NONE,NULL);

index = 0;

//for each vertex in each polygon
    if(t.hasUV)
    {
	GEO_Vertex& vtx = (*poly)(j); //j is number a number of vertex in polygon, i.e. first, second, third etc ;
        vtx.initAttributeData(gdp);

	float* uv = (float *)vtx.getAttribData(uvid);
	uv[0] = t.u[index];
        uv[1] = t.v[index];
	uv[2] = 0.0;

    }

With Houdini 10 this works fine.

But wont compile in 11 with error:

"cannot convert from 'GB_AttributeRef' to 'int'"

in that line :

if(t.hasUV) uvid = gdp->addVertexAttrib("uv",sizeof(UT_Vector3),GB_ATTRIB_FLOAT,GB_ATTRIB_INFO_NONE,NULL);

If changing type of uvid from "int uvid" to "GB_AttributeRef uvid"

then receiving error:

'GB_AttributeElem::getAttribData' : cannot convert parameter 1 from 'GB_AttributeRef' to 'int'

in that line :

float* uv = (float *)vtx.getAttribData(uvid);

After reading this:

http://www.sidefx.com/docs/hdk11.0/hdk_changes_11_0.html#HDK_Changes_11_0_GbHowTo

I've tried to use "getValue<int>(uvid)" in new code but no success.

How can one convert this uvid from GB_AttributeRef type to int type, to refer to it as vertex index?

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