Python Rop: Part 3 — Parameter Interface Build

Now to start on the UI. In the Edit Type Dialog got to “Parameters” Tab. In the left column make sure “Create Parameters” tab it on “By Type.”

Add Int Parm in Type Properties

First we want to create a quick pull down that will return a 0 or 1. We will then use this to control a toggle to run the python node once per render or once per frame.

Find and highlight “integer” on the left By Type column, and then LMB+DRAG it to the center Existing Parameters section on to “root”. This should place an integer parameter beneath the two existing. If it was created, but not in the right spot, drag to reorder the parameters in the center column until it resembles image above.

In the far right column, make sure you are on the Parameter Tab. Enter for name frameorrender and Execute When for the label.

Add Int Parm Menu Edit in Type Properties

On the far right Parameter Description column, got to Menu Tab and toggle on “use menu.” Make sure you are on the Menu Items radio Tab. Enter the following two menu items that will display text and return an int:

For the first, set Token to 0 and Label to Once Per Render.
For the Second set Token to 1 and Label to Once Per Frame.

Press Apply.

Parm Editor With In PulldownThe Parm Pane should look similar to above image.

The Python Code Editor. We want a python editor in the Parm Pane similar to the python sop. But what is this editor? It doesn’t appear in the Parms By Type list — or does it? … well kind of.

The Python Code editor is a special look/feel for a string field with some tags and setup. This can be created with python or in the Type Properties editor from scratch — but we are not going to do that. If there is significant interest I can make a followup post on how, but there is no reason other than Geek Points. Geek Points are cool, but time is more valuable and same place can be gotten to faster. We already know we want the familiar python sop interface we know and love, so we are simply going to start there.

Netwrok Pane With Sopnet Inside Rop Subnet

Press ENTER to Dive inside the subnet we are working on. Place a sopnet.

Netwrok Pane With Py Sop in Sopnet Inside Rop Subnet

Press ENTER to dive inside the sopnet and place python sop.

Now there are 2 options. The first is preferred as it gets us there faster.

Parm Pan For Python Sop Python Code Label Highlighted

Option 1: If you have Type Properties on top and the Parm Pane visible, Click on the label “Python Code” (highlighted in image) and LMB+DRAG it to the root , on the center Existing Parameters Column of the Type Properties Editor.

Edit TYpe Properties Parms From Node Py Sop Python Code Selected

Option 2: If not all panes are visible or if you are on Linux and your Window manager configuration doesn’t particularly like the pane dragging.

  • Change the far left column Create Parameters to the From Nodes Tab.
  • Navigate the tree to inside python sop.
  • LMB+DRAG The “Python Code” Label to the Middle Exiting Parameters Column on to root.

Either method should now add “Python Code” immediately below our previously created menu. As before, if not in the correct order, drag to reorder.

Press Apply.

The sops Python Code Field will turn green indicating its channel referenced to the top HDA’s UI, this is fine for now. Click in the network editor and press u key twice to return to out working HDA, highlight it and the Parm Pane should now look similar to above.

Python Rop Parm Pane Showing Python Code Field

Great! We have an interface and are well on the way.
Lets bring everything together and make it do work in the next section.