HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
13.0: Major Changes In The HDK

Table Of Contents

Many functions are now deprecated

To be able to start removing problematic legacy structures and behaviour from the HDK, many functions are now deprecated, including anything with GEO_Point, GEO_Vertex, GEO_AttributeHandle, or GEO_PrimList in the signature. Points and vertices can be referred to by GA_Offset or GA_Index as appropriate, and attributes can be accessed using GA_*Handle* (e.g. GA_RWHandleV3), applicable AIFs (e.g. GA_AIFCopyData), GA_ElementWrangler subclasses, or GA_AttributeRefMap. Primitives can be accessed by either calling GEO_Detail::getGEOPrimitive(GA_Offset), or GA_Detail::getPrimitiveList() then GA_PrimitiveList::get(GA_Offset).

UT_Array::operator[]() is now deprecated, in order to be able to avoid its behaviour of silently resizing the array. operator()() is what is most often desired, but if the ad-hoc resizing of the array is absolutely necessary, use forcedRef() or forcedGet(). UT_Array::resize() is now setCapacity(). To bump the capacity up by some fraction of the total size if necessary when setting the entries, call bumpEntries(newentries). In a future version, size() and setSize() will be added as synonyms for the two implementations of entries(). UT_PtrArray has also been replaced with UT_ValArray.

GEO_AttributeOwner is deprecated; GA_AttributeOwner and its members should be used instead. GA_GBElement::getNum() is deprecated in favour of getMapIndex(). GEO_Primitive::copyPrimitive() no longer accepts a point redirect, so custom primitive implementations must be updated, and copyOffsetPrimitive() has been removed. Also, GA_Primitive::countMemory() must be implemented, in order to correctly count shared memory. The UT_MemoryCounter passed-in will keep track of shared memory blocks as needed for its use case. All versions of GU_Primitive::notifyCache() have been deprecated, along with the methods relating to ray caches and display caches, since they only applied to the H11 viewport, and a GU_RayIntersect can be constructed directly. Likewise, all GU_DisplayCache subclasses have been deprecated except GU_PrimVolumeCache.

GEO_Primitive::castTo() is now pure virtual, and its implementation must be in GU and must be: return (GU_Primitive*)this; GU_Primitive will have all of its remaining functions moved to GEO_Primitive in a future version to avoid this multiple inheritance issue.

GA_IndexCompactor and its subclasses are deprecated, because they were rendered unnecessary in a previous version by GA_IndexMap always delaying index compacting until indexFromOffset or offsetFromIndex is called.

GCC 4.4 may give deprecation warnings in some of Houdini's header files, because it has bugs in its support for locally muting the warnings. If the number of warnings is unacceptable, upgrading to GCC 4.6 is recommended. Please do not disable deprecation warnings unless you've already removed uses of deprecated functions from your code, since ignoring the warnings may make updating your code for future versions very difficult.

NOTE: If there is anything that does not have an appropriate non-deprecated replacement, please submit a bug report, so that we can fix the issue. Almost everything has a non-deprecated replacement, but please don't hesitate to ask, because we don't want to miss any.

Removed all uses of UT_Math.h and UT_Floor.h

To reduce redundant function declarations, UT_Math.h and UT_Floor.h are now deprecated and all their uses have been removed. All functions declared in UT_Math.h and UT_Floor.h are also declared in SYS_Math.h and SYS_Floor.h respectively. Files, which include UT/UT_Math.h or UT/UT_Floor.h, should include SYS/SYS_Math.h or SYS/SYS_Floor.h instead, and the prefix of all math functions called, should be switched from "UT" to "SYS".

Changes To JSON schema for .geo/.bgeo files

A new major section has been added to the schema for .geo/.bgeo files. Some primitives share data with other primitives. There's a new section ("sharedprimitivedata") which can be used to save this shared data.

Custom primitives may implement this (see the public Alembic code for an example). The relevant methods are:

GA_Primitive::getLocalTransform/setLocalTransform

The GA_Primitive::getLocalTransform/setLocalTransform methods were changed to use 3x3 matrices instead of 4x4 transforms.

  • HDKC13_0_ga_customprim

The signature for the constructor used when registering a custom primitive with a GA_PrimitiveFactory was changed. The GA_PrimitiveDefinition is now passed in as a 3rd argument. This allows the callback to interogate information about the primitive type that it should create.

Changes to VOP_Node base class

As VOPs start to support complex and composite types such as structs, it is necessary to change some of the virtual methods to handle these types. Derived classes should override VOP_Node::getAllowedInputTypeInfosSubclass() instead of VOP_Node::getAllowedInputTypesSubclass() used so far. However, for backwards compatibility getAllowedInputTypesSubclass() is still correctly handled (by calling it in getAllowedInputTypeInfosSubclass() in the base class), although nodes that still rely on the old method won't be able to correctly verify the struct input types. This is not a critical limitation, since most VOPs don't deal with struct inputs, but it it's a best practice to use getAllowedInputTypeInfosSubclass() anyway.

Similarly, as VOPs start to support arbitrary shading contexts (ie, method names for class-based shaders), some of the virtual method signatures need to change from accepting a limiting VOP_ContextType to a more general VOP_CodeGenContext object reference that contains an arbitrary shading context name (a string). For backwards HDK compatibility, the old signatures are still valid and if the new one is not overriden, then the old one will be used, but such calls will not be able to handle arbitrary contexts. The methods whose signature changed are:

Some other methods that changed argument type (and possibly a name) no longer have their leacy version counterpart, since they are rarely overriden in HDK. But if they are, then they need to be changed. They deal with shader parameters:

New framework for custom struct types.

Introduced a new framework for VOP struct types. See VOP Structs for more information.

PRM_SpareData variadic constructor

Prior to H13.0, PRM_SpareData had a variadic constructor which required a list of const char * parameters followed by a NULL pointer. This was problematic since some users just passed the literal 0. On some systems, this was not the same size as a pointer, causing bad memory access. The constructor was changed to take a list of PRM_SpareToken objects. The previous code:

static PRM_SpareData("oprelative", ".",
"opfilter", "!!OBJ!!",
(void *)0);

should now be written as:

<< PRM_SpareToken("oprelative", ".")
<< PRM_SpareToken("opfilter", "!!OBJ!!"));

Note there is no NULL terminator. Also note the << operator which is used to join the variadics.