Jump to content

geometry handle


MENOZ

Recommended Posts

http://www.sidefx.com/docs/houdini14.0/vex/functions/geoself

 

http://www.sidefx.com/docs/houdini14.0/vex/functions/addpoint

Creates a point in the geometry specified by geohandle and returns the virtual point number for it.

 

hello, I am trying to have a better idea of what exactly is a handle.

addpoint vex function requires an handle, but I noticed that usually it works even if i just use zero instead of geohandle().

how to get a handle to a different geometry other than the one generated from geohandle() ?

how can I set a different handle? what for?

 

If I'm supposed to use geoself() why I can specity a handle?

 

Is the handle referring to either of @OpInput*, setting a specific input index, using op:/ , or geoself()?

 

some functions ask for string gometry, some input index, some handle.

 

can somebody make a bit of order on this please?

thank you

 

 

Link to comment
Share on other sites

I've been wondering the same and won't be able to answers to your question with certainty but I'll have a go anyways.

 

My theory about handles vs file inputs such as `@OpInput*` is that a handle is required by the VEX functions that modify a geometry (adding points, setting attributes, ...). On the other side, file inputs are requested by functions solely querying the geometry data. Since the only handle available to us is returned by `geoself()`, then it means that functions taking handles can only modify the current geometry, while the ones taking file inputs can query any geometry in the scene. This makes sense since you probably wouldn't want to create/modify a geometry that is not the current one? Note that I've just made this up and only checked this theory on a few functions so it's most likely that I'm wrong :)

 

I do not know the HDK (yet) but a handle probably refers to something in there. In any case, and even if `geoself()` would always be equal to `0`, you should still use `geoself()` to not expose yourself to bugs either now or in the future, on top of making your code more readable (it's easier to understand what `geoself()` refers to rather than `0`, isn't it?).

Link to comment
Share on other sites

a handle is just an integer shortcut to an open file (usually).  pcopen() returns a handle, for example, and that handle is then used in subsequent pc* functions.  same with metaball functions.  they've aded file_* functions now as well which use handles.

 

it's pretty common to have a reserved handle or two for items that are always defined -- like in this case, the current geo.

 

it's possible they've got plans for vex writing geo to files or multiple streams (like they've added for subnets).

Link to comment
Share on other sites

hey fathom, could you give me an example of how to open a handle to a geometry which is not a point cloud, or current geometry?

 

it's pretty common to have a reserved handle or two for items that are always defined, could you give me an example of this as well? how do I open a different handle which is not current geometry?

does geoself always return zero?

 

I am confused  :unsure:

Link to comment
Share on other sites

hey fathom, could you give me an example of how to open a handle to a geometry which is not a point cloud, or current geometry?

 

it's pretty common to have a reserved handle or two for items that are always defined, could you give me an example of this as well? how do I open a different handle which is not current geometry?

does geoself always return zero?

 

I am confused  :unsure:

 

sorry, i was just explaining handles in the more generic sense.  "handles" are a pretty typical construct for handling data stream/files in all sorts of programming languages/contexts.

 

for example, in C programming you use handles for accessing file streams.  there are standard handles defined before you open any files -- stdin, stdout and stderr -- which i believe are defined as 0, 1, and 2.

 

as of now, i don't know whether you can open "other" geometry than what you're currently operating on, but if you can't now, it might be planned for later.

 

.

Edited by fathom
  • Like 1
Link to comment
Share on other sites

i find the analogy with C excellent, this is exactly how i see handles, even if it's not exactly that ! :)

 

basically the way i visualise it , it's like a C pointer.

- the handles store a int value that represent an adress in the memory of the computer (a pointer)

- this adress point on the first element of an array that contain all the point that have been open by pcopen

 

pciterate allow you to browse each case of the array by iterating on the first adress of the array.

handles is basically the variable that allow you to know where the point you have open in an array , are store in memory.

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