Jump to content

HDK add points, vertices, primitives to SIM_Geometry


Recommended Posts

i'm trying to add new points and primitives to an existing geometry in a DOP with the HDK.

this is what I'm doing:

//from the SIM_Object i find the object i want
SIM_Object *sim_obj = objects.findObjectById(obj_id);

const SIM_Geometry* sim_geo = sim_obj->getGeometry();

GU_DetailHandleAutoReadLock gdl(sim_geo->getGeometry());

const GU_Detail *gdp = gdl.getGdp();

gdp->appendPointOffset();

i can't add anything to the gdp. i get errors like this whenever i try (in this example, appendPointOffset):

error: passing ‘const GU_Detail’ as ‘this’ argument of ‘GA_Offset GEO_Detail::appendPointOffset()’ discards qualifiers

i think it might be because i should be using GU_DetailHandleAutoWriteLock instead of the GU_DetailHandleAutoReadLock, but I can't use the Write version. I get an error like this:

error: no matching function for call to ‘GU_DetailHandleAutoWriteLock::GU_DetailHandleAutoWriteLock(GU_ConstDetailHandle)’

any clues as to how i can do this? thanks.

Link to comment
Share on other sites

Guest mantragora

const GU_Detail*

mean it's locked for modification and you trying to use non cost function on it. All I can say for now without the code.

What you are passing to GU_DetailHandleAutoWriteLock ? Maybe you need to cast it before? It requires

const GU_DetailHandle

and it looks that you are trying to pass

GU_ConstDetailHandle

And it's not exactly the same.

EDIT:

There is a public

GU_ConstDetailHandle::castAwayConst()

method that returns

GU_DetailHandle

Maybe you can cast it later to const and pass to GU_DetailHandleAutoWriteLock ? But I'm sure you can get it before without so many casts.

EDIT2:

You can find example of how to use GU_DetailHandleAutoWriteLock in those three examples in HDK help:

http://www.sidefx.co..._c-example.html

http://www.sidefx.co..._c-example.html

http://www.sidefx.co..._c-example.html

Edited by mantragora
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...