HDK
|
Mantra now uses the new registerProcedural()
function to install procedurals. This is done automatically for all dynamic objects found in the MANTRA_DSO_PATH. The loading of the VRAYprocedural
file is still supported, but it's use is discouraged.
There were significant changes to the VRAY_Procedural API with respect to geometry methods:
queryGeometrySegment
to find these attributes.To help with the transition, here are some common code patterns:
Another common pattern is:
OBJ_Node protected member variables myWorldXform and myXform are now private. Use setWorldXform() and setLocalXform() during cooking to set the matrices. Use getWorldXform() and getLocalXform() during cooking to get the matrices. inverseDirty() has also been depracated and is no longer needed because setWorldMatrix() now sets the myInverseDirty flag.
To reduce code duplication and complexity, and increase performance, GA_Primitive now has a GA_OffsetList, myVertexList, indicating the vertices of the primitive, so subclasses no longer need to manage vertex offsets, themselves. This also avoids the need for subclasses to override some functions, since GA_Primitive now has direct access to the vertex list.
Iterating over vertices using GA_Primitive::beginVertex() is now deprecated, because it's slower and more complicated than just using:
or alternatively, if you just need the vertex offsets, using the new forEachVertex() function:
or for point offsets, forEachPoint():
Primitive type constructors are no longer allowed to modify the detail, so they cannot, for example, add a vertex to the detail. Adding a vertex can be done after creating the primitive. This allows all primitive types to be constructed in parallel and removes the need for merge constructors. The signature for the primitive type constructor has also changed, so that it fills in an array of pointers. See the geoNewPrimTetraBlock function in the GEO_PrimTetra.C example file.
To create primitives of some type with vertices, you can use
For example, if you were previously creating sphere primitives with appendPrimitive(GA_PRIMSPHERE) or appendPrimitiveBlock(GA_PRIMSPHERE, nspheres), you should now use:
You will still need to wire the vertices to points, for example:
GA_ElementGroup and GA_ATIGroupBool are now the same class. Most code should work exactly the same as before. If you had any forward declarations of GA_ATIGroupBool, you'll need to change them to GA_ElementGroup, since the remaining real class name is GA_ElementGroup, and GA_ATIGroupBool is just a typedef.
This change avoids the complication of having two separate, but linked, classes for each group. They also now appear in only the group table, saving an extra hash table entry, and GA_AttributeDict defers to the GA_GroupTable when looking up attributes in GA_SCOPE_GROUP.
GA_AttributeDict now has separate hashmaps for attributes in public and private scope, and defers to the corresponding GA_GroupTable for group scope. These hashmaps are also using a much more memory-efficient and memory-coherent data structure, saving memory on small details and time setting up and looking up attributes by name. It also means that attributes no longer needed a separate name and "full name", where the full name previously included an indicator of the scope, so the full name has been removed, saving a little more space per attribute, and a little more time when setting up a new attribute.
The main data structure for numeric attributes and the data structure for string indices in string attributes is now GA_PageArray, instead of GA_DataArray. This change results in much better performance in many cases for GA_ROHandleT and GA_RWHandleT, and reduces memory use in a few cases.
It also allows for more direct access to the data and control over constant pages and shared pages, for use cases that can benefit from that access.
GA_EdgeGroup has been largely re-written to use more modern containers for its data. At the same time it has been made const-correct, and the semantics of removing entries based on the iterator has changed, both of which may affect some existing code.
For example, this type of iteration now requires the use of const:
Range-based for loops can also be used:
If looping over the group and selectively removing elements from it, the same care is required as using std::list
. Example:
Any code that relied on modifying the GA_Edge
returned from the iterator, or GA_EdgeGroup::find
, was already relying on an undefined behavior and will now result in a compile-time error.
Renamed OP_InputIndrect to OP_SubnetIndirectInput. Added OP_Dot to represent network dots. Both OP_Dot and OP_SubnetIndirectInput are subclasses of the new OP_IndirectInput class.
Before network dots, OP_Node and OP_SubnetIndirectInput could be connected to a node's input. But only nodes had exlicit inputs, and so when looking at the outputs of a node or subnet input, you could be assured that you would only get back an OP_Node.
Now, an output can lead to either an OP_Dot or an OP_Node. This required changes to the methods for getting output information from nodes or subnet inputs (and network dots as well). So OP_Node::nOutputs() and OP_Node::getOutput() have been removed. In their place are OP_Node::nOutputItems() and OP_Node::getOutputItem(). These functions refer to and return the OP_NetworkBoxItem objects that are directly connected to this node. The OP_Node::getOutputNodes() function traverses through dots (and optionally into subnetworks) to find any nodes connected directly or indirectly to the output of the node (but not recursively through other nodes). In addition, the OP_OutputIterator and OP_OutputReversedIterator classes wrap a call to OP_Node::getOutputNodes() inside an OP_NodeList subclass that makes iterating over nodes connected to an output of another node as simple as this:
There are also other new utility functions like OP_Node::getFirstOutputNode() and OP_Node::hasAnyOutputNodes() that hide the complexities of dealing with network dots connected to your outputs.
Similarly, the output retrieval functions OP_InputIndirect::nOutputs() and OP_InputIndirect::getOutput() have been replaced by the new OP_IndirectInput::nOutputItems() and OP_IndirectOutput::getOutputItem(), along with most of the same utility functions that exist on OP_Node for hiding network dots and dealing only with the output nodes.
The OP_Dot class itself has all the same capabilities of other OP_NetworkBoxItem objects, with a name, a color, position, and optional parent network box. In general more functionality was moved from the various subclasses into the OP_NetworkBoxItem base class. Many functions were made more general by accepting or return network box items instead of having separate functions for each subclass. In general the term "Item" in a function name means that any OP_NetworkBoxItem is acceptable, though in certain cases (such as OP_Node::getOutputItem()), only a subset of the subclasses may be meaningful for a particular method.
Removed GA_BlobRef.h
. Now GA_BlobData.h is the only header required.
GA_ElementGroup::computeContentHash() has been removed, because it was always incorrect and only used in one place in Houdini. The hash value depended only on the set of active offsets in the detail, and completely ignored the group, so was not useful for groups.
The signatures of SOP_Node::duplicateChangedSource() that took a GU_Topology have been removed, because GU_Topology is not sufficient for determining whether topology has changed, and those signatures were not called anywhere in Houdini.