Arthur Cousseau

arthur.cousseau

About Me

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

HDK: OPgetDirector() returns nullptr May 14, 2024, 11:38 a.m.

Hi, I'm trying to run simple examples such as: Management of HDAs and OTLs in Houdini
[www.sidefx.com]
But I'm failing at the very first instruction, OPgetDirector(), which returns a null pointer.
Is it supposed to be initialized globally when loading the HDK? Do I need to setup one?
Thanks.

Read HDA Inputs/Outputs with HDK May 14, 2024, 4:20 a.m.

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!

Use Houdini SDK (HDK) from C#? April 29, 2024, 11:01 a.m.

Hello, I'm trying to use methods from LibOP.dll in C#.
Following this example: https://www.sidefx.com/docs/hdk/_h_d_k__h_d_a_intro.html#HDK_HDAIntro_Examples_Inspection [www.sidefx.com]
I found an entry point, OPgetDirector, that I imported like this in C#:
[DllImport("libop.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?OPgetDirector@@YAPEAVOP_Director@@XZ")]
public static extern IntPtr OPgetDirector();

I found the entry point symbol by using a tool named Dependencies.
Sadly, the IntPtr I get is IntPtr.Zero, which obviously doesn't allow me to do anything.
And honestly, even if it was a valid ptr, I don't know what I would do with it.
Is there anyone here who managed to make HDK work together with C#?
Or am I fighting because of a wrong workflow?
Thanks!