Jump to content

New Operator - Default Colour and Shape


Recommended Posts

I am trying to set the default colour and shape of a new operator.

 

I have tried overriding this virtual function in OP_Operator for the color;

virtual UT_Color getDefaultColor() const;

 And this in OP_Operator for the shape;

virtual const UT_StringHolder &getDefaultShape() const;

For the return I tried some of the shapes as listed when you print them out using HOM, "bone", "light" etc

https://www.sidefx.com/docs/houdini/hom/hou/NetworkEditor.html#nodeShapes

 

I am creating a sop driver, so would like to mimic the defaults as seen on these kinds of nodes.

Any ideas on setting these?

Link to comment
Share on other sites

1 hour ago, Aaron Auty said:

I am trying to set the default colour and shape of a new operator.

(...)

Any ideas on setting these?

Doesn't it mirror HOM/Python? This should work:

SOP_MyNode::SOP_MyNode(OP_Network *net, const char *name, OP_Operator *op)
    : SOP_Node(net, name, op) {
    setUserData("nodeshape", "cloud", 1);
    setColor(UT_Color(UT_RGB, 1, 0, 0));
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...