Closed luxalpa closed 1 year ago
Here's the motivation behind it:
When you create a new input node and add a PartInfo to it, the node needs to be cooked before any attributes are added.
This is why this check is there for a debug build only. I kept forgetting to cook the node before creating attributes, so I added this check. Without it, Houdini Engine will error out with some unclear error message. Actually, this check should probably be added to the rest of the add_*_attrubute
functions.
If you take a look at the examples from the documentation, they all have this:
ENSURE_SUCCESS( HAPI_CreateInputNode( &session, &newNode, "Point Cloud" ) );
ENSURE_SUCCESS( HAPI_CookNode( &session, newNode, &cookOptions ) );
Here's an example of how to create a triangle, notice a cook(..)
call at the end.
Hope this helps.
Hm, in the example code, the node is cooked after the attributes are added, not before. I've been using add_numeric_attribute
which doesn't check and it didn't yield any errors.
You're right, in the example it does cooking after adding the attributes. Maybe this check is not necessary anymore, it could be a bug in some older versions of Houdini, I'll double check.
So I did some testing and seems like that debug_assert
is not needed anymore so I'll remove it in the next release. Until then, you can cook the node just before adding a string attribute.
I'm trying to add a new geometry node, but I am getting a panic "Node not cooked" in the
add_string_attribute
function. I assume this check was added accidentally:https://github.com/alexxbb/hapi-rs/blob/3096c1e60a2414847b763a774e0b8fdb4b6ac31a/src/geometry.rs#L466