Houdini 17.0 Nodes Surface tools

Stroke

Interactively draw strokes in the viewport.

On this page

Overview

This is the interactive tool state used by the Stroke and Draw Curve geometry nodes.

Making your own stroke node

If you want your Geometry node asset to have this interaction (that is, allow the user to create strokes in the 3D view and then do something with the stroke geometry), do the following:

  1. In your asset’s type properties, click the Node tab, then set the Default state to stroke.

  2. The stroke state sets the values of several stroke_* parameters on your HDA as you draw strokes. Your node should have those parameters so the state can set them. The usual, and most convenient, way of doing this is to creating a Draw Curve geometry node inside your asset and promoting all of its stroke_* parameters onto your asset.

  3. In the geometry network inside your asset, use the curves output from the Draw Curve node to drive the node’s operation. The curves have useful primitive and point attributes, such as pressure and angle information if the user drew the stroke with a tablet.

For an example you can look at how the Draw Curve asset uses the lower-level Stroke node inside.

Customization

The stroke state will look for spare parameters (usually hidden) on your node with the following names, and if they exist, use their values to customize the operation:

stroke_projgeoinput

Should contain an integer specifying which input to use as the geometry to draw on (stating at 0).

stroke_prompt

Should contain a string which the state will display to the user to in the viewer. For example, Draw on the surface to style the fur.

The stroke state will look for spare parameters (usually hidden action button parameters) on your node with the following names, and if they exist, run the parameter’s callback script in response to certain events. See parameter callback scripts for more information.

prestroke

Runs before Houdini fills in the stroke parameters after the user completes a stroke.

poststroke

Runs after Houdini fills in the stroke parameters after the user completes a stroke.

state_eventcallback

Usually prestroke and poststroke are enough to get the operation you want. However, if you need more finely-grained events as the user draws, you can create this parameter. Houdini will run its callback script with an extra event key in the kwargs dictionary indicating what event happened.

Currently the stroke state has did_enter, did_exit, did_interrupt, did_resume, did_restart, did_brush_resize, did_repeat, and did_accept events.

See also

Surface tools