Read HDA Inputs/Outputs with HDK

   180   0   0
User Avatar
Member
5 posts
Joined: April 2024
Offline
Hi, I'm wondering how I can read the inputs/outputs of the DialogScript in my HDA.
Currently I have this:
#include <OP/OP_OTLLibrary.h>
#include <OP/OP_OperatorTable.h>
#include <OP/OP_Network.h>

void readDialogScript(const char* hdaPath)
{
    OP_OTLLibrary lib(hdaPath, ""); // hdaPath == "Something.hda"

    UT_String table_name, op_name;
    OP_OperatorTable* table;
    OP_Operator* op;

    for (int i = 0; i < lib.getNumDefinitions(); i++)
    {
        table_name = lib.getDefinitionOpTableName(i); // table_name == "Sop"
        table = OP_Network::getOperatorTable(table_name); // table == nullptr. WHY??
        op_name = lib.getDefinitionName(i); // op_name == "Something"
        op = table ? table->getOperator(op_name) : NULL; // op stays nullptr since table is nullptr

        // check if the library does indeed define this op;
        // it may be that some other library that does.
        if (op && &lib != op->getOTLLibrary())
            continue;

        // Crashes because table is nullptr (but should not be).
        auto& inputLabels = op->getInputLabels();
        auto& outputLabels = op->getOutputLabels();
        auto* templates = op->getParmTemplates();
    }
}

I took most of this from HDK doc about HDA. [www.sidefx.com]
I'm using Houdini 18.5.
I don't understand why I'm getting a nullptr when calling OP_Network::getOperatorTable.
This is not mentioned in the docs.
I would want to get to the point where I can call getInputLabels/getOuputLabels on my OP_Operator variable to read the inputs and outputs of my HDA.
Or is it not the right way to achieve this?
Thanks!
Edited by arthur.cousseau - May 14, 2024 09:05:20
  • Quick Links