ssh Posted October 12, 2010 Share Posted October 12, 2010 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? Quote Link to comment Share on other sites More sharing options...
ssh Posted October 13, 2010 Author Share Posted October 13, 2010 Just solved this task using vtx.castAttribData() 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.