Custom preview without output parameter

Hi,

Does anyone know how to “switch on” previews for components that does not have an output parameter?

I am overriding the DrawViewportMeshes method in order to display a preview. For some reason the method is never called when the component does not have an output parameter.

Preview with output parameter:

Preview without output parameter:

(Also notice that the ability to enable/disable preview is gone when there is no outputs)

How do I ‘fix’ this?

Found a solution.

The IsPreviewCapable flag allows you to preview without any input/output.

In addition to this there needs to be some other geometry in the document in order to trigger the DrawViewportMeshes (Thanks @AndersDeleuran for pointing this out). If anyone knows how to trigger the call to DrawViewportMeshes without any additional geometry I would be happy to hear :smiley:

1 Like

Think my brain is still a bit scrambled, totally forgot about the clipping/bounding box method (as seen in this post by @piac, that also demonstrated the IsPreviewCapable property, though as a method) :man_facepalming:


230629_DrawSphere_01.gh (2.0 KB)