Michael Frederickson

mtf

About Me

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

stroke_radius callback script not called when radius changed Aug. 11, 2020, 8:03 p.m.

Thanks for the suggestion. I tried both of the following:

Add a spare param, a float called radius_hack.
Set its value to a python expression: hou.parm(“stroke_radius”).evalAsFloat()
Added a callback script to it: print(“was called”)

If I change the “real” radius stroke, either by changing it's float value or altering it in viewport, “was called” is not printed. As expected, it is printed if I move the slider for radius_hack.

I also tried setting the Python expression of radius_hack to:

hou.parm(“stroke_radius”).evalAsFloat()
import time
print(time.time())

Perhaps this is what you meant. This works, however, when I am drawing a stroke it is called over and over. Since my callback is a caching function that runs somewhat slowly, it's untenable to have it called repeatedly during draw, since it slows things down massively.

EDIT:

I ended up getting something pretty acceptable by doing the following:

Make a spare invisible float param called “last_radius”
Set its value to that of “stroke_radius” on poststroke
On prestroke, check if “last_radius” != “stroke_radius”, and if so, blow the cache

Stroke SOP painting from within HDA Aug. 11, 2020, 4:17 p.m.

Not sure if by this you mean outputting your projection geometry from the HDA, then feeding it up to a merge and back into the asset.

Or, do you have a totally self contained way to do this that doesn't require the end user to reproduce this setup?

Is it possible to “read the geo into the first input of the asset” procedurally?

stroke_radius callback script not called when radius changed Aug. 10, 2020, 11:06 p.m.

I've created an HDA with a stroke node inside, with the Node default state set to stroke.

I have some projection geometry that needs to update its size every time the user changes the radius of their stroke, so, I have a Python command in the callback script entry for stroke_radius.

This is called no problem if stroke_radius is changed directly on the stroke_radius parameter - but, if the user changes radius size by holding shift and dragging left/right in the viewport, the callback script does not fire, despite the stroke_radius value changing in the float field, and in preview size in viewport.

Is this a bug, or expected behavior? Any workarounds you can think of?