[Sidefx-houdini-list] HDK and help with Primitive groups...

Lucio Flores dogboy_l at yahoo.com
Thu Jul 6 12:54:01 EDT 2006

--- Kickaha <kickaha at ponto-dot.com> wrote:

> Hello to all,
>  I have just installed HDK and it is looking very sharp, but i must
> admit i'm having a bit of a problem with some basic stuff. My first
> attempt is to create a SOP to export polygonal geometry (it's a basic
> project just to get to know hdk).
>  I managed to output the data including texture coordinates but i
> needed to split the data in one of two ways:
> a) Output point data separated by the shader they are using
> b) Output point data separated by existing Primitive groups
> Now that's where all my troubles start. How can i get a list of all
> existing Primitive groups? Will i need to resort to dynamic_cast for
> that? And is there a way to get a list of shaders being used besides
> traversing all primitives and checking it's attribute?

If you look in GB/GB_Macros.h, you'll find a #define for what you need. 

#define FOR_ALL_PRIMGROUPS(gdp, grp) \
	    for (grp=(GB_PrimitiveGroup *)gdp->primitiveGroups().head(); grp; \
		grp=(GB_PrimitiveGroup *)grp->next())

This will iterate over all primitive groups. Also look at GB/GB_ExtraMacros.h.
This has more useful definitions.

As for the shaders, the attribute is of type GB_ATTRIB_INDEX, which means that
the attribute itself is just an integer which indexes to a string in a table.
Since there are usually a handful of shader strings with many primitives which
point to them, they cleverly used this method instead of having each primitive
have a full copy of the shader string. Get a pointer from the gdp to the
GB_Attribute which holds the shader, then use GB_Attribute::getIndexSize() and
GB_Attribute::getIndex(int) to get the string values. No need to traverse all
the primitives, just query the attribute.

These are defined in GB/GB_AttributeDefines.h and GB/GB_Attribute.h

> Sorry for such fumb questions but i've been looking at the docs for
> several hours and got nowhere. Thanks to all in advance for any help.
> Cheers,



Manson: My philosophy is:  Don't think.  I don't believe in the mind that you think with and scheme with.  I don't believe in words.

Reporter: If you don't believe in words, why do you use so many of them?

Manson: Words are symbols.  All I'm doing is jumbling the symbols in your brain.  Everything is symbolic.  Symbols are just connections in your brain.  Even your body is a symbol.

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the Sidefx-houdini-list mailing list