houdini HDK开发2——编译节点

通过学习知乎上的一篇文章学会创建houdini自己的节点

1、编写文件SOP_BlahBlah.h(别问什么意思,问就是我也没看懂)

#pragma once
#include <SOP/SOP_Node.h>
class SOP_BlahBlah : public SOP_Node
{
public:
    SOP_BlahBlah(OP_Network *net, const char *name, OP_Operator *op) : SOP_Node(net, name, op) {}
    virtual OP_ERROR cookMySop(OP_Context &context);
};


编写文件SOP_BlahBlah.C

#include "SOP_BlahBlah.h"
#include <GU/GU_Detail.h>
#include <OP/OP_Operator.h>
#include <OP/OP_OperatorTable.h>
#include <UT/UT_DSOVersion.h>


PRM_Template* blahParms()
{
    return nullptr;
}

void newSopOperator(OP_OperatorTable *table)
{


	table->addOperator(new OP_Operator(
                "blahblah",                    // name
                "Blah Blah",                   // display name
                [](OP_Network *net, const char *name, OP_Operator *op) -> OP_Node* {
                    return new SOP_BlahBlah(net, name, op);
                },                             // constructor
                blahParms(),                   // parameters
                0,                             // min # of sources
                0,                             // max # of sources
                nullptr,                       // local variables
                OP_FLAG_GENERATOR              // generates data
    ));
}

OP_ERROR SOP_BlahBlah::cookMySop(OP_Context &context)
{
    gdp->clearAndDestroy();
    return error();
}


2、编译这个.C文件,在我的文档\houdiniXX\dso生成dll文件说明文件编译成功

hcustom C:\Users\huangPeiXin\HDK\SOP_BlahBlah.C

3、在houdini里面即可以创建这个节点
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/peixin_huang/article/details/104043574